#include <bits/stdc++.h>
using namespace std;
int arr[100013], sm[100013], mm[100013];
int main() {
  int n, x, m, k, a, b;
  char s[100003];
  scanf("%d %d %d %s", &n, &k, &m, s);
  for (int i = 0; i < n; i++) {
    arr[i + 1] = s[i] - '0';
  }
  for (int i = 1; i <= n + 1; i++)
    if (i > k)
      sm[i] = sm[i - k] + arr[i];
    else
      sm[i] = arr[i];
  for (int i = 1; i <= n + 1; i++) mm[i] = mm[i - 1] + arr[i];
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &a, &b);
    int oo = (b - a + 1) / k;
    int s = a - 1;
    int kk = (b - a) / k;
    if (a + (kk + 1) * k - 1 <= b) kk++;
    int e = a + (k * kk) - 1;
    int so = 0;
    int trr = mm[b] - mm[a - 1];
    int va = 0;
    int ex = 0;
    if (b <= k)
      so = arr[b];
    else
      so = sm[e] - sm[s];
    va = abs(oo - so);
    ex = trr - so;
    printf("%d\n", va + ex);
  }
}
