Contemplation! Algebra

Given the value of a+b and ab you will have to find the value of an + bn Input The input file contains several lines of inputs. Each line except the last line contains 3 non-negative integers p, q and n. Here p denotes the value of a + b and q denotes the value of ab. Input is terminated by a line containing only two zeroes. This line should not be processed. Each number in the input file fits in a signed 32-bit integer. There will be no such input so that you have to find the value of 00. Output For each line of input except the last one produce one line of output. This line contains the value of an + bn. You can always assume that an + bn fits in a signed 64-bit integer. Sample Input 10 16 2 7 12 3 00 Sample Output 68 91