total = 0
c = []
for i in range(5):
    a = input()
    b = int(a)
    if int(a[-1]) != 0:
        c.append(int(a[-1]))
        total += b - int(a[-1]) + 10
    else:
        total += b

total += min(c)
total -= 10
print(total)