import math
lst = [int(input()) for _ in range(5)] 

lst1 = []
min1 = 9
num1 = 5

for i, l in enumerate(lst):
    lst1.append(math.ceil(l/10)*10)
    if min1 > l%10 and l%10!=0:
        min1 = l%10
        num1 = i
lst1[num1] = lst[num1]

print(sum(lst1))