#include <bits/stdc++.h>
using namespace std;
char s[100005];
int dp[11][100005];
int x[100005];
int main() {
  int n, i, j, l, r, cnt, k, w;
  cin >> n;
  cin >> k >> w;
  cin >> s;
  x[1] = 0;
  for (i = 0; i < k; i++) dp[i][1] = 0;
  if (s[1 - 1] == '1') x[1] = 1, dp[1 % k][1]++;
  for (i = 2; i <= n; i++) {
    if (s[i - 1] == '1')
      x[i] = x[i - 1] + 1;
    else
      x[i] = x[i - 1];
    for (j = 0; j < k; j++) {
      if (j == i % k && s[i - 1] == '1')
        dp[j][i] = dp[j][i - 1] + 1;
      else
        dp[j][i] = dp[j][i - 1];
    }
  }
  while (w--) {
    cin >> l >> r;
    cnt = (x[r] - x[l - 1]) - dp[r % k][r] + dp[r % k][l - 1];
    cnt += (r - l) / k + 1 - dp[r % k][r] + dp[r % k][l - 1];
    cout << cnt << endl;
  }
  return 0;
}
