You are given the number N. You have to find the total number of positive integer pairs (A, B) such that the following conditions are satisfied:
A, B <= N
AB <= X
A+B is divisible by D
Since the total number of pairs can be large, return the answer modulo 109+7.
NOTE: X, D was not given in the problem statement; it was just given in the conditions.
Input Format
N X D
Constraints:
1 <= N <= 109
1 <= X <= 109
1 <= D <= 104
Sample Input
4 3 2
Sample Output
3
Explanation: There are 3 pairs out of 16 {(1,1),(1,3),(3,1)} which satisfy the condition.
Instruction: To run your custom test cases strictly map your input and output layout with the visible test cases.
Sample Test Cases
Test case 1
4 3 2
3
i want code
Sample Test Cases
Test case 1
4 3 2
3
SHRUTI PANDURANG NAIK MCA Lake is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2