Given three integers n, a, and b, return the n-th positive integer that is divisible by either a or b. Return the answer modulo 1e9+7.
n, a, b = integers
n-th magical number modulo 1e9+7
Example 1:
Input:
n = 1 a = 2 b = 3
Output:
2
Explanation:
The first magical number divisible by 2 or 3 is 2.
Example 2:
Input:
n = 4 a = 2 b = 3
Output:
6
Explanation:
The magical numbers are 2, 3, 4, 6; the 4th is 6.