Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/while-yigindisi-n-dan-oshmaydigan-k

Largest k with sum at most n

Easy 1000 ms 64 MB 27%
Share

A positive integer $n$ is given. Find the largest positive integer $k$ for which the condition holds, and the sum itself:

$$1 + 2 + \dots + k \le n$$

The largest term at which the sum of consecutive numbers does not exceed the given number

Input

One integer $n$.

Output

One line with two integers separated by a space: $k$ and the sum.

Note

$1 \le n \le 10^{8}$

Examples

Input #1
10
Output #1
4 10
Input #2
12
Output #2
4 10

Sign in to submit a solution

Signing up is free and takes a minute.