import java.util.Scanner;

public class assignment {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int runs = scan.nextInt();
		scan.nextLine();
		
		for (int i=0; i<runs; i++) {
			String s1 = scan.nextLine();
			String s2 = scan.nextLine();
			int total = s1.length();
			
			int num1 = Integer.parseInt(s1, 2);
			int num2 = Integer.parseInt(s2, 2);
			
			int totalOnes = Integer.bitCount(num1 | num2);
			System.out.println((100 * totalOnes) / total);
		}
	}

}
