n = int(eval(input()))

print(((n+1) &- (n+1)))
n = int(eval(input())) + 1

print((n &- n))
n = int(eval(input()))
print(((n + 1) & -(n + 1)))

n = int(eval(input())) + 1
print((n & -n))

-n = int(eval(input())) -print(((n + 1) & -(n + 1))) +n = int(eval(input())) + 1 +print((n & -n))