a=int(eval(input()));s=''

while a!=0:s+=str(a%2);a=-(a//2)

print((int(s[::-1]) if s != '' else 0))
a=int(eval(input()));s=''

while a!=0:s=str(a%2)+s;a=-(a//2)

print((s if s != '' else 0))
a = int(eval(input()))
s = ""
while a != 0:
    s += str(a % 2)
    a = -(a // 2)
print((int(s[::-1]) if s != "" else 0))

a = int(eval(input()))
s = ""
while a != 0:
    s = str(a % 2) + s
    a = -(a // 2)
print((s if s != "" else 0))

-    s += str(a % 2) +    s = str(a % 2) + s -print((int(s[::-1]) if s != "" else 0)) +print((s if s != "" else 0))