D1,D2=map(int, input().split()) r=(D1)**(1/2) l=(D2)**(1/2) s=l/2 if r < l: if s > r: print("0") elif r == l: print("4") else: print("8") elif r == l: print("4") else: print("0")