read A B K ruby -e"p (1..).bsearch{|x|x/$A+x/$B-x/$A.lcm($B)>=$K}"