@a,@b,@c = gets.split.map(&:to_i) def yuki(year) year + year/@a*(@b-1) end p (1..(1e18).to_i).bsearch{|x| @c <= yuki(x) }