A, B = list(map(int, input().split()))



print((0 if A <= 5 else (B if A >= 13 else B // 2)))
a, b = list(map(int, input().split()))

if a >= 13:

    print(b)

elif 6 <= a <= 12:

    print((b // 2))

else:

    print((0))
A, B = list(map(int, input().split()))
print((0 if A <= 5 else (B if A >= 13 else B // 2)))

a, b = list(map(int, input().split()))
if a >= 13:
    print(b)
elif 6 <= a <= 12:
    print((b // 2))
else:
    print((0))

-A, B = list(map(int, input().split())) -print((0 if A <= 5 else (B if A >= 13 else B // 2))) +a, b = list(map(int, input().split())) +if a >= 13: +    print(b) +elif 6 <= a <= 12: +    print((b // 2)) +else: +    print((0))