A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

L = [A,B,C,D,E]
min = 0

for i in range(1,len(L)):
    if L[i-1] % 10 > L[i] % 10 and L[i] % 10 != 0 :
        min = L[i]
L.remove(min)
for i in range(len(L)):
    if L[i] % 10 != 0:
        L[i] = L[i] + 10 - L[i] % 10

print(sum(L) + min)