P16421 [IATI 2022] Divide

Description

Who doesn’t love math 😊 Let $p, q$ and $n$ be natural numbers. We will say that a pair of natural numbers $(a,b)$ is **interesting** when: 1. $1 \le a \le p$ 2. $1 \le b \le q$ 3. $c = \frac{a\times b}{a+b}$ is a natural number, and $1 \le c \le n$, that is the product $a \times b$ is divisible without remainder by the sum $a + b$, and their quotient is less than or equal to $n$. The goal of this task is simple - find the number of interesting pairs! Write a program divide.cpp, that given the three numbers $p, q$ and $n$, computes the number of interesting pairs.

Input Format

The only line of the standard input contains the numbers $p, q$ and $n$.

Output Format

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

Explanation/Hint

### Constraints $ 1 \le p,q,n \le 10^{10} $ ### Subtasks | No. | Additional constraints | Points | |:-:|:-:|:-:| | 1 | $1 \le p, q, n \le 2 \times 10^4$ | 5 | | 2 | $1 \le p, q, n \le 2.5 \times 10^7$ | 10 | | 3 | $1 \le p, q, n \le 2.5 \times 10^8$ | 10 | | 4 | $1 \le p, q, n \le 2 \times 10^9$ | 10 | | 5 | $n = 10^{10}, p = q$ | 10 | | 6 | $n = 10^{10}$ | 10 | | 7 | – | 45 |