luogu#P16421. [IATI 2022] Divide

[IATI 2022] Divide

Problem Description

Who doesn’t love math 😊

Let p,qp, q and nn be natural numbers. We will say that a pair of natural numbers (a,b)(a,b) is interesting when:

  1. 1ap1 \le a \le p
  2. 1bq1 \le b \le q
  3. c=a×ba+bc = \frac{a\times b}{a+b} is a natural number, and 1cn1 \le c \le n, that is the product a×ba \times b is divisible without remainder by the sum a+ba + b, and their quotient is less than or equal to nn.

The goal of this task is simple - find the number of interesting pairs!

Write a program divide.cpp, that given the three numbers p,qp, q and nn, computes the number of interesting pairs.

Input Format

The only line of the standard input contains the numbers p,qp, q and nn.

Output Format

On the single line of the standard output, print the number of interesting pairs. It is guaranteed that the answer less than 101810^{18}.

13 17 5
11

Hint

Constraints

1p,q,n1010 1 \le p,q,n \le 10^{10}

Subtasks

No. Additional constraints Points
1 1p,q,n2×1041 \le p, q, n \le 2 \times 10^4 5
2 1p,q,n2.5×1071 \le p, q, n \le 2.5 \times 10^7 10
3 1p,q,n2.5×1081 \le p, q, n \le 2.5 \times 10^8
4 1p,q,n2×1091 \le p, q, n \le 2 \times 10^9
5 n=1010,p=qn = 10^{10}, p = q
6 n=1010n = 10^{10}
7 45