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

cooking = [a,b,c,d,e]

min_num = 10000
sum_num = sum(cooking)
for i in range(5):
    tmp = cooking[i]%10
    if tmp != 0:
        min_num = min(min_num, tmp)
        sum_num += 10-tmp

print(sum_num-(10-min_num))


