There are n candles on a Hanukkah menorah, and some of its candles are initially lit. We can describe which candles are lit with a binary string s, where the i-th candle is lit if and only if s_i=1.

<image>

Initially, the candle lights are described by a string a. In an operation, you select a candle that is currently lit. By doing so, the candle you selected will remain lit, and every other candle will change (if it was lit, it will become unlit and if it was unlit, it will become lit).

You would like to make the candles look the same as string b. Your task is to determine if it is possible, and if it is, find the minimum number of operations required.

Input

The first line contains an integer t (1≤ t≤ 10^4) — the number of test cases. Then t cases follow.

The first line of each test case contains a single integer n (1≤ n≤ 10^5) — the number of candles.

The second line contains a string a of length n consisting of symbols 0 and 1 — the initial pattern of lights.

The third line contains a string b of length n consisting of symbols 0 and 1 — the desired pattern of lights.

It is guaranteed that the sum of n does not exceed 10^5.

Output

For each test case, output the minimum number of operations required to transform a to b, or -1 if it's impossible.

Example

Input


5
5
11010
11010
2
01
11
3
000
101
9
100010111
101101100
9
001011011
011010101


Output


0
1
-1
3
4

Note

In the first test case, the two strings are already equal, so we don't have to perform any operations.

In the second test case, we can perform a single operation selecting the second candle to transform 01 into 11.

In the third test case, it's impossible to perform any operations because there are no lit candles to select.

In the fourth test case, we can perform the following operations to transform a into b: 

  1. Select the 7-th candle: 100010{\color{red}1}11→ 011101{\color{red} 1}00. 
  2. Select the 2-nd candle: 0{\color{red} 1}1101100→ 1{\color{red} 1}0010011. 
  3. Select the 1-st candle: {\color{red}1}10010011→ {\color{red}1}01101100. 



In the fifth test case, we can perform the following operations to transform a into b: 

  1. Select the 6-th candle: 00101{\color{red}1}011→ 11010{\color{red}1}100 
  2. Select the 2-nd candle: 1{\color{red}1}0101100→ 0{\color{red}1}1010011 
  3. Select the 8-th candle: 0110100{\color{red}1}1→ 1001011{\color{red}1}0 
  4. Select the 7-th candle: 100101{\color{red}1}10→ 011010{\color{red}1}01 
/*
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                    ___/`---'\___
                  .' \\|     |// '.
                 / \\|||  :  |||// \
                / _||||| -:- |||||- \
               |   | \\\  -  /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
             ___'. .'  /--.--\  `. .'___
          ."" '<  `.___\_<|>_/___.' >' "".
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` /  /
     =====`-.____`.___ \_____/___.-`___.-'=====
                       `=---='
 
*/

import java.util.*;
import java.math.*;
import java.io.*;
import java.lang.Math.*;

public class KickStart2020 {
	 static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		float nextFloat() {
			return Float.parseFloat(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	static long gcd(long a, long b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);

	}
	static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}

	public static class Pair implements Comparable<Pair> {
		public int index;
		public int value;

		public Pair(int index, int value) {
			this.index = index;
			this.value = value;
		}

		@Override
		public int compareTo(Pair other) {
			// multiplied to -1 as the author need descending sort order
			if(other.index < this.index) return -1;
			if(other.index > this.index) return 1;
			return 0;
		}
		@Override
		public String toString() {
			return this.index + " " + value;
		}
	}
	static boolean isPrime(long d) {
		if (d == 3)
			return false;
		for (int i = 2; i <= (long) Math.sqrt(d); i++) {
			if (d % i == 0)
				return false;
		}
		return true;
	}
	static void decimalTob(int n, int k, int j, int arr[]) {
          int x = n % k;
          int y = n / k;
          arr[j++] += x;
          if(y > 0) {
        	   decimalTob(y, k, j, arr);
          }
	}
	static long powermod(long x, long y, long mod) {
		long ans = 1;
		x = x % mod;
		if (x == 0)
			return 0;
		int i = 1;
		while (y > 0) {
			if ((y & 1) != 0)
				ans = (ans * x) % mod;
			y = y >> 1;
			x = (x * x) % mod;
		}
		return ans;
	}
	static long power(long x, long y)
	{
	    long res = 1;
	    while (y > 0)
	    {
	        if ((y & 1) != 0)
	            res = res * x;	  
	        y = y >> 1; 
	        x = x * x;  
	    }
	    return res;}
	static int dfs(int i, ArrayList<ArrayList<Integer>> ss, ArrayList<Integer> ssd, ArrayList<Pair> sss, int index) {
		sss.get(i).index = index;
		ssd.add(i);
		for(int e: ss.get(i)) {
			index++;
			index = dfs(e, ss, ssd, sss, index);
		}
		sss.get(i).value = index;
		return index;
	}
	static int search(int l, int r, int n, ArrayList<Integer> ssd) {
		if(l == r) return l;
		int mid = (l + r) / 2;
		if(n <= ssd.get(mid)) return search(l, mid, n, ssd);
		else return search(mid + 1, r, n, ssd);
	}
	public static void main(String[] args) throws Exception {
		FastReader sc = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		int t = sc.nextInt();
		outerloop:
			while(t-- > 0) {
               int n = sc.nextInt();
               String s = sc.next();
               String ss = sc.next();
               int arr[] = new int[2];
               int brr[] = new int[2];
               for(int i = 0; i < n; i++) {
            	   if(s.charAt(i) == ss.charAt(i)) 
            		   arr[s.charAt(i) - '0']++;
            	   else 
            		brr[s.charAt(i) - '0']++;   
               }
               int min = Integer.MAX_VALUE;
               if(brr[0] == brr[1]) min = Math.min(min, 2 * brr[0]);
               if(arr[0] == arr[1] - 1) min = Math.min(min, 2 * arr[0] + 1);
               out.println((min == Integer.MAX_VALUE) ? -1 : min);
             }		
		out.close();
	}
}