Pagini recente » Cod sursa (job #2306529) | Cod sursa (job #450940) | Cod sursa (job #2979198) | Cod sursa (job #1486038) | Cod sursa (job #22328)
Cod sursa(job #22328)
var z,t,i,j,aux,n,p:longint;
x:array[1..3]of longint;
a:array[1..3] of longint;
v:array[1..100]of longint;
begin
assign(input,'iepuri.in');reset(input);
assign(output,'iepuri.out');rewrite(output);
readln (t);
for i:=1 to t do begin
read(x[1],x[2],x[3],a[1],a[2],a[3],n);
for j:=1 to n-2 do begin
aux:=x[1]*a[3]+x[2]*a[2]+x[3]*a[1];
x[1]:=x[2];
x[2]:=x[3];
x[3]:=aux;
end;
v[i]:=aux mod 666013;
end;
for i:=1 to t do writeln(v[i] );
close(input);close(output);
end.