from sys import stdin
import math

foods = [ stdin.readline().rstrip() for _ in range(5) ]
last = [ int(_[-1]) for _ in foods ]
last_sorted = sorted(last)
for i in last_sorted:
    if i == 0:
        continue
    else:
        min = i
        break
ans=0
foods_int = [ int(k) for k in foods]
for j in range(len(foods_int)):
    if j == last.index(min):
        ans+=foods_int[j]
    else:
        ans+=math.ceil(foods_int[j]/10) * 10
print(ans)