#include<iostream>
using namespace std;
#define LL long long
const int mod = 1000000007;
LL data[10005];
LL binary_power(int t,LL k){
if(t == 0) return 1;
if(t == 1) return k;
LL r = binary_power(t>>1,k);
if(t & 1) r = ((r * r) % mod * k) % mod;
else r = (r * r) % mod;
return r;
}
int main(){
int T,n,t,k;
cin>>T;
while(T--){
cin>>n>>t>>k;
for(int i = 0;i != n;++i)
cin>>data[i];
LL p = binary_power(t,k);
for(int i = 0;i != n;++i){
cout<<data[((i-t)%n+n)%n]*p%mod;
if(i != n-1) cout<<" ";
else cout<<endl;
}
}
return 0;
}
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4506
二分幂~~