Pagini recente » Cod sursa (job #2333852) | Cod sursa (job #158271) | Cod sursa (job #1669545) | Cod sursa (job #1940271) | Cod sursa (job #2549761)
#include <fstream>
#define mod 666013
using namespace std;
ifstream f ("iepuri.in");
ofstream g ("iepuri.out");
int t, a, b, c, n, nr, i;
long long x, y, z, aux;
int main()
{
f >> t;
for (i=1; i<=t; i++)
{
f >> x >> y >> z >> a >> b >> c >> n;
nr = 3;
while (nr <= n)
{
nr ++;
aux = ((z * a ) % mod + (y * b) % mod + (x * c) % mod) % mod;
x = y;
y = z;
z = aux;
}
g << z << '\n';
}
return 0;
}