import sys

sys.setrecursionlimit(10 ** 6)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()
ntp = lambda: tuple(map(int, stdin.readline().split()))
mod = 10 * 9 + 7
inf = 2 << 60

D = na()

if D[0] == D[1] or 2 * D[0] ** 2 == D[1] ** 2:
    ans = 4
elif D[0] < D[1] and D[1] ** 2 < 2 * D[0] ** 2:
    ans = 8
else:
    ans = 0

print(ans)