#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, m, Q, a[N];
inline int rd() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + c - '0';
  return x * f;
}
struct data {
  int a[8];
};
struct pp {
  int l, r, tag;
  data v[2];
} t[N << 2];
data operator+(data u, data v) {
  data res;
  for (int i = 1; i <= m + 1; i++) res.a[i] = u.a[v.a[i]];
  return res;
}
inline void update(int p) {
  t[p].v[0] = t[p << 1].v[0] + t[p << 1 | 1].v[0];
  t[p].v[1] = t[p << 1].v[1] + t[p << 1 | 1].v[1];
}
inline void pushdown(int p) {
  if (!t[p].tag) return;
  t[p].tag = 0;
  swap(t[p << 1].v[0], t[p << 1].v[1]), t[p << 1].tag ^= 1;
  swap(t[p << 1 | 1].v[0], t[p << 1 | 1].v[1]), t[p << 1 | 1].tag ^= 1;
}
inline void build(int l, int r, int p) {
  t[p].l = l, t[p].r = r, t[p].tag = 0;
  if (l == r) {
    for (int i = 1; i <= m; i++) t[p].v[0].a[i] = t[p].v[1].a[i] = i + 1;
    t[p].v[0].a[m + 1] = (a[l] ? 1 : m + 1);
    t[p].v[1].a[m + 1] = (!a[l] ? 1 : m + 1);
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, p << 1), build(mid + 1, r, p << 1 | 1);
  update(p);
}
inline void modify(int l, int r, int p, int lx, int rx) {
  if (l == lx && r == rx) {
    swap(t[p].v[0], t[p].v[1]), t[p].tag ^= 1;
    return;
  }
  pushdown(p);
  int mid = (l + r) >> 1;
  if (rx <= mid)
    modify(l, mid, p << 1, lx, rx);
  else if (lx > mid)
    modify(mid + 1, r, p << 1 | 1, lx, rx);
  else
    modify(l, mid, p << 1, lx, mid),
        modify(mid + 1, r, p << 1 | 1, mid + 1, rx);
  update(p);
}
data qry(int l, int r, int p, int lx, int rx) {
  if (l == lx && r == rx) return t[p].v[0];
  pushdown(p);
  int mid = (l + r) >> 1;
  if (rx <= mid)
    return qry(l, mid, p << 1, lx, rx);
  else if (lx > mid)
    return qry(mid + 1, r, p << 1 | 1, lx, rx);
  else
    return qry(l, mid, p << 1, lx, mid) +
           qry(mid + 1, r, p << 1 | 1, mid + 1, rx);
}
int main() {
  n = rd(), m = rd(), Q = rd();
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]), a[i] &= 1;
  build(1, n, 1);
  while (Q--) {
    int opt = rd(), l = rd(), r = rd();
    if (opt == 1) {
      long long x;
      scanf("%lld", &x);
      if (x & 1) modify(1, n, 1, l, r);
    } else {
      data x = qry(1, n, 1, l, r);
      printf("%d\n", 1 + (x.a[m + 1] == 1));
    }
  }
  return 0;
}
