a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

l = [a, b, c, d, e]
m = []
amari_list = []
time = 0
for i in range(len(l)):
    amari = l[i] % 10
    amari_list.append(amari)
    if amari == 0:
        m.append(l[i])
    elif amari != 0:
        l_tmp =  l[i] +(10 - amari)
        m.append(l_tmp)

max_total_time = sum(m)
min_time = max_total_time - max(amari_list)
print(min_time)