#ABC246D. [ABC246D] 2-variable Function

[ABC246D] 2-variable Function

Score : 400400 points

Problem Statement

Given an integer NN, find the smallest integer XX that satisfies all of the conditions below.

  • XX is greater than or equal to NN.
  • There is a pair of non-negative integers (a,b)(a, b) such that X=a3+a2b+ab2+b3X=a^3+a^2b+ab^2+b^3.

Constraints

  • NN is an integer.
  • 0N10180 \le N \le 10^{18}

Input

Input is given from Standard Input in the following format:

NN

Output

Print the answer as an integer.

9
15

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

0
0

NN itself may satisfy the condition.

999999999989449206
1000000000000000000

Input and output may not fit into a 3232-bit integer type.