program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var f:textfile;n,i,z:integer;line,s:string;
m:array[0..15] of string;
x:array[1..2] of integer;
begin
n:=-1;
z:=0;
m[0]:='{}';
m[1]:='{{}}';
m[2]:='{'+ m[0]+','+ m[1]+'}';
for i:=3 to 15 do begin
s:=m[i-1];
delete(s,1,1);
delete(s,length(s),1);
m[i]:='{'+ s+','+ m[i-1]+'}';
end;

AssignFile(f,'input.txt');
reset(f);
while not eof(f) do
begin
 Readln(f,line);
 for i:=0 to 15 do
 begin
  if line=m[i] then begin n:=i; break; end;
 end;
 if n<>-1 then begin
 inc(z);
 x[z]:=n;
 end;
end;
CloseFile(f);
z:=x[1]+x[2];
s:=m[z];

{writeln(s);
writeln(inttostr(z));
Readln; }

AssignFile(f,'output.txt');
Rewrite(f);
Writeln(f,s);
CloseFile(f);
end.
 