result = 0
min = 9
for i in range(5):
    time = int(input())
    result = result+time if time%10 == 0 else result + time + 10-(time%10)
    if time % 10 < min and time % 10 !=0:
        min = time % 10
print(result - (10-min))
