a = [0]*5
a_one = [0]*5
a_ten = [0]*5
for i in range(5):
    a[i] = int(input())
    a_one[i] = a[i]%10
    a_ten[i] = abs(10-a_one[i])
min_one_index = a_one.index(min(a_one))
ans = 0
for i in range(5):
    if i != min_one_index:
        ans += a[i]+a_ten[i]
    else :
        ans += a[i]
print(ans)