A = ["x"]*N
for a, b in zip(S, C):
    if A[a-1] == "x":
        A[a-1] = b
    else:
        if b == A[a-1]:
            A[a-1] = b
        else:
            print(-1)
            exit()

if N != 1 and A[0] == "x":
    A[0] = 1

if A[0] == "x":
    if N != 1:
        print(-1)
        exit()
if A[0] == 0 and N != 1:
    print(-1)
    exit()

for a in range(N):
    if A[a-1] == "x":
        A[a-1] = 0
for a in A:
    print(a, end="")