// Author: Adrian Kuegel

import java.io.*;
import java.util.*;

public class adrian {
	public static void main(String [] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		for (int tc = Integer.parseInt(in.readLine()); tc>0; --tc) {
			StringTokenizer strtok = new StringTokenizer(in.readLine());
			int n = Integer.parseInt(strtok.nextToken());
			int m = Integer.parseInt(strtok.nextToken());
			int k = Integer.parseInt(strtok.nextToken());
			String planks = in.readLine();
			long cnt = 0;
			boolean possible = true;
			int right = n;
			int left = 0;
			while(right < k) {
				int next = Math.min(left + m, k);
				for (int i=next-1; i>=right; --i,--next)
					if (planks.charAt(i) == '1')
						break;
				if (next == right) {
					possible = false;
					break;
				}
				int moved = 1;
				for (int i=next-2; i>=right; --i)
					if (planks.charAt(i) == '1')
						++moved;
				int oldleft = left;
				while(moved-- > 0) {
					++left;
					while(planks.charAt(left) != '1')
						++left;
				}
				cnt += n + left - oldleft;
				right = next;
			}
			System.out.println(possible?cnt-(m-n):"IMPOSSIBLE");
		}
	}
}
