a = []
for i in range(5):
    a.append(int(input() )) 


t =0
for i,m in enumerate(a):
    t += int(m/10) * 10
    if m%10 != 0:
        t = t + 10

b = [10 - (x%10) for x in a]
b = list(filter(lambda x:x !=10, b))
print(t - max(b))