Last eight digits of a power tower
Time limit1sMemory limit256 MB
Given a and b, print the last eight digits of the b-level power tower of a, keeping leading zeros for large values.
- Level
Hard8 of 10
- Topics
- Number theory, Math, Recursion
- Solved
- No attempts yet
Problem
For positive integers and , write the -th power tower of as . It is defined by
For example, and .
Find the last 8 digits of .
Input
The first line contains two positive integers and , separated by a space. ()
Output
Print the last 8 digits of on one line.
If has 9 or more digits, print those last 8 digits exactly, including any zeros at the front of them. If has 8 or fewer digits, print the whole value without adding leading zeros.