D,d=map(int,input().split()) if (2*Dd):print(0) elif (2*D==d) or (D==d):print(1*4) else:print(2*4)