res = []
res0 = []
count = 0
5.times do
  p = gets.to_i
  if p%10 == 0
    res0 << p
  else
    res << p
  end
end
nres = res.sort {|a, b| (-1) * (a%10 <=> b%10) }
res0.push(nres)
res0.flatten!

for i in 0..4 do
  count += res0[i]
  if res0[i]%10 != 0 and i != 4
    count += (10 - res0[i]%10)
  end
end
#count += res0[4]
puts count