import math
a = []
for i in range(5):
    a.append(int(input()))
count = 0
min_i = 9
min_aa = 0
for i in a:
    #しも一桁時刻1~4のもの最小のやつが最後
    ama = i % 10
    if (ama < min_i) & (ama != 0):
        min_i = ama
        min_aa = i
#print('min',min_i)
aaa = 0
for i in a:
    #print(i)
    if ((i == min_aa)&(aaa == 0)):
        count += i
        aaa += 1
    elif (i % 10 == 0):
        #print('tasui',i)
        count += i
    else:
        count += (i + (10 - i % 10))
        #print('tasu',(i + (10 - i % 10)))
print(count)