import numpy as np
sho_ls = []
amari_ls = []
a_ls = []
for _ in range(5):
    a = int(input())
    a_ls.append(a)
    sho, amari = divmod(a,10)
    sho_ls.append(sho)
    amari_ls.append(amari)

amari_ls_not0 = []
for i in range(5):
    if amari_ls[i] != 0:
        amari_ls_not0.append(amari_ls[i])

amari_min_not0 = min(amari_ls_not0)
arg_min = amari_ls.index(amari_min_not0)
ans = 0
for i in range(5):
    if i != arg_min:
        if amari_ls[i] != 0:
            plus = a_ls[i] + 10 - amari_ls[i]
            ans += plus
            
        else:
            plus = a_ls[i]
            ans += plus
plus = a_ls[arg_min]
ans += plus
print(ans)