print(min([eval(input()) for i in [1,1,1]])+min([eval(input()) for i in [1,1]]) -50)
a=[eval(input()) for i in [1]*5]

print(min(a[:3])+min(a[3:])-50)
print(
    min([eval(input()) for i in [1, 1, 1]]) + min([eval(input()) for i in [1, 1]]) - 50
)

a = [eval(input()) for i in [1] * 5]
print(min(a[:3]) + min(a[3:]) - 50)

-print( -    min([eval(input()) for i in [1, 1, 1]]) + min([eval(input()) for i in [1, 1]]) - 50 -) +a = [eval(input()) for i in [1] * 5] +print(min(a[:3]) + min(a[3:]) - 50)