#include <bits/stdc++.h>
using namespace std;
const int M = 327;
int a[200200], b[200200], c[200200];
int id[200200], nn;
long long ans;
struct Array {
  vector<int> vec;
  vector<vector<int> > cnt;
  vector<int> lazy;
  int ans, sum, tot, n;
  Array() {}
  void pre() {
    n = vec.size();
    for (int i = 1; i < n; i++) vec[i] ^= vec[i - 1];
    sum = vec[n - 1];
    tot = 0;
    for (int i = 0; i < n; i++) tot += vec[i] == 0;
    if (n > M) {
      for (int i = 0; i < n; i += M) {
        cnt.push_back(vector<int>(1 << 14, 0));
        lazy.push_back(0);
        for (int j = i; j < n && j < i + M; j++) cnt.back()[vec[j]]++;
      }
    }
    ans = sum ? 200200 : n - tot;
    ::ans += ans;
  }
  void update(int p, int v) {
    ::ans -= ans;
    sum ^= v;
    if (n <= M) {
      tot = 0;
      for (int i = p; i < n; i++) vec[i] ^= v;
      for (int i = 0; i < n; i++) tot += vec[i] == 0;
    } else {
      int id = p / M, r = p % M;
      for (int j = r, st = id * M; j < M && st + j < n; j++) {
        cnt[id][vec[st + j]]--;
        vec[st + j] ^= v;
        cnt[id][vec[st + j]]++;
      }
      tot = 0;
      for (int i = 0; i < lazy.size(); i++) {
        if (i > id) lazy[i] ^= v;
        tot += cnt[i][lazy[i]];
      }
    }
    ans = sum ? 200200 : n - tot;
    ::ans += ans;
  }
} arr[200200];
inline void print() {
  if (ans >= 200200)
    puts("-1");
  else
    printf("%I64d\n", ans);
}
int main() {
  int n, k, m;
  cin >> n >> k >> m;
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= n; i++) scanf("%d", b + i), c[i] = a[i] ^ b[i];
  for (int i = 0; i < n; i++) c[i] ^= c[i + 1];
  for (int i = 0; i <= n; i++) arr[i % k].vec.push_back(c[i]);
  for (int i = 0; i < k; i++) arr[i].pre();
  print();
  while (m--) {
    char ch;
    int p, v;
    scanf(" %c %d %d", &ch, &p, &v);
    int pre;
    if (ch == 'a')
      pre = a[p], a[p] = v;
    else
      pre = b[p], b[p] = v;
    v ^= pre;
    arr[p % k].update(p / k, v);
    p--;
    arr[p % k].update(p / k, v);
    print();
  }
  return 0;
}
