var c,b:array [1..1000] of integer;
i,n,k:integer;
begin
k:=1;
readln(n);
for i:=1 to n do
c[i]:=random(15);
write (c[i]:3);
if c[i] mod 7 = 0 then
b[k]:=c[i];
k:=k+1
end
end;
writeln;
for i:=1 to k-1 do write (b[i]:3);
writeln (k-1)
end.
var c,b:array [1..1000] of integer;
i,n,k:integer;
begin
k:=1;
readln(n);
for i:=1 to n do
begin
c[i]:=random(15);
write (c[i]:3);
if c[i] mod 7 = 0 then
begin
b[k]:=c[i];
k:=k+1
end
end;
writeln;
for i:=1 to k-1 do write (b[i]:3);
writeln;
writeln (k-1)
end.