L = []
for _ in range(5):
    n = int(input())
    L.append([n%10, n])

L.sort()
for i in range(5):
    if L[i][0] != 0:
        la = L[i][1]
        l = i
        break

tot = 0
for i in range(5):
    if i != l:
        if L[i][1] % 10 != 0:
            k = L[i][1]//10 + 1
        else:
            k = L[i][1]//10
        tot += k*10
tot += la
print(tot)
