tt = [int(input()) for i in range(5)]
ll = [10*i for i in range(14)]
ans = []
at = bt = ct = dt = et = 0
for t in tt:
    i = 0
    while t > ll[i]:
        print(t, ll[i])
        i+=1
    ans.append(ll[i])

max = 0
dex = 0
for i in range(5):
    if ans[i] - tt[i] > max:
        dex = i
        max = ans[i]-tt[i]
at = 0
for j in range(5):
    if j != dex:
        at += ans[j]
    if j == dex:
        at += tt[j]

print(at)
