I tried to solve this problem in code forces, but I couldn’t. I know that we cannot store that much number in long long int. Can anyone help how can we compute such a big power, or is there any method we can use it solve these types of problems?

link to question: Problem - 99999112 - Codeforces