x, y = map(int, input().split()) if x<y and y<2*x: print(8) elif x==y or y==2*x: print(4) else: print(0)