const
  fin = 'zecovi.in';
  fout = 'zecovi.out';


var
  res : Longint;


  procedure ReadInputAndSolve();
  var
    f : Text;
    n, i, z : Longint;
    ch : Char;
  begin
    Assign(f, fin);
    Reset(f);

    Readln(f, n);

    res := 1;
    z := 0;
    for i := 1 to 2*n do
    begin
      Read(f, ch);
      if ch = '>' then
        Inc(z)
      else
      begin
        res := (res * z) mod 10007;
        Dec(z);
      end;
    end;

    Close(f);
  end;


  procedure WriteOutput();
  var
    f : Text;
  begin
    Assign(f, fout);
    Rewrite(f);
    Writeln(f, res);
    Close(f);
  end;


begin
  ReadInputAndSolve();
  WriteOutput;
end.