#include <bits/stdc++.h>
using namespace std;
string str;
int num[110000][20];
int abs(int n) {
  if (n < 0) return -1 * n;
  return n;
}
int main() {
  int n, k, w, put = 0, x, y;
  cin >> n >> k >> w;
  cin >> str;
  bool f = false;
  for (int li = 1; li <= k; li++) {
    put = 0;
    for (int j = 1; j <= n; j++) {
      f = false;
      if ((j - li + 1) % k == 0) f = true;
      if (str[j - 1] == '1' && !f) {
        put++;
      }
      if (str[j - 1] == '0' && f) {
        put++;
      }
      num[j][li % k] = put;
    }
  }
  for (int i = 0; i < w; i++) {
    cin >> x >> y;
    cout << num[y][x % k] - num[x - 1][x % k] << endl;
  }
}
