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