if true then
  fh=STDIN
else
  fh=open("in0106.txt")
end
def price(n, p)
  unitVol=p[0]
  unitCost=p[1]
  discNumber=p[2]
  discRate = p[3]

  return (n / discNumber)*discNumber*unitCost*discRate + (n % discNumber)*unitCost
end

parm = {"A" =>[200,380,5,0.8],"B" =>[300,550,4,0.85],"C" =>[500,850,3,0.88]}

while fh.gets do
  x =$_.chomp.to_i
  break if x==0
  pairs = []
  na= x / parm["A"][0]
  nb= x / parm["B"][0]
  nc= x / parm["C"][0]
  0.upto(nc){|ic|
    0.upto(nb){|ib|
      0.upto(na){|ia|
        y = x - (ia*parm["A"][0] + ib*parm["B"][0] + ic*parm["C"][0])
        break if y < 0
        pairs.push [ia,ib,ic] if y==0
      }
    }
  }
  v = []
  pairs.each{|na,nb,nc|
    v.push(+price(na,parm["A"]).to_i+price(nb,parm["B"]).to_i+price(nc,parm["C"]).to_i)
  }
  puts v.min
end