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(len(1,L)):
    if L[i-1] > L[i]:
        min = L[i]
L.remove(min)
for i in range(Len(L)):
    Len[i] = Len[i] + 10 - Len[i] % 10

print(sum(Len) + min)

    