d1, d2 = map(int, input().split()) if d1 > d2: print("0") elif 4 * d1 < d2: print("0") elif d1 == d2 or 4 * d1 == d2: print("4") else: print("8")