a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
mozi = [a, b, c, d, e]
rup = [round(mozi[i], -1) if mozi[i] % 10 == 0 else
       round(mozi[i] + 5, -1)
       for i in range(len(mozi))]

amari = [mozi[i] % 10 if mozi[i] % 10 != 0 else
         10 for i in range(len(mozi))]

m_r_a = list(zip(mozi, rup, amari))
sorta_m_r_a =(sorted(m_r_a, key=lambda x:x[2], reverse=True))
print(sorta_m_r_a)
dishes_4sum = 0
for i in range(4):
    dishes_4sum += sorta_m_r_a[i][1]
dishes_5sum = dishes_4sum + sorta_m_r_a[4][0]

print(dishes_5sum)