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



P = P + A*3



print((P//2))
A,P = list(map(int,input().split()))



P += A*3



print((P//2))
A, P = list(map(int, input().split()))
P = P + A * 3
print((P // 2))

A, P = list(map(int, input().split()))
P += A * 3
print((P // 2))

-P = P + A * 3 +P += A * 3