# coding: utf-8
import math
# Your code here!
menu = list()
for i in range(5):
    menu.append(int(input()))

a = [x%10 for x in menu]


index = a.index(min(a))

max_food = menu.pop(index)

menu = [math.ceil(x/10)*10 for x in menu]

print(sum(menu)+max_food)