이 문제는 날로 먹는 문제이다. 아주 쉬우니, 5분만에 풀고 다음 문제로 넘어가자.
Input
펏 줄에 테스트케이스의 수 n이 주어진다. 그리고 다음 n줄에 a, b가 주어진다. $a^b$ mod b를 구하자.
Output
각 줄에 $a^b$ mod b를 출력한다.
Constraints
($1 ≤ n ≤ 50$), ($1 ≤ a, b ≤ 10^9$ (단, b는 소수))
Example 1
Input
1 1 7
Output
1
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.