def round_up(i):
    if i % 10 == 0:
        return i
    return 10 - i % 10 + i


l = [int(x[0]) for x in [input().split() for x in range(5)]]

s = 9
index = 5
acc = []
for i in range(5):
    tmp = l[i] % 10
    if tmp != 0 and tmp < s:
        s = tmp
        index = i
    acc.append(round_up(l[i]))

print(sum(acc) - (10 - s))
