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

min_value=10
min_index=0
for i, data in enumerate(input_data):
    if data%10 < min_value:
        min_value = data%10
        min_index = i

sum_value=0
for i, data in enumerate(input_data):
    if i != min_index:
        if data%10 != 0:
            sum_value += (int(data/10)+1) *10
        else:
            sum_value += data
    else:
        sum_value += data
print(sum_value)