A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
ls = [A,B,C,D,E]

#1の位
A1 = int(str(A)[-1])
B1 = int(str(B)[-1])
C1 = int(str(C)[-1])
D1 = int(str(D)[-1])
E1 = int(str(E)[-1])

flag=0
ls1 = [A1,B1,C1,D1,E1]
if ls1 == [0,0,0,0,0]:
    flag=1
j=0
for i in ls1:
    if i==0:
        ls1[j]=9
    j+=1

j=0
last = min(ls1)
for i in  ls1:
    #print(i)
    if i == last:
        las = j  #最後に注文するやつのindex
    j+=1

k=0
for i in ls:
    for j in range(1,14):
        if i <= j*10:
            ls[k] = j*10
            break
    k+=1

ls[las] -= (10 - last)
#print(ls)
if flag==0:
    print(sum(ls))
else:
    print(sum(A,B,C,D,E))
