#K34832. Product of Digits of a Power
Product of Digits of a Power
Product of Digits of a Power
You are given two positive integers n and m. Your task is to compute nm and then calculate the product of the digits of nm.
Mathematically, if \(A = n^m\) and \(A\) has decimal representation \(d_1d_2\ldots d_k\), then you should compute:
\(\prod_{i=1}^{k} d_i\)
For example, if \(n=2\) and \(m=5\), then \(2^5=32\) and the product of its digits is \(3 \times 2 = 6\>.
You will be given multiple test cases. For each test case, output the product on a new line.
inputFormat
The first line of input contains a single integer T (\(1 \leq T \leq 100\)) representing the number of test cases.
Each of the following T lines contains two space-separated integers n and m (\(1 \leq n \leq 50\), \(1 \leq m \leq 500\)).
outputFormat
For each test case, print a single line containing the product of the digits of \(n^m\).
## sample3
2 5
6 3
3 7
6
12
112
</p>