## POWERUP - Power the Power Up

no tags

Your younger brother's teacher gave him this simple problem.

Given b and c. Evaluate the result of this expression:

Result1 = bc

Your brother definitely was able to solve this easy problem. So his teacher decided to give him a bit harder problem.

Given a,b and c. Evaluate the result of this expression:

Result1 = bc

Result2 = aResult1

However, your brother was also able to solve it. It was not that harder. His teacher was excited -though- and gave him this Bonus Programming Assignment.

Write a program that is given a,b and c; calculates the value of Result2. Since the output may be exponentially very large, checking the correctness of solutions will be a bit subtle problem. So, instead of printing the whole value of Result2, just print the reaminder of dividing Result2 by 1,000,000,007 (109 + 7).

Can you help him solve that task?

### Input

The input consists of several test cases. Each case is on a single line. In each case, given three space separated integers a,b and c (0 <=a, b, c <= 231 - 1). The input is terminated by a = b = c =  - 1

### Output

For each case, print exactly one line containing the value of Result2 modulus 109 + 7

Sample test(s)
`Input`
```2 2 23 4 5-1 -1 -1
```
`Output`
```16763327764

```

### Note

You can assume that 00 = 1.

 < Previous 1 2 3 Next > himanshujaju: 2014-11-07 07:25:23 We just need to calculate a^(b^c). Getting WA with the basic approach! Help? Edit : Got AC. A few corner cases :P Last edit: 2014-11-07 11:54:31 Min_25: 2014-11-07 06:57:08 This problem has some tricky test cases, which do not appear in POWTOW and MTETRA. Last edit: 2014-11-07 07:04:31 Francky: 2014-11-06 22:12:24 @psetter : please check the IO files. Moreover this problem might belong to tutorial. For a classical problem, please take a look at MTETRA. --edit(Francky)--> OK, my fault. I found the tricky cases. Last edit: 2014-11-07 08:52:42