#include <bits/stdc++.h>
using namespace std;
inline long long rd() {
  long long x = 0;
  bool neg = false;
  char c = getchar();
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  if (c == '-') neg = true, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  if (neg) x = -x;
  return x;
}
inline void write(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
const int maxn = 2e5;
int n, m, q, A[maxn + 2];
struct Tnode {
  int G[2][6], lazy;
  void init(int ok) {
    lazy = 0;
    for (int _b = m - 1, i = 0; i <= _b; ++i) G[0][i] = G[1][i] = i + 1;
    if (!ok)
      G[0][m] = m, G[1][m] = 0;
    else
      G[0][m] = 0, G[1][m] = m;
  }
  void flip() {
    lazy ^= 1;
    for (int _b = m, i = 0; i <= _b; ++i) swap(G[0][i], G[1][i]);
  }
} Tree[maxn << 2];
Tnode operator+(const Tnode &a, const Tnode &b) {
  Tnode c;
  c.lazy = 0;
  for (int _b = 1, i = 0; i <= _b; ++i)
    for (int _b = m, j = 0; j <= _b; ++j) c.G[i][j] = a.G[i][b.G[i][j]];
  return c;
}
void build(int id, int l, int r) {
  if (l == r) {
    Tree[id].init(A[l]);
    return;
  }
  build((id << 1), l, ((l + r) >> 1));
  build((id << 1 | 1), ((l + r) >> 1) + 1, r);
  Tree[id] = Tree[(id << 1)] + Tree[(id << 1 | 1)];
}
void down(int id) {
  if (Tree[id].lazy) {
    Tree[id].lazy = 0;
    Tree[(id << 1)].flip();
    Tree[(id << 1 | 1)].flip();
  }
}
void update(int id, int l, int r, int u, int v) {
  if (l > v || r < u) return;
  if (l >= u && r <= v) {
    Tree[id].flip();
    return;
  }
  down(id);
  update((id << 1), l, ((l + r) >> 1), u, v);
  update((id << 1 | 1), ((l + r) >> 1) + 1, r, u, v);
  Tree[id] = Tree[(id << 1)] + Tree[(id << 1 | 1)];
}
Tnode query(int id, int l, int r, int u, int v) {
  if (l >= u && r <= v) return Tree[id];
  down(id);
  Tnode res;
  if (v <= ((l + r) >> 1))
    res = query((id << 1), l, ((l + r) >> 1), u, v);
  else if (((l + r) >> 1) < u)
    res = query((id << 1 | 1), ((l + r) >> 1) + 1, r, u, v);
  else
    res = query((id << 1), l, ((l + r) >> 1), u, v) +
          query((id << 1 | 1), ((l + r) >> 1) + 1, r, u, v);
  return res;
}
void input() {
  n = rd();
  m = rd();
  q = rd();
  for (int _b = n, i = 1; i <= _b; ++i) A[i] = rd() & 1;
}
void solve() {
  build(1, 1, n);
  while (q--) {
    int ty, l, r;
    ty = rd();
    l = rd();
    r = rd();
    if (ty == 1) {
      if (rd() & 1) update(1, 1, n, l, r);
    } else {
      write(query(1, 1, n, l, r).G[0][m] ? 1 : 2);
      putchar('\n');
    }
  }
}
int main() {
  input();
  solve();
  return 0;
}
