import math D1, D2 = map(int, input().split()) if math.sqrt(D1) == D2 or D1*2 == D2: print(4) elif D1 < D2 < D1*2: print(8) else: print(0)