Problem:
Score : 300 points

Problem Statement

Given an integer N, find the base -2 representation of N.

Here, S is the base -2 representation of N when the following are all satisfied:

S is a string consisting of 0 and 1.

Unless S = 0, the initial character of S is 1.

Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N.

It can be proved that, for any integer M, the base -2 representation of M is uniquely determined.

Constraints

Every value in input is integer.

-10^9 \leq N \leq 10^9

Input

Input is given from Standard Input in the following format:

N

Output

Print the base -2 representation of N.

Sample Input 1

-9

Sample Output 1

1011

As (-2)^0 + (-2)^1 + (-2)^3 = 1 + (-2) + (-8) = -9, 1011 is the base -2 representation of -9.

Sample Input 2

123456789

Sample Output 2

11000101011001101110100010101

Sample Input 3

0

Sample Output 3

0

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using static System.Console;
using static PB10004.Algorithm.Util;

namespace PB10004.Algorithm
{
    class Template
    {
        static void Main(string[] args)
        {
            new C().Solve();
        }
    }
    class A
    {
        public void Solve()
        {
            var array = ReadLongArray();
            var N = array[0];
            var K = array[1];
            WriteLine(N%K==0?0:1);
        }
    }
    class B
    {
        public void Solve()
        {
            var N = ReadInt();
            if(N < 4)
            {
                WriteLine("No");
                return;
            }
            for (int i = 0; i <= 25; i++)
            {
                for (int j = 0; j <= 14; j++)
                {
                    if (4 * i + 7 * j == N)
                    {
                        WriteLine("Yes");
                        return;
                    }
                }
            }
            WriteLine("No");
        }
    }
    class C
    {
        public void Solve()
        {
            var N = ReadLong();
            var res = "";
            if(N == 0)
            {
                WriteLine(0);
                return;
            }
            while(Math.Abs(N) >= 1)
            {
                var t = N;
                if(t < 0)
                    N = -(long) Math.Floor(1.0 * N/2);
                else
                    N = -(long) Math.Floor(1.0 * N / 2);
                var r = t%2==0?0:1;
                res = r.ToString() + res;
            }
            if (res[0] == '0') res = res.Substring(1, res.Length-1);
            WriteLine(res);
        }
    }
    class D
    {
        public void Solve()
        {
            var array = ReadLongArray();
            var N = array[0];
            var M = array[1];
            var nums = ReadLongArray();
            var cums = CumulativeSum(nums).ToArray();
            long count = 0;
            for (int i = 1; i < N+1; i++)
            {
                for (int j = i; j < N+1; j++)
                {
                    if((cums[j] - cums[i-1]) % M == 0)
                    {
                        count++;
                    }
                }
            }
            WriteLine(count);
        }
    }
    public static class Util
    {
        /// <summary>
        /// 標準入力をint型にパースする
        /// </summary>
        /// <returns></returns>
        public static int ReadInt()
        {
            return int.Parse(ReadLine());
        }
        /// <summary>
        /// 標準入力をint型の配列にする
        /// </summary>
        /// <returns></returns>
        public static int[] ReadIntArray()
        {
            return ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        }
        /// <summary>
        /// 標準入力をlong型にパースする
        /// </summary>
        /// <returns></returns>
        public static long ReadLong()
        {
            return long.Parse(ReadLine());
        }
        /// <summary>
        /// 標準入力をlong型の配列にする
        /// </summary>
        /// <returns></returns>
        public static long[] ReadLongArray()
        {
            return ReadLine().Split(' ').Select(long.Parse).ToArray();
        }
        /// <summary>
        /// 一定値の数列を生成する
        /// </summary>
        /// <param name="value"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        public static IEnumerable<long> ConstSeq(long value, long length)
        {
            for (int i = 0; i < length; i++)
            {
                yield return value;
            }
        }
        /// <summary>
        /// int配列の累積和を求める
        /// </summary>
        /// <param name="array"></param>
        /// <returns></returns>
        public static IEnumerable<int> CumulativeSum(IEnumerable<int> array)
        {
            int tmp = 0;
            foreach (var num in array)
                yield return tmp += num;
        }
        /// <summary>
        /// long配列の累積和を求める
        /// </summary>
        /// <param name="array"></param>
        /// <returns></returns>
        public static IEnumerable<long> CumulativeSum(IEnumerable<long> array)
        {
            long tmp = 0;
            yield return tmp;
            foreach (var num in array)
                yield return tmp += num;
        }
        /// <summary>
        /// 最大公約数をユークリッドの互除法で求める
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static long Gcd(long a, long b)
        {
            return b == 0 ? a : Gcd(b, a % b);
        }
        /// <summary>
        /// 最小公倍数を求める
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static long Lcm(long a, long b)
        {
            return a * b / Gcd(a, b);
        }
    }
}