t = [int(input()) for i in range(5)]
t.sort()
count = 0
min_list = [t[0]%10,t[1]%10,t[2]%10,t[3]%10,t[4]%10]
for i in range(5):
    x = min_list[i]
    if x != 0:
        break
f =min([t[0]%10,t[1]%10,t[2]%10,t[3]%10,t[4]%10])
for i in range(5):
    if t[i]%10 == 0 :
        t[i] = t[i]-1
        count = 1
a =(t[4]//10+1)*10
b =(t[3]//10+1)*10
c =(t[2]//10+1)*10
d =(t[1]//10+1)*10
e =(t[0]//10+1)*10
if count == 0:
    print(a+b+c+d+e+f-10)
else:
    print(a+b+c+d+e+x-10)