TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Suppose the 3 ( Complex ) roots of the equation x3 + ax + b = 0, are x1, x2, and x3. Calculate the value of x1n + x2n + x3n.

Input Format

There are multiple test cases.
Each test case consists of a single line containing the three intergers - a, b and n, listed in this order.
Input is terminated by EOF (End of File).


1 <= |a|, |b|, n <= 100

Output Format

For each test case, output one line - the answer accurate up to integer.

Sample Input 1

-1 1 16
1 9 17

Sample Output 1

90
942021

Hints

Problem Source

Migrated from old NTUJ.

CodeCraft 2010

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 200