#include <bits/stdc++.h>
using namespace std;
vector<int> no;
int N, K, W;
string s;
void preproc() {
  int res = 0;
  no.resize(N);
  memset(&no[0], 0, sizeof(no));
  for (int i = 0; i < K; i++) {
    res = 0;
    for (int j = i; j < N; j++) {
      if ((j - i) % K == 0) {
        if (s[j] == '0') res++;
      } else {
        if (s[j] == '1') res++;
      }
      if ((j - i) % K == 0) {
        no[j] = res;
      }
    }
  }
}
int main() {
  int x, y, res;
  cin >> N >> K >> W;
  cin >> s;
  preproc();
  cout << "\n";
  while (W--) {
    cin >> x >> y;
    res = no[y - 1] - no[x + K - 2];
    if (s[x + K - 2] == '0') res++;
    int i = x + K - 3;
    while (i >= x - 1) {
      if (s[i] == '1') res++;
      i--;
    }
    cout << res << "\n";
  }
  return 0;
}
