#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#define MAXN 1000000
#define MIN(a,b) ((a) < (b) ? (a) : (b))

char planks[MAXN+10];

void testcase() {
	uint64_t ret;
	int i, j, k, c, b, l, n;
	scanf("%d %d %d\n", &l, &b, &n);
	scanf("%s\n", planks);
	ret = n - b;
	i = 0;
	j = l - 1;
	k = l;
	while(k < n) {
		c = 0;
		for(; k < i + b && k < n; k++) {
			if(planks[k] == '1') {
				c++;
				j = k;
			}
		}
		if(c == 0) {
			printf("IMPOSSIBLE\n");
			return;
		}
		ret += l;
		while(c > 0) {
			i++;
			if(planks[i] == '1') {
				c--;
			}
		}
	}
	printf("%llu\n", ret);
}

int main() {
	int t;
	scanf("%d\n", &t);
	while(t--) testcase();
	return 0;
}
