#include <bits/stdc++.h>
using namespace std;
void Emsawy() {}
const double PI = acos(-1.0);
const double eps = 1e-10;
const long long mod = 1e9 + 7, oo = 1e9;
int dx[]{1, -1, 0, 0, 1, -1, 1, -1};
int dy[]{0, 0, 1, -1, 1, -1, -1, 1};
vector<vector<pair<int, int> > > adj;
int n, m, k, t, c;
int ar[11][11][100001];
int main() {
  Emsawy();
  while (cin >> n >> k >> m) {
    vector<char> v(n + 1);
    for (int i = 1; i <= n; i++) scanf("\n%c", &v[i]);
    for (int i = 1; i <= k; i++) {
      for (int j = 1; j <= k; j++) {
        ar[i][j][i + j - 1] = v[i + j - 1] - '0';
        for (int r = i + j * 2 - 1; r <= n; r += j) {
          ar[i][j][r] = ar[i][j][r - j] + (v[r] - '0');
        }
      }
    }
    vector<int> cnt(n + 1);
    for (int i = 1; i <= n; i++) {
      cnt[i] = v[i] - '0';
      cnt[i] += cnt[i - 1];
    }
    int l, r;
    while (m--) {
      scanf("%d%d", &l, &r);
      int i = (l - 1) % k + 1;
      int j = k;
      int rng = ar[i][j][r] - ar[i][j][l - 1];
      int ans = cnt[r] - cnt[l - 1];
      ans -= rng;
      ans += ((r - l + 1) / k - rng);
      printf("%d\n", ans);
    }
  }
  return 0;
}
