Problem: The Fair Nut has two arrays a and b, consisting of n numbers. He found them so long ago that no one knows when they came to him.

The Fair Nut often changes numbers in his arrays. He also is interested in how similar a and b are after every modification.

Let's denote similarity of two arrays as the minimum number of operations to apply to make arrays equal (every operation can be applied for both arrays). If it is impossible, similarity will be equal -1.

Per one operation you can choose a subarray with length k (k is fixed), and change every element a_i, which belongs to the chosen subarray, to a_i ⊕ x (x can be chosen), where ⊕ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR). 

Nut has already calculated the similarity of the arrays after every modification. Can you do it?

Note that you just need to calculate those values, that is you do not need to apply any operations.

Input

The first line contains three numbers n, k and q (1 ≤ k ≤ n ≤ 2 ⋅ 10^5, 0 ≤ q ≤ 2 ⋅ 10^5) — the length of the arrays, the length of the subarrays, to which the operations are applied, and the number of queries.

The second line contains n integers a_1, a_2, …, a_n (0 ≤ a_i < 2^{14}) — elements of array a.

The third line contains n integers b_1, b_2, …, b_n (0 ≤ b_i < 2^{14}) — elements of array b.

Each of the next q lines describes query and contains string s and two integers p and v (1 ≤ p ≤ n, 0 ≤ v < 2^{14}) — array, which this query changes («a» or «b» without quotes), index of changing element and its new value.

Output

On the first line print initial similarity of arrays a and b.

On the i-th of following q lines print similarity of a and b after applying first i modifications.

Examples

Input

3 3 1
0 4 2
1 2 3
b 2 5


Output

-1
1


Input

3 2 2
1 3 2
0 0 0
a 1 0
b 1 1


Output

2
-1
2

Note

In the first sample making arrays [0, 4, 2] and [1, 2, 3] is impossible with k=3. After the modification, you can apply the operation with x=1 to the whole first array (its length is equal to k), and it will be equal to the second array.

In order to make arrays equal in the second sample before changes, you can apply operations with x=1 on subarray [1, 2] of a and with x=2 on subarray [2, 3] of b.

After all queries arrays will be equal [0, 3, 2] and [1, 0, 0]. The same operations make them equal [1, 2, 2].

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long sqr(long long x) { return x * x; }
int mysqrt(long long x) {
  int l = 0, r = 1e9 + 1;
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (m * (long long)m <= x)
      l = m;
    else
      r = m;
  }
  return l;
}
mt19937 rnd(1227);
mt19937_64 rndll(12365);
long long AR = 19, BR = 13, CR = 23, XR = 228, YR = 322, MODR = 1e9 + 993;
long long myrand() {
  long long ZR = (XR * AR + YR * BR + CR) % MODR;
  XR = YR;
  YR = ZR;
  return ZR;
}
int gcd(int a, int b) { return a ? gcd(b % a, a) : b; }
int gcdex(int a, int b, int &x, int &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  int x1, y1;
  int ret = gcdex(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return ret;
}
int Mod;
int Bpow(int x, int y) {
  int ret = 1;
  int w = x;
  while (y) {
    if (y & 1) ret = (ret * (long long)w) % Mod;
    w = (w * (long long)w) % Mod;
    y >>= 1;
  }
  return ret;
}
int Bdiv(int x) {
  int a, b;
  gcdex(x, Mod, a, b);
  if (a < 0) a += Mod;
  return a;
}
int Bdiv(int x, int y) { return (x * (long long)Bpow(y, Mod - 2)) % Mod; }
inline int ad(int x, int y) { return x + y >= Mod ? x + y - Mod : x + y; }
inline int dif(int x, int y) { return x - y < 0 ? x - y + Mod : x - y; }
inline int mul(int x, int y) { return (x * (long long)y) % Mod; }
int inv(int a) {
  int b = Mod, x = 0, y = 1;
  while (a) {
    int t = b / a;
    b -= a * t;
    x -= t * y;
    swap(a, b);
    swap(x, y);
  }
  if (x < 0) x += Mod;
  return x;
}
void setmin(int &x, int y) { x = min(x, y); }
void setmax(int &x, int y) { x = max(x, y); }
void setmin(long long &x, long long y) { x = min(x, y); }
void setmax(long long &x, long long y) { x = max(x, y); }
const long long llinf = 4e18 + 100;
const long double eps = 1e-9;
const int maxn = 2e5 + 100, maxw = 1e6 + 100, inf = 2e9 + 100, sq = 600, X = 43,
          mod = 1e9 + 7, LG = 17;
vector<int> pref[maxn];
vector<vector<int> > q[sq];
vector<int> dop[sq];
int all[maxn];
int len[maxn];
int bad;
int sum;
int mas[maxn];
int arr[2][maxn];
int n, k, zap;
void change(int i, int w) {
  w ^= mas[i];
  int id = i % k;
  int l = i / k;
  if (k >= sq) {
    for (int it = l; it < len[id]; it++) {
      if (pref[id][it] == 0) sum--;
      pref[id][it] ^= w;
      if (pref[id][it] == 0) sum++;
    }
  } else {
    while (l < len[id] && l % sq != 0) {
      if ((pref[id][l] ^ dop[id][l / sq]) == 0) sum--;
      q[id][l / sq][pref[id][l]]--;
      pref[id][l] ^= w;
      if ((pref[id][l] ^ dop[id][l / sq]) == 0) sum++;
      q[id][l / sq][pref[id][l]]++;
      l++;
    }
    while (l < len[id]) {
      int it = l / sq;
      sum -= q[id][it][dop[id][it]];
      dop[id][it] ^= w;
      sum += q[id][it][dop[id][it]];
      l += sq;
    }
  }
  if (all[id] == 0) bad++;
  all[id] ^= w;
  if (all[id] == 0) bad--;
  mas[i] ^= w;
}
void change(int id, int i, int w) {
  arr[id][i] = w;
  change(i,
         arr[0][i] ^ arr[1][i] ^ (i > 0 ? (arr[0][i - 1] ^ arr[1][i - 1]) : 0));
  change(i + 1, arr[0][i] ^ arr[1][i] ^ arr[0][i + 1] ^ arr[1][i + 1]);
}
int get() {
  if (bad == 0) return n + 1 - sum;
  return -1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k >> zap;
  for (int i = 0; i <= n; i++) len[i % k]++;
  for (int i = 0; i < k; i++) {
    sum += len[i], pref[i].resize(len[i]);
    if (k < sq) {
      q[i].resize((len[i] + sq - 1) / sq, vector<int>((1 << 14) + 5));
      dop[i].resize((len[i] + sq - 1) / sq);
      for (int j = 0; j < len[i]; j += sq) {
        int r = min(len[i], j + sq);
        q[i][j / sq][0] = r - j;
      }
    }
  }
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < n; j++) {
      int x;
      cin >> x;
      change(i, j, x);
    }
  cout << get() << '\n';
  for (int it = 0; it < zap; it++) {
    string t;
    int i, w;
    cin >> t >> i >> w;
    int id = 0;
    if (t == "b") id = 1;
    i--;
    change(id, i, w);
    cout << get() << '\n';
  }
}