a = input() b = input() n, m = len(a), len(b) if n < m: a, b = b, a n, m = m, n a = a[::-1] b = b[::-1] ans = 0 for i in range(n): if i < m: aa, bb = int(a[i]), int(b[i]) ans += ((aa + bb) % 2) * pow(2, i) else: aa = int(a[i]) ans += aa * pow(2, i) print(ans)