#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int a[11][maxn];
int sum[maxn];
int main() {
  string s;
  int n, k, w;
  while (cin >> n >> k >> w) {
    cin >> s;
    int l = s.length();
    sum[0] = 0;
    for (int i = 0; i < l; i++) {
      int j = i + 1;
      sum[j] = sum[i] + (s[i] - '0');
      if (j > k)
        a[j % k][j] = a[j % k][j - k] + (s[i] == '1' ? -1 : 1);
      else
        a[j % k][j] = (s[i] == '1' ? -1 : 1);
    }
    cout << endl;
    int aa, bb;
    while (w--) {
      cin >> aa >> bb;
      int sun = sum[bb] - sum[aa - 1];
      aa--;
      int sux = a[bb % k][bb] - a[aa % k][aa];
      cout << sun + sux << endl;
    }
  }
  return 0;
}
