#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, k, t;
  cin >> n >> k >> t;
  string str;
  cin >> str;
  bool pres[n];
  for (long long i = 0; i < n; i++) pres[i] = (str[i] == '1');
  long long dp[k][n];
  for (long long i = 0; i < k; i++) {
    for (long long j = 0; j < n; j++) dp[i][j] = 0;
  }
  for (long long i = 0; i < k; i++) {
    for (long long j = i; j < n; j++) {
      if (j > 0) dp[i][j] = dp[i][j - 1];
      if ((j - i + 1) % k == 0 && !pres[j]) dp[i][j]++;
      if ((j - i + 1) % k > 0 && pres[j]) dp[i][j]++;
    }
  }
  while (t--) {
    long long l, r;
    cin >> l >> r;
    l--, r--;
    long long cnt = dp[l % k][r] - dp[l % k][l];
    long long temp = l % k;
    if ((l - temp + 1) % k == 0 && !pres[l]) cnt++;
    if ((l - temp + 1) % k > 0 && pres[l]) cnt++;
    cout << cnt << endl;
  }
}
