Given three positive integers A, B and C. A positive integer is magical if it is divisible by either B or C.
Return the A-th magical number. Since the answer may be very large, return it modulo 109 + 7.
The first argument given is an integer A. The second argument given is an integer B. The third argument given is an integer C.
Return the A-th magical number modulo (10^9+7).
1 <= A <= 10^9 2 <= B, C <= 40000
Input 1: A = 1 B = 2 C = 3 Output 1: 2 Explanation 1: 1st magical number is 2. Input 2: A = 4 B = 2 C = 3 Output 2: 6
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.