import java.io.BufferedInputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
static Map<Long, Integer>[][] count;
static int getCount(int parity, int color, long value) {
return count[parity][color].getOrDefault(value, 0);
}
static void addCount(int parity, int color, long value, int delta) {
Map<Long, Integer> map = count[parity][color];
int newCount = map.getOrDefault(value, 0) + delta;
if (newCount == 0) {
map.remove(value);
} else {
map.put(value, newCount);
}
}
@SuppressWarnings("unchecked")
public static void main(String[] args) {
Scanner scanner = new Scanner(new BufferedInputStream(System.in));
int n = scanner.nextInt();
int q = scanner.nextInt();
long target = scanner.nextLong();
long[] weight = new long[n + 1];
for (int i = 1; i <= n; i++) {
weight[i] = scanner.nextLong();
}
String states = scanner.next();
// 0 表示红色 R,1 表示蓝色 B
int[] color = new int[n + 1];
// count[下标奇偶性][颜色]
count = new HashMap[2][2];
for (int parity = 0; parity < 2; parity++) {
for (int c = 0; c < 2; c++) {
count[parity][c] = new HashMap<>();
}
}
long answer = 0;
// 计算初始合法配对数量
for (int i = 1; i <= n; i++) {
color[i] = states.charAt(i - 1) == 'R' ? 0 : 1;
int parity = i & 1;
long complement = target - weight[i];
answer += getCount(
parity ^ 1,
color[i] ^ 1,
complement
);
addCount(parity, color[i], weight[i], 1);
}
StringBuilder result = new StringBuilder();
while (q-- > 0) {
int index = scanner.nextInt();
int parity = index & 1;
long complement = target - weight[index];
// 删除切换前,该设备产生的合法配对
answer -= getCount(
parity ^ 1,
color[index] ^ 1,
complement
);
addCount(parity, color[index], weight[index], -1);
// 切换颜色
color[index] ^= 1;
// 加入切换后,该设备产生的合法配对
answer += getCount(
parity ^ 1,
color[index] ^ 1,
complement
);
addCount(parity, color[index], weight[index], 1);
result.append(answer).append('\n');
}
System.out.print(result);
scanner.close();
}
}