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

class Main2 {

	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 SegmentTree {
      int min[];
      int incOn[];
      int size;
      
      SegmentTree(int cap) {
			min = new int[4 * cap];
			incOn = new int[4 * cap];
			size = cap;
			Arrays.fill(min, Integer.MAX_VALUE / 2);
      }

      void set(int pos, int value){
			setValue(1, 0, size - 1, value, pos);
      }

      private void setValue(int idx, int low, int high, int value, int pos) {
      	if (low == high) {
      		asserT(low == pos);
				min[idx] = value;
				return;
      	}
      	int mid = (low + high) >> 1;
      	if (pos <= mid) {
      		setValue(idx + idx, low, mid, value, pos);
      	} else {
      		setValue(idx + idx + 1, mid + 1, high, value, pos);
      	}
      	min[idx] = Math.min(min[idx + idx], min[idx + idx + 1]);
      }


      int getMin(int low, int high) {
         return getMin(1, 0, size-1, low, high);
      }

		private int getMin(int idx, int low, int high, int currLow, int currHigh) {
      	if (currLow == low && high == currHigh) {
      		return min[idx];
      	}
      	int mid = (low + high) >> 1;
			
			if (incOn[idx] != 0) {
				inc(idx+idx, low, mid, low, mid, incOn[idx]);
				inc(idx+idx+1,mid+1,high, mid+1, high, incOn[idx]);
   			incOn[idx] = 0;
   		}
      	
      	if (currHigh <= mid) {
      		return getMin(idx+idx, low, mid, currLow, currHigh);
      	} else if (mid < currLow) {
      		return getMin(idx+idx+1, mid+1, high, currLow, currHigh);
      	} else {
      		return Math.min(getMin(idx+idx, low, mid, currLow, mid),
      			getMin(idx+idx+1, mid+1, high, mid+1, currHigh));
      	}
      }                                          
                                   
      void incSegment(int low, int high, int value) {
      	asserT(0 <= low && high <= size-1);
      	asserT(low <= high);
      	inc(1, 0, size - 1, 	low, high, value);
      }

      private void inc(int idx, int low, int high, int lowCh, int highCh, int value) {
      	if (lowCh == low && high == highCh) {
      		min[idx] += value;
      		incOn[idx] += value;
      		return;
      	}
      //	asserT(low <= lowCh && highCh <= high);
      	int mid = (low + high) >> 1;
      	
      	if (incOn[idx] != 0) {
      		inc(idx+idx, low, mid, low, mid, incOn[idx]);
				inc(idx+idx+1,mid+1,high, mid+1, high, incOn[idx]);
   			incOn[idx] = 0;
   		}
      	      	
      	if (highCh <= mid) {
      		inc(idx + idx, low, mid, lowCh, highCh, value);
      	} else if (mid < lowCh) {
      		inc(idx + idx + 1, mid + 1, high, lowCh, highCh, value);
      	} else {
      		inc(idx + idx, low, mid, lowCh, mid, value);
      		inc(idx + idx + 1, mid + 1, high, mid + 1, highCh, value);
      	}
      	min[idx] = Math.min(min[idx + idx], min[idx + idx + 1]);
      }           
	}

	void solve(){
		char []s = in.nextLine().toCharArray();
		SegmentTree tree = new SegmentTree(s.length);
		int d = 0;
		for (int i = 0; i < s.length; i++) {
			if (s[i] == '(') {
				d++;
			} else {
				asserT(s[i] == ')');
				d--;
			}
			tree.set(i, d);
		}
	   
		int nTests = in.nextInt();
		int cnt = 0;
		for (int i = 0; i < nTests; i++) {
			int pos = in.nextInt();
			int val;
			if (s[pos] == ')') {
				s[pos] = '(';
				val = 2;
			} else {
				s[pos] = ')';
				val = -2;
			}
			d += val;
			tree.incSegment(pos, s.length - 1, val);			
//			out.println(s);
// 		out.println(" " + d+ " min = " + min);
			if (d == 0) {
				int min = tree.getMin(0, s.length - 1);
			  	if (min == 0) {
			  		out.println("+");
//					out.print((i + 1) + " ");
//					cnt++;
				} else {
					out.println("-");
				}
//				cnt++;
			} else {
				out.println("-");
			}
		}
//		out.println("\r\ncount = " + cnt);
	}

   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 solveAll(){
		for (int i = 1; i <= 21; i++) {
			run(""+i);
		}
	}	
      
	void run(String filename){
		PrintWriter times;
		try {
			in = new Scanner(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			times = new PrintWriter(filename + ".time.log");
      } catch (IOException e) {
      	throw new Error();
      }
      long time = System.currentTimeMillis();
		try {
			solve();
		} finally {
			out.close();
		}
		times.print(System.currentTimeMillis() - time);
		times.close();
	}
   
	public static void main(String []args){
		// new Main().solveAll();
		new Main2().run();
	}
};
