a = input() b = input() c = "" s = 0 for i in range(min(len(a),len(b))): if a[-i-1] != b[-i-1]: c = "1" + c else: c = "0" + c if len(a) > len(b): c = a[:len(a)-len(b)] + c elif len(a) < len(b): c = b[:len(b)-len(a)] + c for i in range(len(c)): if c[-i-1] == 1: s += 2**i print(s)