#include <bits/stdc++.h>
using namespace std;
int n, m, q;
int a[200050], b[200050], c[200050];
int L[200050], R[200050];
int N, val[200050];
int ok;
int tag[450];
int cnt[450][(1 << 14)];
int B, block[200050];
void init() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i < n; ++i) scanf("%d", &b[i]);
  for (int i = 0; i < n; ++i) c[i] = a[i] ^ b[i];
  for (int i = n; i; --i) c[i] ^= c[i - 1];
  for (int i = 0; i < m; ++i) {
    val[L[i] = N++] = c[i];
    for (int j = i + m; j <= n; j += m) val[L[j] = N++] = c[j] ^ val[L[j - m]];
    for (int j = i; j <= n; j += m) R[j] = N - 1;
    ok += (bool)val[N - 1];
  }
  B = sqrt(n);
  for (int i = 0; i <= n; ++i) ++cnt[block[i] = i / B][val[i]];
}
int Ans() {
  if (ok) return -1;
  int ans = 0;
  for (int i = 0; i <= block[n]; ++i) ans += cnt[i][tag[i]];
  return n + 1 - ans;
}
void change(int l, int r, int w) {
  if (val[r] ^ tag[block[r]]) --ok;
  for (; l <= r && (!l || block[l] == block[l - 1]); ++l) {
    --cnt[block[l]][val[l]];
    val[l] ^= w;
    ++cnt[block[l]][val[l]];
  }
  for (; l <= r && block[l] < block[r]; l += B) tag[block[l]] ^= w;
  for (; l <= r; ++l) {
    --cnt[block[l]][val[l]];
    val[l] ^= w;
    ++cnt[block[l]][val[l]];
  }
  if (val[r] ^ tag[block[r]]) ++ok;
}
void solve() {
  printf("%d\n", Ans());
  while (q--) {
    char op[5];
    int i, w, t, pre;
    scanf("%s%d%d", op, &i, &w);
    --i;
    if (*op == 'a')
      pre = a[i], a[i] = w;
    else
      pre = b[i], b[i] = w;
    change(L[i], R[i], pre ^ w), c[i] ^= pre ^ w;
    change(L[i + 1], R[i + 1], pre ^ w), c[i + 1] ^= pre ^ w;
    printf("%d\n", Ans());
  }
}
int main() {
  init();
  solve();
  return 0;
}
