a = gets.chomp
b = gets.chomp
c = gets.chomp
d = gets.chomp
e = gets.chomp
 
arr = [a, b, c, d, e]
m = arr.map{|elm| elm[-1]}
m.delete_if{|elm| elm =='0'}
m = m.map(&:to_i).min
m = arr.find{|elm| elm[-1] == m.to_s}
 
idx = arr.index(m)
arr.delete_at(idx)


arr.map!(&:to_i)
m = m.to_i

sum = 0
arr.each do |x|
  begin
    x = x - 10
    sum += 10
  end until	x < 0	
end
  
puts sum + m