#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, k, w;
int a[maxn], b[10][maxn];
char s[maxn];
int main() {
  cin >> n >> k >> w;
  scanf("%s", s + 1);
  for (int i = 1; i <= k; i++) {
    a[i] += a[i - 1] + s[i] - '0';
    b[i % k][i] = s[i] - '0';
  }
  for (int i = k + 1; i <= n; i++) {
    a[i] += a[i - 1] + s[i] - '0';
    if (s[i] == '0')
      b[i % k][i] += b[i % k][i - k];
    else
      b[i % k][i] += b[i % k][i - k] + 1;
  }
  while (w--) {
    int l = 0, r = 0;
    scanf("%d%d", &l, &r);
    int ans = (a[r] - a[l - 1]) + (r - l + 1) / k -
              2 * (b[r % k][r] - b[r % k][l - 1]);
    cout << ans << endl;
  }
  return 0;
}
