Pagini recente » Cod sursa (job #675704) | Cod sursa (job #1500494) | Cod sursa (job #3135504) | Cod sursa (job #2579315) | Cod sursa (job #22329)
Cod sursa(job #22329)
var z,t,aux,n,p:int64;
x:array[1..3]of int64;
a:array[1..3] of int64;
v:array[1..100]of int64;
j,i: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] mod 666013 );
close(input);close(output);
end.