import java.io.*;
import java.util.*;

public class Main {

	Scanner in;
	PrintWriter out;

	static class Scanner {
		StreamTokenizer in;

		Scanner(Reader r) {
			in = new StreamTokenizer(new BufferedReader(r));
			in.resetSyntax();
			in.whitespaceChars(0,32);
			in.wordChars(33,255);
		}

		String next(){
			try {
				in.nextToken();
				return in.sval;
			} catch (IOException e) {
				throw new Error();
			}
		}

		String nextLine(){
			return next();
		}


		int nextInt(){
			return Integer.parseInt(next());
		}                      
	}



	void asserT(boolean e) {
		if (!e) {
			throw new Error();
		}
	}

	boolean isCorrect(char []s) {
		int d = 0;
		for (int i = 0; i < s.length; i++) {
			if (s[i] == '(') {
				d++;
			} else {
				asserT(s[i] == ')');
				d--;
				if (d < 0) {
					return false;
				}
			}
		}
		return d == 0;
	}
   
	void solve(){
   	char []s = in.nextLine().toCharArray();
   	int nTests = in.nextInt();
   	int d = 0;
   	for (int i = 0; i < s.length; i++) {
   		if (s[i] == '(') {
   			d++;
   		} else {
   			d--;
   		}
   	}
   	for (int i = 0; i < nTests; i++) {
   		int pos = in.nextInt();
   		if (s[pos] == ')') {
   			s[pos] = '(';
   			d+=2;
   		} else {
   			asserT(s[pos] == '(');
   			s[pos] = ')';
   			d-=2;
   		}
//   		if (d == 0 && isCorrect(s)){
//   			out.print((i + 1)  + " ");
//   		}
			  	if (d == 0 && isCorrect(s)){
			  		out.println("+");
				} else {
					out.println("-");
				}
     	}
   }

   void run() {
   	try {
			in = new Scanner(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
   	} catch (Exception e) {
   		throw new Error(e);
   	}
   	try {
   		solve();
   	} finally {
   		out.close();
   	}
   }

	void run(String filename){
		PrintWriter times;
		try {
			in = new Scanner(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			times = new PrintWriter(new FileWriter(filename + ".time.bruteforce"));
      } catch (IOException e) {
      	throw new Error();
      }

      long time = System.currentTimeMillis();
		try {
			solve();
		} finally {
			out.close();
		}
		times.println(System.currentTimeMillis() - time);
		times.close();
	}

	void solveAll(){
		for (int i = 1; i <= 19; i++) {
			run(i + "");
		}
	}

	public static void main(String []args) {
		// new Main().solveAll();
		new Main().run();
	}
};
