Pagini recente » Cod sursa (job #1867064) | Cod sursa (job #1791535) | Cod sursa (job #2355334) | Cod sursa (job #337433) | Cod sursa (job #541260)
Cod sursa(job #541260)
const modulo=666013;
var t,i:byte;
x,y,z,
a,b,c:integer;
n:longint;
f1,f2:text;
function iep(p:longint):longint;
begin
if p=0 then iep:=x else
if p=1 then iep:=y else
if p=2 then iep:=z else
iep:=(a*iep(p-1)+b*iep(p-2)+c*iep(p-3))mod modulo;
end;
begin
assign(f1,'iepuri.in');
reset(f1);
assign(f2,'iepuri.out');
rewrite(f2);
readln(f1,t);
for i:=1 to t do
begin
readln(f1,x,y,z,a,b,c,n);
writeln(f2,iep(n));
end;
close(f1);
close(f2);
end.