#include using namespace std; #define rep(i,x,y) for(int i=x;i>Q; long N,K; rep(i,0,Q){ cin>>N>>K; if(K==1){ cout<temp){ temp*=K; j++; }cout<