Pagini recente » Cod sursa (job #2037763) | Cod sursa (job #1290713) | Cod sursa (job #1455029) | Cod sursa (job #1585396) | Cod sursa (job #3157842)
#include <fstream>
using namespace std;
ifstream fin ("iepuri.in");
ofstream fout("iepuri.out");
long long x, y, z, a, b, c, n, t, s;
int main()
{
fin >> t;
for (int i = 1 ; i <= t ; ++i)
{
fin >> x >> y >> z >> a >> b >> c >> n;
for (long long j = 3 ; j <= n ; ++j)
{
s = a * z + b * y + c * x;
x = y;
y = z;
z = s;
}
fout << s % 666013 << "\n";
}
return 0;
}