Jesse and Walter recently got a into a problem. They need to check if a compound can be converted to the other one.
A compound is decoded into a binary strings of 0s and 1s. They have 2 binary strings. First string contains characters
'0', '1' and '?', whereas second contains '0' and '1' only. As Jesse and Walter are busy cooking meth, they need your
help. 

For each case, you need to calculate number of steps needed to convert first compound to second. You can perform the
following operations:

Change '0' to '1'

Change '?' to '0' or '1'

Swap any two characters

Input:

First Line of the Input contains T, denoting number of test cases.
Then for each test case, there are two lines containg 2 strings denoting the compounds.

Output:

For each test case
Print minimum number of steps needed to convert 1st compound to the 2nd in seperate lines. 
If it is not possible, output -1.

Constraints:

1 ≤ Length of strings ≤ 100
Register for IndiaHacksSAMPLE INPUT
3
01??00
001010
01
10
110001
000000

SAMPLE OUTPUT
Case 1: 3
Case 2: 1
Case 3: -1

Register for IndiaHacks
'''
https://www.hackerearth.com/nit-calicut-codeburst-50/algorithm/compound-conversion-1/
'''

T = int(input())
negative_infinity = float("-inf")
postive_infinity = float("inf")
for tc in xrange(T):
    first = raw_input().strip()
    second = raw_input().strip()
    if len(first) != len(second):
        print(-1)
    else :
        non_matching_tuple_list = [(first[i], second[i]) for i in xrange(len(first)) if first[i] != second[i]]
        # count the number of 1s in the first list, it should be < num(0) +num(?)
        num1, num0, numQ_1, numQ_0 = 0,0,0,0
        for tup in non_matching_tuple_list:
            if tup[0] == '1':
                num1 += 1
            elif tup[0] == '0':
                num0 += 1
            else :
                if tup[1] == '1':
                    numQ_1 += 1
                else :
                    numQ_0 += 1


        if num1 > num0 + numQ_1 :
            print('Case {}: {}'.format(tc+1, -1))
        else :
            score = 0
            that_can_be_toggled = num0 + numQ_1 + numQ_0
            if num1 >= num0 :
                score = num0 + (num1 - num0)*2
                that_can_be_toggled -= num1
                score += that_can_be_toggled
            else :
                score = num1
                that_can_be_toggled -= num1
                score += that_can_be_toggled


            print('Case {}: {}'.format(tc+1, score))