Pagini recente » Cod sursa (job #2420643) | Cod sursa (job #2127074) | Cod sursa (job #1763499) | Cod sursa (job #2663529) | Cod sursa (job #21735)
Cod sursa(job #21735)
var f,g:text;
s,q,i,j,x,y,z,a,b,c,n:longint;
begin
assign(g,'iepuri.out');
rewrite(g);
assign(f,'iepuri.in');
reset(f);
readln(f,q);
{for i:=1 to q do
begin }
while not eof(f) do
begin
s:=0;
read(f,x,y,z,a,b,c,n);
for j:=3 to n do
begin
s:=x*a+y*b+c*z;
c:=b;
b:=a;
a:=s;
end;
writeln(g,s mod 666013);
readln(f);
end;
close(f);
close(g);
end.