#include <bits/stdc++.h>
using namespace std;
int n, k, w;
string s;
int sums[100010], p[100010];
int main() {
  cin >> n >> k >> w >> s;
  for (int i = 1; i <= n; i++) {
    sums[i] += sums[i - 1] + s[i - 1] - '0';
    int x = i > k ? p[i - k] : 0;
    int y = i > k ? sums[i - k] : 0;
    p[i] = sums[i - 1] - y + '1' - s[i - 1] + x;
  }
  while (w--) {
    int l, r;
    cin >> l >> r;
    cout << p[r] - p[l - 1] << '\n';
  }
}
