print((24*2-int(eval(input()))))
print((48-int(eval(input()))))

print((24 * 2 - int(eval(input()))))

print((48 - int(eval(input()))))

-print((24 * 2 - int(eval(input())))) +print((48 - int(eval(input()))))