a = []
for i in range(5):
    a.append(int(input()))
 
b = []
c = []
for j in range(5):
    if a[j] % 10 == 0:
        b.append(a[j]-10)
        c.append(10)
    else:
        #10で割った余りを引く
        num = a[j] % 10
        c.append(num)
        b.append(a[j] - c[j])
 
b_sum = sum(b)
c_min = min(c)
if c_min ==10:
    c_sum = 4 * 10
else:
    c_sum = c_min + 4*10
 
print(b_sum + c_sum)