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

def fun(a):
    return a + 10 - a % 10

su = sum([fun(l) if l % 10 != 0 else l for l in li])
last = li[0]
for l in li:
    if last % 10 > l % 10 and l % 10 != 0:
        last = l
print(su - fun(last) + last)