#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000001;
const double EPS = 10e-9;
int n, w, k, l, r;
string boxes;
int pref[123456], prefs[123456][12];
int rem(int a, int mod) {
  if (a % mod == 0) return mod;
  return a % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k >> w;
  cin >> boxes;
  for (int i = 1; i <= (n); ++i) {
    pref[i] = pref[i - 1];
    if (boxes[i - 1] == '1') ++pref[i];
  }
  for (int i = 1; i <= (k); ++i) {
    for (int j = i; j <= n; j += k) {
      prefs[j][i] = prefs[max(0, j - k)][i];
      if (boxes[j - 1] == '1') ++prefs[j][i];
      for (int l = 1; l <= (k - 1); ++l) prefs[j + l][i] = prefs[j][i];
    }
  }
  int good, bad, len;
  for (int i = 0; i < (w); ++i) {
    cin >> l >> r;
    good = prefs[r][rem(l - 1, k)] - prefs[l - 1][rem(l - 1, k)];
    bad = pref[r] - pref[l - 1] - good;
    len = (r - l + 1) / k;
    cout << (len - good) + bad << endl;
  }
  return 0;
}
