#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, long long *);
int main() {
  long long int in;
  long long int x = -2;
  char ans[100];
  int i = 0, j;
  int rem;
  scanf("%lld", &in);
  if (in == 0) {
    printf("0\n");
    exit(0);
  }
  while (in != 0) {
    rem = in % -2;
    in /= x;
    if (rem == -1) {
      in++;
      rem = 1;
      ans[i++] = 1;
    } else
      ans[i++] = rem;
  }
  i = i - 1;
  while (ans[i] == 0)
    i--;
  for (; i >= 0; i--) {
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0xfffffffffffffffe,-0x18(%rbp)
ff
movl   $0x0,-0x84(%rbp)
lea    0xea5(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpq   $0x0,-0x10(%rbp)
jne    1184 <main+0x54>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
jmp    1189 <main+0x59>
cmpq   $0x0,-0x10(%rbp)
je     1221 <main+0xf1>
mov    -0x10(%rbp),%rax
mov    $0xfffffffffffffffe,%rcx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0x8c(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
cmpl   $0xffffffff,-0x8c(%rbp)
jne    11fd <main+0xcd>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x8c(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x84(%rbp)
cltq
movb   $0x1,-0x80(%rbp,%rax,1)
jmp    121c <main+0xec>
mov    -0x8c(%rbp),%eax
mov    %al,%cl
mov    -0x84(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x84(%rbp)
cltq
mov    %cl,-0x80(%rbp,%rax,1)
jmp    1189 <main+0x59>
mov    -0x84(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x84(%rbp)
movslq -0x84(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x0,%eax
jne    1259 <main+0x129>
mov    -0x84(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x84(%rbp)
jmp    1230 <main+0x100>
jmp    125e <main+0x12e>
cmpl   $0x0,-0x84(%rbp)
jl     1299 <main+0x169>
movslq -0x84(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%esi
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x84(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x84(%rbp)
jmp    125e <main+0x12e>
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
lea    0xea2(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%rcx
test   %rcx,%rcx
je     122e <main+0xde>
xor    %eax,%eax
mov    $0x1,%r8d
movabs $0x100000000,%rsi
xor    %edi,%edi
nopw   0x0(%rax,%rax,1)
mov    %rcx,%rbx
shr    $0x3f,%rbx
add    %rcx,%rbx
mov    %ebx,%edx
and    $0xfffffffe,%edx
sub    %edx,%ecx
sar    %rbx
xor    %edx,%edx
cmp    $0xffffffff,%ecx
sete   %dl
cmove  %r8d,%ecx
mov    %cl,0x10(%rsp,%rdi,1)
add    $0x1,%rdi
add    %rsi,%rax
sub    %rbx,%rdx
mov    %rdx,%rcx
jne    1190 <main+0x40>
movq   $0x0,0x8(%rsp)
sar    $0x20,%rax
add    $0x1,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xffffffff,%edi
cmpb   $0x0,0xf(%rsp,%rax,1)
lea    -0x1(%rax),%rax
je     11e0 <main+0x90>
test   %edi,%edi
jle    121a <main+0xca>
mov    %eax,%ebx
lea    0xe0a(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsbl 0x10(%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffffffffffff,%rbx
lea    0x1(%rbx),%eax
test   %eax,%eax
jg     1200 <main+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret
lea    0xdd3(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [3 x i8] c"0\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca [100 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i64 -2, i64* %3
store i32 0, i32* %5
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
%9 = load i64, i64* %2
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %0
br label %15
15: ; preds = %41, %14
%16 = load i64, i64* %2
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %42
18: ; preds = %15
%19 = load i64, i64* %2
%20 = srem i64 %19, -2
%21 = trunc i64 %20 to i32
store i32 %21, i32* %7
%22 = load i64, i64* %3
%23 = load i64, i64* %2
%24 = sdiv i64 %23, %22
store i64 %24, i64* %2
%25 = load i32, i32* %7
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %34
27: ; preds = %18
%28 = load i64, i64* %2
%29 = add nsw i64 %28, 1
store i64 %29, i64* %2
store i32 1, i32* %7
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
%32 = sext i32 %30 to i64
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %32
store i8 1, i8* %33
br label %41
34: ; preds = %18
%35 = load i32, i32* %7
%36 = trunc i32 %35 to i8
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
%39 = sext i32 %37 to i64
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %39
store i8 %36, i8* %40
br label %41
41: ; preds = %34, %27
br label %15
42: ; preds = %15
%43 = load i32, i32* %5
%44 = sub nsw i32 %43, 1
store i32 %44, i32* %5
br label %45
45: ; preds = %52, %42
%46 = load i32, i32* %5
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %45
%53 = load i32, i32* %5
%54 = add nsw i32 %53, -1
store i32 %54, i32* %5
br label %45
55: ; preds = %45
br label %56
56: ; preds = %66, %55
%57 = load i32, i32* %5
%58 = icmp sge i32 %57, 0
br i1 %58, label %59, label %69
59: ; preds = %56
%60 = load i32, i32* %5
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %64)
br label %66
66: ; preds = %59
%67 = load i32, i32* %5
%68 = add nsw i32 %67, -1
store i32 %68, i32* %5
br label %56
69: ; preds = %56
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@.str.2 = [3 x i8] c"%d\00"
@str = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca [100 x i8]
%3 = bitcast i64* %1 to i8*
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%6 = load i64, i64* %1
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %14
store i64 0, i64* %1
%12 = shl i64 %26, 32
%13 = ashr exact i64 %12, 32
br label %28
14: ; preds = %0, %14
%15 = phi i64 [ %26, %14 ], [ 0, %0 ]
%16 = phi i64 [ %24, %14 ], [ %6, %0 ]
%17 = srem i64 %16, 2
%18 = trunc i64 %17 to i32
%19 = sdiv i64 %16, -2
%20 = icmp eq i32 %18, -1
%21 = trunc i64 %17 to i8
%22 = select i1 %20, i8 1, i8 %21
%23 = zext i1 %20 to i64
%24 = add nsw i64 %19, %23
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %15
store i8 %22, i8* %25
%26 = add nuw i64 %15, 1
%27 = icmp eq i64 %24, 0
br i1 %27, label %11, label %14
28: ; preds = %11, %28
%29 = phi i64 [ %13, %11 ], [ %30, %28 ]
%30 = add nsw i64 %29, -1
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 0
br i1 %33, label %28, label %34
34: ; preds = %28
%35 = trunc i64 %29 to i32
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %48
37: ; preds = %34
%38 = and i64 %30, 4294967295
br label %39
39: ; preds = %37, %39
%40 = phi i64 [ %38, %37 ], [ %45, %39 ]
%41 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = add nsw i64 %40, -1
%46 = trunc i64 %40 to i32
%47 = icmp sgt i32 %46, 0
br i1 %47, label %39, label %48
48: ; preds = %39, %34
%49 = call i32 @putchar(i32 10)
ret i32 0
}