St. Ives

Time limit1sMemory limit128 MB

Problem

Robert the chapman (a medieval traveling merchant) made regular trips between his home village and St. Ives to peddle his cloth, ribbons, and needles. On one such trip he encountered a curious procession:

As I was traveling to St. Ives
I met a man with seven wives.
Every wife had seven sacks.
Every sack had seven cats.
Every cat had seven kits.
Kits, cats, sacks, wives -
How many were traveling to St. Ives?

The answer to this classic old riddle is one: only Robert was traveling to St. Ives, while everyone else was heading the other way. But if instead we ask how many were traveling with the man, we add up:

  • 1 man
  • 7 wives
  • $7 \times 7 = 49$ sacks
  • $7 \times 7 \times 7 = 343$ cats
  • $7 \times 7 \times 7 \times 7 = 2401$ kittens

for a total of 2801.

On his next trip Robert met the same man again, this time with 3 wives, each carrying 3 sacks, and so on. Growing curious about this strange ritual, Robert kept track over the following year of how many traveled with the man on each encounter. For a given average value $n$ -- the number of wives per man, sacks per wife, cats per sack, and kittens per cat -- the size of the procession is

$$1 + n + n^2 + n^3 + n^4.$$

Input

Input consists of several data sets. Each data set is a single line containing one floating-point number $n$: the common average count for one encounter (wives per man, sacks per wife, cats per sack, and kittens per cat).

A line containing the value $0$ marks the end of the input and is not processed.

Output

For each data set, print the size of the procession, $1 + n + n^2 + n^3 + n^4$, as a real number rounded to exactly two decimal places, one per line.