Find the number of leaf nodes in a full k-ary tree of height m.
First line contains an integer T, number of test cases. Each line of the test case contains two integer k and m.
Print the number of leafs under modulo 10^9+7.
A full Binary tree of height 2 has 4 leaf nodes.