#include <bits/stdc++.h>
using namespace std;
int const lim = 1e6;
int inp[lim + 3], h[lim + 3], b[lim + 3];
int dp[lim + 3];
string s;
int n, k, w;
int solve(int i) {
  if (i >= s.size()) return 0;
  int ret = 0;
  if (i + k - 1 < s.size() && s[i + k - 1] != '1') ret++;
  for (int j = i; j < i + k - 1; j++)
    if (s[j] == '1') ret++;
  return dp[i] = solve(i + k) + ret;
}
int main() {
  cin >> n >> k >> w;
  cin >> s;
  for (int i = 0; i < k; i++) solve(i);
  while (w--) {
    int l, r;
    scanf("%d%d", &l, &r);
    l--;
    r--;
    printf("%d ", dp[l] - dp[r + 1]);
  }
}
