#include <bits/stdc++.h>
using namespace std;
const int MAX = 100000 + 10;
int n, k, w;
char str[MAX];
int sum[MAX][12];
int get(int l, int r, int k) { return sum[r][k] - sum[l - 1][k]; }
int main() {
  int i, j;
  cin >> n >> k >> w;
  scanf("%s", str + 1);
  for ((i) = (1); (i) <= (n); ++(i)) {
    for ((j) = (0); (j) <= (k); ++(j)) sum[i][j] = sum[i - 1][j];
    if (str[i] == '1') {
      sum[i][i % k]++;
      sum[i][k]++;
    }
  }
  for ((i) = (1); (i) <= (w); ++(i)) {
    int l, r;
    scanf("%d%d", &l, &r);
    int t = get(l, r, (l - 1) % k);
    int ans = get(l, r, k) - t;
    ans += (r - l + 1) / k - t;
    cout << ans << endl;
  }
  return 0;
}
