a=(h=Hash[15,2244,12,1870,10,1520,5,850,3,550,2,380]).dup

25.times{
  a.dup.each{|k,v|
    a.update(h.map{|k2,v2|[k+k2,v+v2]}){|k,s,o|
        [s,o].min
    }
  }
}

puts ARGF[0,-2].map{|l|a[l.to_i/100]}