{$O-}
program ProjectG;

var
  i, kl, kr, K, j, P: Longword;
  ch: char;
  a: array [1..100000] of smallint;

procedure check;
var
  j:longword ;
  x: longint;
begin
  x:=0;

  j:=1;

  while (j<=i) and (x>=0) do
    begin
      x:=x +a[j];
      j:=j+1;
    end;

  if x=0
  then
    writeln('+')
  else
    writeln('-');
end;

begin
  Assign(input, 'brackets.in');
  Reset(input);
  Assign(output, 'brackets.out');
  Rewrite(output);

  i:=0;
  kl := 0;
  kr := 0;

  while not eoln(input) do
    begin
      i:=i+1;

      read(ch);

      if ch = '('
      then
        begin
          a[i] := 1;

          kl := kl + 1;
        end
      else
        begin
          a[i] := -1;

          kr := kr + 1;
        end;
    end;

  read(K);

  if (i mod 2) = 1
  then
    for j:=1 to K do
      writeln('-')
  else
    for j:=1 to K do
      begin
        readln(P);
        p:=p+1;

        if a[P] = 1
        then
          begin
            a[P] := -1;

            kl := kl - 1;
            kr := kr + 1
          end
        else
          begin
            a[P] := 1;

            kl := kl + 1;
            kr := kr - 1;
          end;

        if (kl <> kr) or (a[1] = -1) or (a[i] = 1)
        then
          writeln('-')
        else
          check;
      end;
end.