N=int(eval(input()));S=""

while(True):

  if N*N==N:S+=str(N);break

  S+=str(N%2);N=(N-N%2)//(-2)

print((S[::-1]))
N=int(eval(input()));S=""

while 1:

 if N*N==N:S+=str(N);break

 S+=str(N%2);N=(N-N%2)//(-2)

print((S[::-1]))

N = int(eval(input()))
S = ""
while True:
    if N * N == N:
        S += str(N)
        break
    S += str(N % 2)
    N = (N - N % 2) // (-2)
print((S[::-1]))

N = int(eval(input()))
S = ""
while 1:
    if N * N == N:
        S += str(N)
        break
    S += str(N % 2)
    N = (N - N % 2) // (-2)
print((S[::-1]))

-while True: +while 1: