Pagini recente » Cod sursa (job #1427058) | Cod sursa (job #1296742) | Cod sursa (job #2091272) | Cod sursa (job #2268614) | Cod sursa (job #2228645)
#include <iostream>
#include <fstream>
using namespace std;
const int mod = 666013;
int main()
{
ifstream fin("iepuri.in");
ofstream fout("iepuri.out");
int x, y, z, a, b, c, n, t;
fin >> t;
for(int test = 1; test <= t; ++test){
fin >> x >> y >> z >> a >> b >> c >> n;
int day = 3, qty = 0;
while(day <= n){
qty = (1LL * x * c) % mod + (1LL * y * b) % mod + (1LL * z * a) % mod;
day++;
x = y;
y = z;
z = qty;
}
fout << qty << "\n";
}
return 0;
}