var   a, b, c, d : integer;
         i, n, m : integer;
            X, Y : array[1..1000001] of char;
{********************** Преобразуем дробь a/b к 1 **********************}
Procedure From_ab_to_1(p, q: integer);
   var t : integer;
   begin
       n := 0;
       while (p <> 1) or (q <> 1) do begin     inc(n);
          if p >= q then begin X[n] := 'B'; dec(p, q);
             continue; end;
          if p < q  then begin X[n] := 'C'; t:= p; p:= q; q:= t;
             continue; end;
       end;
   end;
{********************** Преобразуем дробь c/d к 1 **********************}
Procedure From_cd_to_1(p, q: integer);
   var t : integer;
   begin
       m := 0;
       while (p <> 1) or (q <> 1) do begin     inc(m);
          if p >= q then begin Y[m] := 'A'; dec(p, q);
             continue; end;
          if p < q  then begin Y[m] := 'C'; t:= p; p:= q; q:= t;
             continue; end;
       end;
   end;
{***********************************************************************}
begin
   assign(input, 'fractions.in');  reset(input);
   assign(output,'fractions.out'); rewrite(output);
   read(a, b);   read(c, d);       close(input);

   From_ab_to_1(a, b);
   From_cd_to_1(c, d);
   writeln(n + m);
   for i := 1 to n do write(X[i]);
   for i := m downto 1 do write(Y[i]);
end.
