#include <bits/stdc++.h>
using namespace std;
int DP[15][100005], N, k;
int main() {
  int q, res = 0, l, r, jj, i, j, t;
  string str;
  cin >> N >> k >> q >> str;
  str = "0" + str;
  cout << endl;
  for (int i = 1; i <= k; i++) {
    DP[i][i] = str[i] - '0';
    for (j = i + k; j <= N; j += k) DP[i][j] = DP[i][j - k] + (str[j] - '0');
  }
  for (int i = 1; i <= q; i++) {
    cin >> l >> r;
    res = 0;
    t = 0;
    jj = r % k;
    if (!jj) jj = k;
    res += (r - l + 1) / k - (DP[jj][r] - DP[jj][l - 1]);
    for (j = r - 1; j >= r - k + 1; j--) {
      t++;
      jj = j % k;
      if (j % k == 0) jj = k;
      res += DP[jj][r - t] - DP[jj][l - 1 - t];
    }
    cout << res << endl;
  }
  return 0;
}
