w_min = 5
w_max = 50
shop_infos = [[2, 380, 5, 0.8], [3, 550, 4, 0.85], [5, 850, 3, 0.88]].map {|i|
  {weight: i[0], cost: i[1], bundle_num: i[2], bundle_cost: (i[1] * i[2] * i[3]).to_i}
}

min_costs = Array.new(w_max + 1, 2<<32)
a_range, b_range, c_range = *shop_infos.map {|i| (0..(w_max / i[:weight] + 1)) }
a_range.each {|a|
  b_range.each {|b|
    c_range.each {|c|
      weight = shop_infos.zip([a, b, c]).map {|(i, n)| i[:weight] * n }.reduce(:+)
      break if weight > w_max
      next if weight < w_min
      cost = shop_infos.zip([a, b, c]).map {|(i, n)| (n / i[:bundle_num]) * i[:bundle_cost] + (n % i[:bundle_num]) * i[:cost] }.reduce(:+)
      min_costs[weight] = [min_costs[weight], cost].min
    }
  }
}

until (weight = gets.to_i / 100) == 0
  puts min_costs[weight]
end