#include<bits/stdc++.h>
#define mes(a, b) memset(a, b, sizeof a)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e5+10;
struct Mat{
ll mat[5][5];
Mat(){
mes(mat, 0);
}
void init(){
for(int i = 1; i <= 3; i++)
mat[i][i] = 1;
}
Mat operator * (Mat const &p)const{
Mat ans;
for(int i = 1; i <= 3; i++){
for(int j = 1; j <= 3; j++){
for(int k = 1; k <= 3; k++){
ans.mat[i][j] += mat[i][k] * p.mat[k][j] % mod;
ans.mat[i][j] %= mod;
}
}
}
return ans;
}
void print(){
for(int i = 1; i <= 3; i++){
for(int j = 1; j <= 3; j++){
printf("%lld ", mat[i][j]);
}
printf("\n");
}
}
};
Mat q_pow(Mat a, ll b){
Mat ans; ans.init();
while(b){
if(b & 1) ans = ans * a;
a = a*a;
b /= 2;
}
return ans;
}
int main(){
Mat now, a;
ll xa, xb, xc, ya, yb, yc, x, y, z, n;
scanf("%lld%lld%lld%lld", &x, &y, &z, &n);
scanf("%lld%lld%lld%lld%lld%lld", &xa, &ya, &xb, &yb, &xc, &yc);
now.mat[1][1] = now.mat[2][2] = now.mat[3][3] = 1;
now.mat[1][2] = xb; now.mat[1][3] = xc;
now.mat[2][1] = xa; now.mat[2][3] = yc;
now.mat[3][1] = ya; now.mat[3][2] = yb;
a.mat[1][1] = x; a.mat[2][1] = y; a.mat[3][1] = z;
a = q_pow(now, n) * a;
printf("%lld %lld %lld\n", a.mat[1][1], a.mat[2][1], a.mat[3][1]);
}
吉比特2020.8.27 编程2
最新推荐文章于 2024-07-21 16:26:31 发布