#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
int a[110000];
int sum[110000];
int s[110000];
int main() {
  int n, k, w;
  scanf("%d%d%d", &n, &k, &w);
  for (int i = 1; i <= n; i++) scanf("%1d", &a[i]);
  sum[1] = a[1];
  for (int i = 2; i <= n; i++) sum[i] = sum[i - 1] + a[i];
  for (int i = 1; i <= k; i++) s[i] = a[i];
  for (int i = k + 1; i <= n; i++) s[i] = s[i - k] + a[i];
  while (w--) {
    int l, r;
    scanf("%d%d", &l, &r);
    int x = s[r] - s[l - 1];
    int y = (r - l + 1) / k;
    int z = (sum[r] - sum[l - 1] - x + y - x);
    cout << z << endl;
  }
  return 0;
}
