input_list=[input() for i in range(5)]
dishes = [int(n) for n in input_list]
s = 0
for n in dishes:
    if n%10 == 0:
        s += n

dishes = [n for n in dishes if n%10 != 0]
minmod = min([n%10 for n in dishes])


for n in dishes:
    s += n + 10 - n%10

s -= 10
s += minmod
print(s)
