luogu#P5077. Tweetuzki 爱等差数列

Tweetuzki 爱等差数列

Problem Description

Tweetuzki especially likes arithmetic progressions. In particular, he likes arithmetic progressions with common difference 11 and all terms being positive integers.

Obviously, for every number ss, we can find an arithmetic progression with common difference 11 and all terms being positive integers such that the sum of its terms is ss. Now, Tweetuzki wants to know: among all such arithmetic progressions, what is the smallest possible first term.

Since Tweetuzki is very bad at math, especially at factoring, please tell him the answer.

Input Format

The input contains only one line with an integer ss (1s1012)(1 \le s \le 10^{12}).

Output Format

Output two positive integers, representing the first term and the last term of the arithmetic progression. Note that you must output the smallest possible first term.

9
2 4
16
16 16
1000000007
500000003 500000004

Hint

Sample Explanation 1

2+3+4=92 + 3 + 4 = 9

Sample Explanation 2

16=1616 = 16

Constraints

For 10%10\% of the testdata, s106s \le 10^6.
For 100%100\% of the testdata, 1s10121 \le s \le 10^{12}.

If there is a sequence aa where each term aia_i satisfies aiN+a_i \in \mathbb{N_{+}} and aiai1=ai+1ai=1a_i - a_{i - 1} = a_{i + 1} - a_i = 1, then this sequence is called an arithmetic progression with common difference 11 and all terms being positive integers.

Translated by ChatGPT 5