import itertools

s = [int(input()) for _ in range(5)]

res = 1 << 28
for ss in itertools.permutations(s):
    tmp = 0
    tmp += (ss[0] + 9) // 10
    tmp += (ss[1] + 9) // 10
    tmp += (ss[2] + 9) // 10
    tmp += (ss[3] + 9) // 10
    tmp += ss[4]
    res = min(res, tmp)

print(res)
