a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

l = [a, b, c, d, e]
l_times_ten = []
amari_list = []
time = 0
for i in range(len(l)):
    amari = l[i] % 10
    amari_list.append(amari)
    if amari == 0:
        l_times_ten.append(l[i])
    elif amari != 0:
        l_tmp =  l[i] +(10 - amari)
        l_times_ten.append(l_tmp)
# print(l_times_ten)
# print(amari_list)
max_total_time = sum(l_times_ten)
min_total_time = max_total_time - (10 - max(amari_list))
print(min_total_time)