c, d = map(int, input().split()) ans = 0 for k, v in [(d < 2 * c < 2 * d, 8), (c == d or 2 * c == d, 4)]: if k: ans = v print(ans)