data = []
for i in range(5):
    data.append(int(input()))

for i in range(4):
    if data[i] - data[i+1] -10  > 0:
        estimate_number = data[i]
    else:
        estimate_number = data[i+1]
    
print(estimate_number)    
    