sum_div = 0
M = []
for i in range(5):
    num = int(input())
    sum_div += num // 10
    mod = num % 10
    if mod != 0:
        M.append(mod)

waiting = 10*(len(M)-1) + min(M)
total = sum_div*10 + waiting
print(total)
