#include <bits/stdc++.h>
using namespace std;
template <typename T, typename L>
bool smax(T &x, L y) {
  return x < y ? (x = y, true) : false;
}
template <typename T, typename L>
bool smin(T &x, L y) {
  return y < x ? (x = y, true) : false;
}
const int MAXN = 1e5 + 15;
int n, k, w;
int ps[MAXN], ps2[MAXN];
string s;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  cerr << "HELLO WORLD :)\n";
  cin >> n >> k >> w >> s;
  for (int i = 0; i < n; i++) ps[i] = s[i] - '0', ps2[i] = s[i] - '0';
  for (int i = n - 1; ~i; i--) ps[i] += ps[i + k];
  for (int i = 1; i < n; i++) ps2[i] += ps2[i - 1];
  while (w--) {
    int l, r;
    cin >> l >> r;
    l--, r--;
    int t = ps2[r] - (l ? ps2[l - 1] : 0);
    int x = ps[l + k - 1] - ps[r + k];
    int ret = t - x;
    ret += (r - l + 1) / k - x;
    cout << ret << '\n';
  }
  return false;
}
