This page is still under construction.

Parts of this page are still being built. What you see may change.

Vampire Count Kim Sang-geun

Time limit2sMemory limit128 MB

Summary
For each n under 10000, find natural a, b, c with a >= c, a^3 + c^3 = n*b^3, minimizing a + b + c + b, or print No value if the minimum exceeds 4000.
Level

Medium7 of 10

Topics
Number theory, Math, Brute force
Solved
No attempts yet

Problem

To fend off the attacks of the vampire Count Kim Sang-geun, you must memorize an equation of the following form.

(ab)3+(cb)3=n\left(\frac{a}{b}\right)^3 + \left(\frac{c}{b}\right)^3 = n

Here aa, bb, cc, and nn are all natural numbers. For example, when n=9n = 9 the following equation holds.

(415280564497/348671682660)^3 + (676702467503/348671682660)^3 = 9

But an equation this long cannot be memorized before the Count strikes and turns you into a vampire. Fortunately, for the same n=9n = 9 there is a far shorter equation.

(2/1)^3 + (1/1)^3 = 9

Given a natural number nn, write a program that finds the equation that is easiest to memorize. The easiest-to-memorize equation is the one that minimizes a+b+c+ba + b + c + b, subject to ab≥cb\frac{a}{b} \ge \frac{c}{b} (that is, a≥ca \ge c). The equation satisfying these conditions is always unique. If no equation has a+b+c+ba + b + c + b smaller than 40004000, print No value..

Input

The input consists of several test cases. Each line contains one natural number nn smaller than 1000010000. The last line contains a single 00, which is not processed.

Output

For each test case, print the easiest-to-memorize equation on its own line. Print exactly one space before and after each + and = sign. If no valid equation exists, print No value..

Examples5

  1. Example 1

    Input
    1
    9
    7
    6000
    0
    
    Expected output
    No value.
    (2/1)^3 + (1/1)^3 = 9
    (5/3)^3 + (4/3)^3 = 7
    (370/21)^3 + (170/21)^3 = 6000
    
  2. Example 2

    Input
    2
    0
    
    Expected output
    (1/1)^3 + (1/1)^3 = 2
    
  3. Example 3

    Input
    16
    0
    
    Expected output
    (2/1)^3 + (2/1)^3 = 16
    
  4. Example 4

    Input
    6
    13
    0
    
    Expected output
    (37/21)^3 + (17/21)^3 = 6
    (7/3)^3 + (2/3)^3 = 13
    
  5. Example 5

    Input
    19
    20
    12
    0
    
    Expected output
    (5/2)^3 + (3/2)^3 = 19
    (19/7)^3 + (1/7)^3 = 20
    (89/39)^3 + (19/39)^3 = 12