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

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

a =  min([x%10 for x in menu if x%10 != 0])

print(sum_time-(10-a))