times = [int(input()) for _ in range(5)]
diff = [False for i in range(10)]
for time in times:
    diff[time%10]=True
res = 0
for i in range(1, 10):
    if diff[i]:
        res=i
        break

for i in range(5):
    rep = times[i]//10
    if times[i]%10!=0:
        rep+=1
    times[i] = rep*10

print(sum(times) - (10 - res))
