print('Enter values!!')
abc = int(input())
arc = int(input())
agc = int(input())
apc = int(input())
atc = int(input())

food_time = [abc, arc, agc, apc, atc]
sort_time = [0, 0, 0, 0, 0]
total_time = 0


for i in range(5):
    sort_time[i] = food_time[i] % 10
    if food_time[i] % 10 == 0:
        total_time += food_time[i]
    else:
        a = food_time[i] // 10
        a = a * 10 + 10
        total_time += a

sort_time.sort()

for j in range(5):
    if sort_time[j] != 0:
        b = 10-sort_time[j]
        total_time -= b
        break

print(total_time)