import sys #sys.setrecursionlimit(10 ** 6) INF = float('inf') #10**20,2**63に変えるのもあり MOD = 10**9 + 7 MOD2 = 998244353 from collections import defaultdict def ceil(A,B): return -(-A//B) def solve(): def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LC(): return list(input()) def IC(): return [int(c) for c in input()] def MI(): return map(int, sys.stdin.readline().split()) A = IC() B = IC() A.reverse() B.reverse() if(len(A)<len(B)): A += [0]*(max(len(A),len(B))-min(len(A),len(B))) else: B += [0]*(max(len(A),len(B))-min(len(A),len(B))) #print(A,B) N = len(A) C = [0]*N for i in range(len(A)): if(A[i]+B[i]==2): C[i]=0 else: C[i]=A[i]+B[i] Ans = 0 for i in range(N): Ans+=2**i*C[i] print(Ans) return solve()