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.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.