import numpy as np
l = np.zeros(5)
t = np.zeros(5)
k = True
for i in range(5):
    l[i] = int(input())
    t[i] = l[i] - (l[i]//10)*10
    if t[i] != 0 :
        k = False
t.sort()
l = np.ceil(l/10)*10
if k :
    ans = int(np.sum(l)+t[0])
else :
    ans = int(np.sum(l)+t[0])-10
print(ans)


