/*
 * usage:
 * getdvhoff <device> <part-num>
*/

#include <stdio.h>

int main(int argc, char *argv[])
{
	FILE *f = fopen(argv[1], "r");
	unsigned char c[4];
	unsigned int x;

	if (argc < 3)
		return 1;

	fseek(f, 316 + 12 * atoi(argv[2]), SEEK_SET);
	fread(c, 4, 1, f);

	x = (((unsigned)c[3]) |
	     ((unsigned)c[2] << 8) |
	     ((unsigned)c[1] << 16) |
	     ((unsigned)c[0] << 24));

	fclose(f);
	printf("%d", (x * 512));

	return 0;
}
