lst_str = [input() for _ in range(5)]
lst_int = [int(x) for x in lst_str]
lst_diff = []

sum_lst = sum(lst_int)
for i in lst_str:
    val = 10 - int(i[-1])#一の位
    if val != 10:
        lst_diff.append(val)
# print(lst_diff)

diff = sum(lst_diff) - max(lst_diff)

ans = sum_lst + diff
print(ans)