#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double EPS = 1e-7;
const int MAX_N = 100000;
const int MAX_W = 100000;
int N, K, W;
char data[MAX_N + 5];
vector<vector<int> > v;
int psum[MAX_N + 5];
int main() {
  scanf("%d %d %d", &N, &K, &W);
  scanf("%s", data);
  psum[0] = data[0] - '0';
  for (int(i) = (1), (_batas) = (N - 1); (i) <= (_batas); (i)++)
    psum[i] = psum[i - 1] + (data[i] - '0');
  v.resize(K);
  for (int(mod) = 0, (_batas) = (K); (mod) < (_batas); (mod)++) {
    v[mod].reserve((N - mod) / K + 5);
    for (int i = mod; i < N; i += K) {
      v[mod].push_back(data[i] - '0');
    }
    for (int(i) = (1), (_batas) = (((int)(v[mod]).size()) - 1); (i) <= (_batas);
         (i)++)
      v[mod][i] += v[mod][i - 1];
  }
  for (int(_) = 0, (_batas) = (W); (_) < (_batas); (_)++) {
    int l, r;
    scanf("%d %d", &l, &r);
    l--, r--;
    int firstIdx = (l + K - 1);
    int fromIdx = (r - firstIdx + 1);
    int banyak = (fromIdx) / K;
    if (K != 1) banyak++;
    int mod = firstIdx % K;
    int modStartKe = (firstIdx - mod) / K;
    int modEndKe = modStartKe + banyak - 1;
    int mod1 =
        v[mod][modEndKe] - (modStartKe == 0 ? 0 : v[mod][modStartKe - 1]);
    int all1 = psum[r] - (l == 0 ? 0 : psum[l - 1]);
    int cost = banyak - mod1;
    int satudiluar = all1 - mod1;
    cost += satudiluar;
    printf("%d\n", cost);
  }
  return 0;
}
