n = int(eval(input()))

ans = ''

if n == 0:

    ans = '0'

while n!= 0:

    if n % 2 == 0:

        ans = '0' + ans

    else:

        ans = '1' + ans

        n -= 1

    n //= -2

print(ans)
N = int(eval(input()))



t = N

ans = ''

while t != 0:

    q, r = divmod(t, 2)

    ans = str(r) + ans

    t = -q

print((ans if ans else '0'))

n = int(eval(input()))
ans = ""
if n == 0:
    ans = "0"
while n != 0:
    if n % 2 == 0:
        ans = "0" + ans
    else:
        ans = "1" + ans
        n -= 1
    n //= -2
print(ans)

N = int(eval(input()))
t = N
ans = ""
while t != 0:
    q, r = divmod(t, 2)
    ans = str(r) + ans
    t = -q
print((ans if ans else "0"))

-n = int(eval(input())) +N = int(eval(input())) +t = N -if n == 0: -    ans = "0" -while n != 0: -    if n % 2 == 0: -        ans = "0" + ans -    else: -        ans = "1" + ans -        n -= 1 -    n //= -2 -print(ans) +while t != 0: +    q, r = divmod(t, 2) +    ans = str(r) + ans +    t = -q +print((ans if ans else "0"))