Pagini recente » Cod sursa (job #3270463) | Cod sursa (job #423281) | Cod sursa (job #581486) | Cod sursa (job #1375604) | Cod sursa (job #2512619)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("iepuri.in");
ofstream fout("iepuri.out");
int main()
{
int t;
fin >> t;
for(int i = 1; i <= t; i++){
long long x, y, z, a, b, c, n;
fin >> x >> y >> z >> a >> b >> c >> n;
for(int j = 1; j <= n - 2; j++){
long long p = z * a + y * b + x * c;
long long aux;
aux = z;
z = p;
p = aux;
aux = y;
y = p;
p = aux;
aux = x;
x = p;
p = aux;
}
fout << z % 666013 << "\n";
}
return 0;
}