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

~/algor $ cat problems/qidiruv-kub-tenglama

Solving a cubic equation

Easy 1000 ms 128 MB 30%
Share

A positive integer $c$ is given. Find a positive integer $x$ satisfying $x^{3} + x = c$. If there is no such number, print $-1$.

The axis of positive integers: the sum of x cubed and x grows, the point that hits the given c is highlighted

Input

One positive integer $c$.

Output

One integer — $x$ or $-1$.

Note

$1 \le c \le 10^{18}$

Examples

Input #1
30
Output #1
3
Input #2
20
Output #2
-1

Sign in to submit a solution

Signing up is free and takes a minute.