#include <stdio.h>

int main()
{
	int x, y;

	scanf("%d %d", &x, &y);

	int ans = 0;

	if (x <= 3) ans += 100000 * (4 - x);
	if (y <= 3) ans += 100000 * (4 - y);
	if (x == 1 && y == 1) ans += 400000;

	printf("%d\n", ans);

	return 0;
}