use bigint; ($a,$b,$c)=map{0+$_}glob<>; $d=$c/($a-1+$b); $r=$c%($a-1+$b); print$d*$a+$r;