
procedure Extract(out v: Integer; var s: String);
var
  i: Integer;
begin
  v := 0;
  if s = '*' then begin
    s := '';
    exit;
  end;
  i := Length(s);
  while (i >= 1) and (s[i] <> ' ') do begin
    case s[i] of
      '|': Inc(v, 5);
      '.': Inc(v);
    end;
    Dec(i);
  end;
  SetLength(s, i - 1);
end;

function Convert(a: Integer): String;
begin
  if a = 0 then begin Result := '*'; exit; end;
  Result := '';
  while a >= 5 do begin Dec(a, 5); Result := '|' + Result; end;
  while a > 0 do begin Dec(a); Result := '.' + Result; end;
end;

var
  f: TextFIle;
  r, s1, s2: String;
  v1, v2, c: Integer;
begin
  AssignFile(f, 'input.txt'); Reset(f);
  Readln(f, s1);
  Readln(f, s2);
  CloseFile(f);

  c := 0; r := '';
  while (s1 <> '') or (s2 <> '') do begin
    Extract(v1, s1); //Writeln(v1, s1);
    Extract(v2, s2); //Writeln(v2, s2);
    if r <> '' then r := ' ' + r;
    r := Convert((v1 + v2 + c) mod 20) + r;
    c := (v1 + v2 + c) div 20;
  end;
  if c > 0 then r := '. ' + r;

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