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