using System;
using System.IO;

class RomChecksum {
	public static void Main(string[] args) {
		var bytes = File.ReadAllBytes(args[0]);
		uint checksum = 0;
		unsafe {
			fixed (byte* pBytes = bytes) {
				uint* pDwords = (uint*)pBytes;
				for (int i = 0; i < bytes.Length/sizeof(uint) - 1; i++)
					checksum += pDwords[i];
			}
		}
		Console.WriteLine("{0}", (0 - checksum).ToString("X"));
	}
}