a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
s = [a, b, c, d, e]
u = []
v = []
ans = 0

for i in range(len(s)):
    if s[i] % 10 == 0:
        ans += s[i]
    else:
        u.append(s[i])
        v.append(s[i] % 10)

k = min(v)
for j in range(len(u)):
    ans += u[j] + 10 - v[j]
    
ans = ans - 10 + k
print(ans)

