#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, w;
  cin >> n >> k >> w;
  vector<int> konf(n, false);
  vector<vector<int>> bm(k, vector<int>(n + 1, 0));
  string str;
  cin >> str;
  for (size_t i = 0; i < n; i++) {
    konf[i] = str[i] - '0';
  }
  for (int i = 0; i < k; i++) {
    int cnt = 1;
    for (int j = i; j < n; j++) {
      bm[i][j + 1] = bm[i][j];
      if ((cnt != k && konf[j] == true) || (cnt == k && konf[j] == false)) {
        bm[i][j + 1]++;
      }
      if (cnt++ == k) cnt = 1;
    }
  }
  int l, r;
  for (int i = 0; i < w; i++) {
    cin >> l >> r;
    int ind, counter = 0;
    if (l % k == 0)
      ind = k - 1;
    else
      ind = l % k - 1;
    cout << bm[ind][r] - bm[ind][l - 1] << endl;
  }
  return 0;
}
