#include <cstdio>

using namespace std;

const int MAX_K = 1000100;
char bridge[MAX_K];

void solve() {
  int m, n, k;
  scanf("%d%d%d\n", &n, &m, &k);
  fgets(bridge, MAX_K, stdin);
  int first_leg_pos, last_leg_pos;
  first_leg_pos = n - 1;
  last_leg_pos = 0;
  int plank_count = n;
  long long result = 0;
  while (first_leg_pos < k - 1) {
    if (first_leg_pos >= last_leg_pos + m  - 1) {
      printf("IMPOSSIBLE\n");
      return;
    }
    while (first_leg_pos < last_leg_pos + m - 1 &&
           first_leg_pos < k - 1) {
      first_leg_pos++;
      if (bridge[first_leg_pos] == '1')
        plank_count++;
    }
    while (plank_count > n) {
       if (bridge[last_leg_pos] == '1')
         plank_count--;
       last_leg_pos++;
    }
    while (bridge[last_leg_pos] == '0') {
      last_leg_pos++;
    }
    result += n;
  }
  result += k - m;
  printf("%lld\n", result);
}

int main(void) {
  int t;
  scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}
