Pagini recente » Cod sursa (job #2663914) | Cod sursa (job #652960) | Cod sursa (job #1317594) | Cod sursa (job #2318288) | Cod sursa (job #53097)
Cod sursa(job #53097)
program iepuri;
var p,o,l:{int64;}longint;
w:array[0..2000{0000}]of {int64;}longint;
a,b,c,x,y,z,n:longint;
procedure calcul;
var i:longint;
begin
for i:=3 to n do
begin
p:=a*w[i-1];
o:=b*w[i-2];
l:=c*w[i-3];
w[i]:=p+o+l;
end;
writeln(w[n]);
end;
procedure citire;
var i:integer;
begin
assign(input,'iepuri.in');
assign(output,'iepuri.out');
rewrite(output);
reset(input);
read(n);
for i:=1 to n do
begin
readln(x,y,z,a,b,c,n);
w[0]:=x;
w[1]:=y;
w[2]:=z;
calcul;
end;
close(output);
close(input);
end;
begin
citire;
end.