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