import math
src = [input() for _ in range(5)]
k_li = []
v_li = []
for s in src:
    k_li.append(int(s[-1]))
    v_li.append(int(s))
m = min(k_li)
flag = False
sum = 0
for k,v in zip(k_li,v_li):
    if k == m and flag == False:
        sum += v
        flag = True
    else:
        sum += math.ceil(v/10)*10
print(sum)