The first line contains the number of data sets P (1≤P≤1000). The data sets are independent and are all processed the same way.
Each data set is one line holding three integers separated by spaces: the data set number K (1≤K≤1000), the base of the powers m (3≤m≤100), and the integer n (3≤n≤10000) whose m-ary partitions are to be counted. The data set numbers come from the input and are not guaranteed to be sorted.
The number of m-ary partitions of n always fits in a 32-bit unsigned integer.