# AtCoder

lst = [int(input()) for _ in range(5)]

n = len(lst)
diffs = []
for i in range(n):
    dif = 10 - int(str(lst[i])[-1])
    diffs.append(dif)

if sum(diffs) == 50:
    print(sum(lst))
    exit()

mx = max(diffs)
s = []
for i in diffs:
    if i == 10:
        continue
    s.append(i)
print(sum(s)+sum(lst))
