uses crt;
var a:array[1..128] of integer;
F:array[1..100,1..100] of integer;
n,max,u,v:integer;
procedure input;
var f:text;
i,j:integer;
begin
assign(f,'Bai1.inp');
reset(f);
readln(f,n);
for i:=1 to n do
read(f,a[i]);
close(f);
end;
function dem(i,t:integer):integer;
var j,k,d:integer;
begin
d:=0;
j:=i-1;
repeat
k:=0;
if (k>t) and ((k-a[j])<t) then k:=a[j];
if k=t then inc(d);
if k<t then
repeat
inc(j);
k:=k+a[j];
if k=t then
begin
inc(d);
break;
end;
until (k>=t) or (j>=n);
until j>=n;
dem:=d;
end;
procedure xuli;
var i,j,t,t2,k,h:integer;
begin
fillchar(F,sizeof(F),0);
for i:=1 to n do
for j:=1 to n-i+1 do
begin
t:=0;
h:=i-1;
k:=0;
repeat
inc(h);
inc(k);
t:=t+a[h];
until k=j;
F[i,j]:=dem(i,t);
end;
end;
procedure truyvet;
var i,j,t,k,d,l:integer;
f1:text;
begin
assign(f1,'Bai1.out');
rewrite(f1);
max:=F[1,1];
u:=1; v:=1;
for i:=1 to n do
begin
for j:=1 to n do
if F[i,j]>=max then
begin
max:=F[i,j];
u:=i;
v:=j;
end;
end;
t:=0;
i:=u-1;
d:=0;
repeat
inc(i);
inc(d);
t:=t+a[i];
until d=v;
writeln(f1,max,' ',t);
i:=u-1;
repeat
j:=i;
inc(i);
k:=0;
repeat
inc(j);
k:=k+a[j];
until (k>=t) or (j>=n);
if k=t then
begin
for l:=i to j do
write(f1,a[l],' ');
writeln(f1);
end;
i:=j;
until j>=n;
close(f1);
end;
begin
input;
xuli;
truyvet;
end.