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 
# import collections
# import random
# import math
# import itertools
# import math
# import math
#import bisect
# from collections import defaultdict
# import itertools
# from sys import stdin, stdout
# import math
# import math
# import bisect
# import bisect
# import collections
# import itertools
# import math
# import collections
# import itertools
# import math
import bisect
import collections
import math
import sys

# import operator
# from decimal import Decimal

# sys.setrecursionlimit(10**6)





p2D = lambda x: print(*x, sep="\n")


def II(): return int(sys.stdin.buffer.readline())


def MI(): return map(int, sys.stdin.buffer.readline().split())


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def BI(): return sys.stdin.buffer.readline().rstrip()


def SI(): return sys.stdin.buffer.readline().rstrip().decode()


def li(): return [int(i) for i in input().split()]


def lli(rows): return [li() for _ in range(rows)]


def si(): return input()


def ii(): return int(input())


def ins(): return input().split()


# mod = 10**9+7
# fval = [1]
# for i in range(1,200001):
#     x = (fval[-1]*i)%mod
#     fval.append(x)
#
# ifac = [1]*(200001)
# ifac[200000] = pow(fval[200000], -1, mod)
# for i in range(200000-1, 1, -1): ifac[i] = ifac[i+1]*(i+1)%mod
# _________________ For taking Input from the Text Files __________________
# import os.path
#
# if (os.path.exists('input.txt')):
#     sys.stdin = open("input.txt", "r")
#     sys.stdout = open("output.txt", "w")
#     sys.stderr = open("error.txt", "w")

def drank(d, processing, da, rank):
    tmp = 10 ** 9
    if len(d[da]) == 1:
        return 1
    for di in d[da]:
        if processing[di - 1] == 0:
            processing[di - 1] = 1
            tmp = min(tmp, drank(d, processing, di, rank))
            processing[di - 1] = 0
    rank[da - 1] = tmp + 1
    return tmp + 1



def binary_search(n, a):
    l = len(a)
    low = 0
    high = l-1
    while high>=low:
        mid = (high+low)//2
        if a[mid] == n:
            return mid
        elif a[mid]>n:
            high = mid-1
        else:
            low = mid+1
    return -1

is_prime = [True]*(10**6+1)
def primeseive(n):
    is_prime[0] = is_prime[1] = False
    i = 2
    while i*i<=n:
        if is_prime[i] == True:
            for j in range(i*i,n+1,i):
                is_prime[j] = False
        i+=1
#
# m ,n = li()
#     p = [li() for i in range(m)]
#     print(p)
#     a = []
#     if m<n:
#         for i in range(n):
#             z = [p[j][i] for j in range(m)]
#             a.append(max(z))
#         return min(a)
#     else:
#         x = 0

def solve():
    n= ii()
    a = si()
    b = si()
    similar = 0
    onesimilar = 0
    onedisimilar = 0
    for i in range(n):
        if a[i]==b[i]:
            similar+=1
            if a[i]== '1':
                onesimilar += 1
        else:
            if a[i] == '1':
                onedisimilar+=1
    disimilar = n - similar
    zerosimilar = similar - onesimilar
    zerodisimilar = disimilar - onedisimilar
    x = n*100
    y = n*100
    if onesimilar-zerosimilar == 1:
        x = similar
    if onedisimilar == zerodisimilar:
        y = disimilar

    if x == y == n*100:
        return -1
    else:
        return min(x,y)


    print(similar)
    if similar == n:
        return 0
    dissimilar = n - similar
    #for i in range(n):




def main():
    #primeseive(10**6)
    #print(is_prime)

    for _ in range(ii()):
        #si()
        #print(solve(), flush=True)
        sys.stdout.write(str(solve()) + "\n")
    #print(solve())

    #     z += str(ans) + '\n'
    # print(len(ans), ' '.join(map(str, ans)), sep='\n')
    # stdout.write(z)


# for interactive problems
# print("? {} {}".format(l,m), flush=True)
# or print this after each print statement
# sys.stdout.flush()


if __name__ == "__main__":
    main()