Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

dp

graphs

math

number theory

*2200

No tag edit access

The problem statement has recently been changed. View the changes.

×
E. Node Pairs

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputLet's call an ordered pair of nodes $$$(u, v)$$$ in a directed graph unidirectional if $$$u \neq v$$$, there exists a path from $$$u$$$ to $$$v$$$, and there are no paths from $$$v$$$ to $$$u$$$.

A directed graph is called $$$p$$$-reachable if it contains exactly $$$p$$$ ordered pairs of nodes $$$(u, v)$$$ such that $$$u < v$$$ and $$$u$$$ and $$$v$$$ are reachable from each other. Find the minimum number of nodes required to create a $$$p$$$-reachable directed graph.

Also, among all such $$$p$$$-reachable directed graphs with the minimum number of nodes, let $$$G$$$ denote a graph which maximizes the number of unidirectional pairs of nodes. Find this number.

Input

The first and only line contains a single integer $$$p$$$ ($$$0 \le p \le 2 \cdot 10^5$$$) — the number of ordered pairs of nodes.

Output

Print a single line containing two integers — the minimum number of nodes required to create a $$$p$$$-reachable directed graph, and the maximum number of unidirectional pairs of nodes among all such $$$p$$$-reachable directed graphs with the minimum number of nodes.

Examples

Input

3

Output

3 0

Input

4

Output

5 6

Input

0

Output

0 0

Note

In the first test case, the minimum number of nodes required to create a $$$3$$$-reachable directed graph is $$$3$$$. Among all $$$3$$$-reachable directed graphs with $$$3$$$ nodes, the following graph $$$G$$$ is one of the graphs with the maximum number of unidirectional pairs of nodes, which is $$$0$$$.

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Nov/10/2024 20:42:38 (g1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|