a,b = map(int,input().split()) if b/2 < a < b: print(8) elif a == b/2 or a == b: print(4) else: print(0)