#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
int n, k, w;
char a[N];
vector<int> pref;
int cnt[N][11];
int sumq(int l, int r) { return pref[r] - pref[l - 1]; }
int cnt_q(int a, int b, int c, int d) {
  if (a % d < c) {
    a -= a % d;
    a += c;
  } else if (a % d > c) {
    a = (a - a % c);
    a += d + c;
  }
  if (b % d < c) {
    b -= d;
    b = (b - b % d) + c;
  } else if (b % d > c) {
    b -= (b % d - c);
  }
  return (b - a) / d + 1;
}
int how_many(int l, int r) {
  return cnt[r][(l + k - 1) % k] - cnt[l - 1][(l + k - 1) % k];
}
int main() {
  scanf("%d%d%d", &n, &k, &w);
  int sB = 0;
  pref.push_back(0);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (a[i] == '1') {
      ++sB;
      cnt[i + 1][(i + 1) % k] = cnt[i][(i + 1) % k] + 1;
      for (int ost = 0; ost < 10; ++ost) {
        if (ost != (i + 1) % k) {
          cnt[i + 1][ost] = cnt[i][ost];
        }
      }
    } else {
      for (int ost = 0; ost < 10; ++ost) {
        cnt[i + 1][ost] = cnt[i][ost];
      }
    }
    pref.push_back(sB);
  }
  for (int i = 0; i < w; ++i) {
    int l, r;
    scanf("%d%d", &l, &r);
    int good = how_many(l, r);
    int must = (r - l) / k + 1;
    int is = sumq(l, r);
    printf("%d\n", is - good + must - good);
  }
  return 0;
}
