Problem9604--ABC246 —— D - 2-variable Function

9604: ABC246 —— D - 2-variable Function

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

Given an integer $N$, find the smallest integer $X$ that satisfies all of the conditions below.

-   $X$ is greater than or equal to $N$.
-   There is a pair of non-negative integers $(a, b)$ such that $X=a^3+a^2b+ab^2+b^3$.

Input

Input is given from Standard Input in the following format:

```
$N$
```

Output

Print the answer as an integer.

Constraints

-   $N$ is an integer.
-   $0 \le N \le 10^{18}$

Sample 1 Input

9

Sample 1 Output

15
For any integer X such that 9≤X≤14, there is no (a,b) that satisfies the condition in the statement.
For X=15, (a,b)=(2,1) satisfies the condition.

Sample 2 Input

0

Sample 2 Output

0
N itself may satisfy the condition.

Sample 3 Input

999999999989449206

Sample 3 Output

1000000000000000000

Source/Category