Pagini recente » Cod sursa (job #3155950) | Cod sursa (job #1042113) | Cod sursa (job #2128113) | Cod sursa (job #1227512) | Cod sursa (job #2512632)
#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++){
int x, y, z, a, b, c, n;
fin >> x >> y >> z >> a >> b >> c >> n;
for(int j = 1; j <= n - 2; j++){
int new_z = z * a + y * b + x * c;
int new_y = z;
int new_x = y;
x = new_x;
y = new_y;
z = new_z;
}
fout << z % 666013 << "\n";
}
return 0;
}