import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from math import sqrt d1, d2 = map(int, readline().split()) a = sqrt(d1) * 2 b = sqrt(2 * d2) if a > b: print(8) elif a == b: print(4) else: print(0)