#P5695. [NOI2001] 反正切函数的应用

[NOI2001] 反正切函数的应用

Description

We rewrite formula 4 4 in the following form:

$$\arctan(\frac{1}{a}) = \arctan(\frac{1}{b}) + \arctan(\frac{1}{c})$$

where a,b,cN+ a, b, c \in \mathbb{N^+} .

Our task is: for each given aa, find the value of b+c b + c . We guarantee that for any a a there is an integer solution. If there are multiple solutions, you must output the one with the smallest b+c b + c .

Input Format

The input file contains only one positive integer a a .

Output Format

The output file contains only one integer, which is the value of b+c b + c .

1
5

Hint

1a6×1041 \le a \le 6\times 10^4

Translated by ChatGPT 5