
def calc_taxed_price(original_price, tax_rate)
  (original_price * (100.0+tax_rate)/100.0).to_i
end

readlines.each{|s|
  prev_tax_rate,new_tax_rate,prev_taxed_sum = s.chomp.split.map &:to_i
  if prev_tax_rate == 0 then break end



results = []

(1...prev_taxed_sum).each{|price_iter1|
  (1...prev_taxed_sum).each{|price_iter2|
    prev_taxed_price1 = calc_taxed_price price_iter1,prev_tax_rate
    prev_taxed_price2 = calc_taxed_price price_iter2,prev_tax_rate

    if prev_taxed_price1 + prev_taxed_price2 == prev_taxed_sum
      results.push [price_iter1, price_iter2]
    end
  }
}

# p results

price1,price2 = results.max_by{|price_iter1, price_iter2|
    prev_taxed_price1 = calc_taxed_price price_iter1,prev_tax_rate
    prev_taxed_price2 = calc_taxed_price price_iter2,prev_tax_rate
    new_taxed_price1 = calc_taxed_price price_iter1,new_tax_rate
    new_taxed_price2 = calc_taxed_price price_iter2,new_tax_rate
    new_taxed_sum = new_taxed_price1 + new_taxed_price2
    new_taxed_sum
}

new_taxed_price1 = calc_taxed_price price1,new_tax_rate
new_taxed_price2 = calc_taxed_price price2,new_tax_rate
p new_taxed_price1 + new_taxed_price2

}

