# -*- coding: utf-8 -*-

list = [int(input()) for i in range(5)]

list3 = []

time = 0

for a in list:
    if a % 10 == 0:
        time += a
    else: list3.append(a)

#list3の並び替え
max = 0
key = 0
for a in list3:
    v = 10-(a%10)
    if v > max:
        max = v
        key = a


for a in list3[0:len(list3)]:
    if key==a: continue
    v = 10-(a%10)
    time += v + a

print(time+key)
