#include <bits/stdc++.h>
using namespace std;
struct data {
  int x, y, id;
};
int a[200010], b[200010], c[200010], rnk[200010], tot[200010], res[200010],
    non[200010], val[200010];
vector<int> pos[200010];
vector<data> Q[200010];
int read() {
  int tmp = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    tmp = tmp * 10 + c - '0';
    c = getchar();
  }
  return tmp;
}
struct block {
  int tag[500], tl[500], tr[500], sep[200010], sum[500][20000], size, cnt, need,
      last;
  void build(int c) {
    int pre = 0;
    size = sqrt(tot[c]);
    for (int cur = 1; cur <= tot[c]; cur += size) {
      int nxt = min(cur + size - 1, tot[c]);
      cnt++;
      tl[cnt] = cur;
      tr[cnt] = nxt;
      for (int i = cur; i <= nxt; i++) {
        sep[i] = cnt;
        pre ^= val[pos[c][i]];
        val[pos[c][i]] = pre;
        sum[cnt][pre]++;
        if (pre) need++;
      }
    }
    if (pre) last = -1;
  }
  void modify(int c, int x, int y) {
    int l = tl[sep[x]], r = tr[sep[x]];
    for (int i = l; i <= r; i++) {
      int tmp = pos[c][i];
      sum[sep[x]][val[tmp]]--;
      if ((val[tmp] ^ tag[sep[x]]) == 0) need++;
      val[tmp] ^= tag[sep[x]];
      if (i >= x) val[tmp] ^= y;
      sum[sep[x]][val[tmp]]++;
      if (val[tmp] == 0) need--;
    }
    tag[sep[x]] = 0;
    for (int i = sep[x] + 1; i <= cnt; i++) {
      need += sum[i][tag[i]];
      tag[i] ^= y;
      need -= sum[i][tag[i]];
    }
    int tmp = pos[c][tot[c]];
    if ((val[tmp] ^ tag[cnt]) == 0)
      last = 0;
    else
      last = -1;
  }
  void clear(int c) {
    for (int i = 1; i <= cnt; i++) tag[i] = tl[i] = tr[i] = 0;
    for (int i = 1; i <= tot[c]; i++) sum[sep[i]][val[pos[c][i]]] = 0;
    size = cnt = need = last = 0;
  }
} B;
void solve(int c) {
  B.build(c);
  if (B.last == -1)
    non[0]++;
  else
    res[0] += B.need;
  int len = Q[c].size();
  for (int i = 0; i <= len - 1; i++) {
    data tmp = Q[c][i];
    if (B.last == -1)
      non[tmp.id]--;
    else
      res[tmp.id] -= B.need;
    B.modify(c, tmp.x, tmp.y);
    if (B.last == -1)
      non[tmp.id]++;
    else
      res[tmp.id] += B.need;
  }
  B.clear(c);
}
int main() {
  int n = read(), k = read(), q = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++) {
    b[i] = read();
    c[i] = a[i] ^ b[i];
  }
  for (int i = 1; i <= n + 1; i++) val[i] = c[i] ^ c[i - 1];
  for (int i = 0; i <= k - 1; i++) pos[i].push_back(0);
  for (int i = 1; i <= n + 1; i++) {
    pos[i % k].push_back(i);
    rnk[i] = ++tot[i % k];
  }
  for (int i = 1; i <= q; i++) {
    char c = getchar();
    while (c != 'a' && c != 'b') c = getchar();
    int x = read(), y = read();
    if (c == 'a') {
      y ^= a[x];
      a[x] ^= y;
    } else {
      y ^= b[x];
      b[x] ^= y;
    }
    Q[x % k].push_back((data){rnk[x], y, i});
    Q[(x + 1) % k].push_back((data){rnk[x + 1], y, i});
  }
  for (int i = 0; i <= k - 1; i++) solve(i);
  for (int i = 0; i <= q; i++) {
    if (i) {
      non[i] += non[i - 1];
      res[i] += res[i - 1];
    }
    if (non[i])
      puts("-1");
    else
      printf("%d\n", res[i]);
  }
  return 0;
}
