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