#include <bits/stdc++.h>
using namespace std;
int n, w, k, l[100001], r[100001], sum[100001], ans[11][100001];
char s[100001];
int main() {
  int i, j, ans_1, p = 0, p1, cnt;
  scanf("%d %d %d", &n, &k, &w);
  scanf("%s", s);
  for (i = 1; i <= w; i++) {
    scanf("%d %d", &l[i], &r[i]);
  }
  sum[0] = s[0] - 48;
  for (i = 1; i < n; i++) {
    sum[i] += sum[i - 1] + (s[i] - 48);
  }
  for (i = 1; i <= 10; i++) {
    ans_1 = 0;
    cnt = 0;
    if (i == 1)
      ans_1 = 0;
    else
      ans_1 = sum[i - 2];
    for (j = i + k - 1; j <= n; j = j + k) {
      if (s[j - 1] - 48 == 1)
        cnt--;
      else
        cnt++;
      ans[i][j] = (sum[j - 1] - ans_1) + cnt;
    }
  }
  for (i = 1; i <= w; i++) {
    if (l[i] % k != 0)
      p1 = l[i] % k;
    else
      p1 = k;
    if (l[i] < k)
      printf("%d\n", ans[p1][r[i]] - ans[p1][0]);
    else
      printf("%d\n", ans[p1][r[i]] - ans[p1][l[i] - 1]);
  }
  return 0;
}
