menu = [int(input()) for i in range(5)]
adjust = []
total = 0

for i in menu:
    if i%10 == 0:
        total += i
    else:
        adjust.append(i%10)
        total += (i + 10-(i%10))

adjust.sort()
total -= 10-adjust[0]
print(total)