a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
count = 10
num = 0
num1 = 0


def f(x):
    return x +10 - (x%10)


list1 = [a,b,c,d,e]
for i in range(5):
    if count > list1[i] % 10 and list1[i]%10!=0:
        count = list1[i]%10
        num = i

for j in range(5):
    if j ==num:
        num1 += list1[j]
    else:
        num1 += f(list1[j])
    
print(num1)
 
 

