lst = []
for i in range(5):
    lst.append(int(input()))
    if i < 0 or i > 123:
        print("wrong input")
        sys.exit()

t = 0
for x in lst:
    if x % 10 == 0:
        t += x
        lst.remove(x)

lss = sorted(lst, reverse = True, key = lambda x:x%10)

while len(lss) > 1:
    t += lss.pop(0)
    t += 10 - t % 10

t += lss[0]
print(t)
