#include <bits/stdc++.h>
using namespace std;
int n, k, w;
int c[100005];
int t[10][100005];
int main() {
  cin >> n >> k >> w;
  string s;
  cin >> s;
  c[0] = 0;
  for (int i = 0; i < 10; i++) t[i][0] = 0;
  for (int i = 1; i <= s.size(); i++) {
    c[i] = c[i - 1] + (s[i - 1] - '0');
    t[i % k][(i - 1) / k + 1] = t[i % k][(i - 1) / k] + (s[i - 1] - '0');
  }
  int p, q, a, b, y = 0, dif;
  for (int i = 0; i < w; i++) {
    cin >> p >> q;
    if (k > 1) {
      a = c[q] - c[p - 1];
      p = p - 1;
      b = t[q % k][(q - 1) / k + 1] - (p == 0 ? 0 : t[q % k][(p - 1) / k + 1]);
      dif = (q - p) / k;
      cout << ((dif - b) + (a - b)) << "\n";
    } else {
      b = c[q] - c[p - 1];
      cout << ((q - p + 1) - b) << "\n";
    }
  }
  return 0;
}
