import sys



n = int(sys.stdin.readline().rstrip())



def base_convert(n, base):

    res = []

    b = abs(base)

    while n:

        q, r = divmod(n, b)

        res.append(r)

        n = b * q // base

    try:

        return int(''.join(list(map(str, res)))[::-1])

    except:

        return 0



def main():

    return base_convert(n, -2)



if __name__ == '__main__':

    ans = main()

    print(ans)
import sys



n = int(sys.stdin.readline().rstrip())



def base_convert(n, b):

    res = ''

    while n:

        r = abs(n % b)

        res = str(r) + res

        n = (n - r) // b



    return int(res) if res else 0



def main():

    return base_convert(n, -2)



if __name__ == '__main__':

    ans = main()

    print(ans)
import sys

n = int(sys.stdin.readline().rstrip())


def base_convert(n, base):
    res = []
    b = abs(base)
    while n:
        q, r = divmod(n, b)
        res.append(r)
        n = b * q // base
    try:
        return int("".join(list(map(str, res)))[::-1])
    except:
        return 0


def main():
    return base_convert(n, -2)


if __name__ == "__main__":
    ans = main()
    print(ans)

import sys

n = int(sys.stdin.readline().rstrip())


def base_convert(n, b):
    res = ""
    while n:
        r = abs(n % b)
        res = str(r) + res
        n = (n - r) // b
    return int(res) if res else 0


def main():
    return base_convert(n, -2)


if __name__ == "__main__":
    ans = main()
    print(ans)

-def base_convert(n, base): -    res = [] -    b = abs(base) +def base_convert(n, b): +    res = "" -        q, r = divmod(n, b) -        res.append(r) -        n = b * q // base -    try: -        return int("".join(list(map(str, res)))[::-1]) -    except: -        return 0 +        r = abs(n % b) +        res = str(r) + res +        n = (n - r) // b +    return int(res) if res else 0