Problem5Problem code: AX05 |
Pranay went to the sea shore and saw what looked like a treasure chest floating. Examining the locking mechanism, he immediately realized he came across a set of puzzles in FreakoMatix-Axis'10 to reward those who are skilled in the mathematical arts and punish those who are not.
There were six dials of the digits 0 through 9 in the puzzle accompanied by a message : "You will be given two positive integers lesser than or equal to a billion. You need to tell the final 6 digits of raising the first to the power of the second".
Pranay was overstruck with grief. With such huge numbers, the multiplications could take ages, but he had no more than a few seconds to give the right answer.
Input
Input will consist of multiple lines, each containing two integers A and B (1 <= A, B <= 1000000000), separated by a space. A line containing two zeros signals the end of input and should not be processed.
Output
For each line of input, print out the correct dial settings, i.e. the final six digits of A^B.
Example
Input: 421 1988 628 496 0 0 Output: 362161 493696
| Author: | xpurgate |
| Date Added: | 3-09-2010 |
| Time Limit: | 6 sec |
| Source Limit: | 50000 Bytes |
| Languages: | C, CPP 4.0.0-8, CPP 4.3.2, JAVA |
Comments

Fetching successful submissions
