# Arup Guha
# 5/3/2020
# Solution to 2020 FHSPS Problem: Group Assignment

# number of cases
nC = int(input(""))

# Process cases.
for loop in range(nC):

    # Get both strings.
    s1 = input("")
    s2 = input("")

    # Just count if there's a one at each slot.
    cnt = 0
    for i in range(len(s1)):
        if s1[i] == '1' or s2[i] == '1':
            cnt += 1

    # Use integer division to get truncated answer.
    print( (100*cnt)//len(s1) )
