def mai(): a, b = map(int, input().split()) if b > a: return 0 if b == a: return 4 if 2 * a == b: return 4 return 8 print(mai())