uses crt;
var a:array[1..10000] of word;
n,i,j,k:integer;
t:longint;
f1,f2: text;
begin
clrscr;
assign(f1,'tichmax.inp');
rewrite(f1);
write('Nhap N (3 <= N <= 10000) = '); readln(n);
writeln(f1,n);
writeln('Nhap ',n,' phan tu gia tri tuyet doi khong qua 3000');
for i:= 1 to n do
begin
repeat
write('So thu ',i,' = '); readln(a[i]);
until abs(a[i])<=30000;
write(f1,a[i]); if i<n then write(f1,' ');
end;
close(f1);
assign(f2,'tichmax.out');
rewrite(f2);
t:= a[1]*a[2]*a[3];
for i:= 1 to n-2 do
for j:= i+1 to n-1 do
for k:=j+1 to n do
if a[i]*a[j]*a[k]>t then t:= a[i]*a[j]*a[k];
write(f2,t);
close(f2);
readln
end.