eolymp
bolt
Try our new interface for solving problems
Problems

n-th integer divisible by a or b

n-th integer divisible by a or b

Given two integers $a$ and $b$. Find the $n$-th positive integer that is divisible by either $a$ or $b$. \InputFile Three integers $a, b$ and $n~(a, b, n \le 10^9)$. \OutputFile Print the $n$-th positive integer divisible by either $a$ or $b$. It is known that the answer is no more than $10^9$. \includegraphics{https://static.e-olymp.com/content/fa/fa6aa2305e18f0213088469b7cad98c47be7a95c.gif}
Time limit 1 second
Memory limit 128 MiB
Input example #1
2 5 10
Output example #1
16
Input example #2
3 7 25
Output example #2
57
Author Mykhailo Medvediev