Pagini recente » Cod sursa (job #993481) | Cod sursa (job #2399710) | Cod sursa (job #1935551) | Cod sursa (job #3290067) | Cod sursa (job #21694)
Cod sursa(job #21694)
var f,g:text;
x,y,z,a,b,c,nou:integer;
t,i:byte;
n,j:longint;
begin
assign(f,'iepuri.in'); reset(f);
assign(g,'iepuri.out'); rewrite(g);
read(f,t);
readln(f);
for i:=1 to t do begin
read(f,x,y,z,a,b,c,n);
readln(f);
j:=2;
while j<n do begin
nou:=z;
z:=z*a+y*b+x*c;
x:=y;
y:=nou;
j:=j+1;
end;
write(g,z);
writeln(g);;
end;
close(g);
end.