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

class Main3 {

	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());
		}                      
	}
   

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


	static class Decomp {
		int values[];
      // кэшируем минимальное значение
		int cash[];
		int incOn[];
		int size;

		Decomp(int cap) {
			values = new int[cap];
			size = (int)Math.sqrt(cap);
			if (size * size == cap) {
				cash = new int[size+1];
			} else {	
				cash = new int[size+2];
			}
			incOn = new int[cash.length];
		}
                            
		void reCalc(int i) {
			int start = i * size;
			int end = (i + 1) * size;
			cash[i] = Integer.MAX_VALUE;
			for (int j = start; j < values.length && j < end; j++) {
				values[j] += incOn[i];
				cash[i] = Math.min(cash[i], values[j]);
			}
			incOn[i] = 0;
		}

		void calcCash() {
			for (int i = 0; i < cash.length; i++) {
				reCalc(i);
			}
		}

		int getMinValue() {
			int ans = Integer.MAX_VALUE;
			for (int i = 0; i < cash.length; i++) {
				ans = Math.min(ans, cash[i]);
			}
			return ans;
		}

		void incInterval(int d, int low, int high) {
			int start = low / size;
			int end = high / size;
			asserT(start <= end);
			asserT(end < cash.length);
			if (start == end) {
				cash[start] = Integer.MAX_VALUE;
				for (int i = low; i <= high; i++) {
					values[i] += d;
				}
				reCalc(start);				
				return;
			}
			for (int i = start + 1; i < end; i++) {
				cash[i] += d;
				incOn[i] += d;
			}                       
			incInterval(d, low, (start + 1) * size - 1);			
			incInterval(d, end * size, high);
		}
	};

	Decomp decomp;

	boolean isCorrect(){
   	return decomp.getMinValue() == 0;
	}
	
   
	void solve(){
   	char []s = in.nextLine().toCharArray();
   	decomp = new Decomp(s.length);
   	int nTests = in.nextInt();
   	int d = 0;
   	for (int i = 0; i < s.length; i++) {
   		if (s[i] == '(') {
   			d++;
   		} else {
   			d--;
   		}
   		decomp.values[i] = d;
   	}
   	decomp.calcCash();
   	for (int i = 0; i < nTests; i++) {
   		int pos = in.nextInt();
   		if (s[pos] == ')') {
   			s[pos] = '(';
   			decomp.incInterval(2, pos, s.length-1);
   			d += 2;
   		} else {
   			asserT(s[pos] == '(');
            s[pos] = ')';
            decomp.incInterval(-2, pos, s.length-1);
   			d -= 2;
   		}
   		if (d == 0 && isCorrect()){
   			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.sqrt"));
      } 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 <= 21; i++) {
			run(i + "");
		}
	}

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