integer(8) :: i,j,k,m,n,nn,ans(1000)=0,ii
read*, n

if(n==0)then
  print"(i0)",0
  stop
endif

nn=n
i = 1
ii = 1

do while(nn/=0)
  if(mod(nn,-2*ii)/= 0)then
    ans(i) = 1
    nn = nn - ii
  endif
  i=i+1
  ii = ii * (-2)
end do

print"(1000(I0))", ans(i-1:1:-1)

end
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEans = internal global [1000 x i64] zeroinitializer
@_QQcl.300aedbb21d24808ec9a8540f0983cb6 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5677/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQcl.28313030302849302929 = linkonce constant [10 x i8] c"(1000(I0))"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i64, align 8
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.300aedbb21d24808ec9a8540f0983cb6, i32 2)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 8)
  %5 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %6 = load i64, ptr %2, align 8, !tbaa !3
  %7 = icmp eq i64 %6, 0
  br i1 %7, label %8, label %.lr.ph

8:                                                ; preds = %0
  %9 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.300aedbb21d24808ec9a8540f0983cb6, i32 5)
  %10 = call i1 @_FortranAioOutputInteger32(ptr %9, i32 0)
  %11 = call i32 @_FortranAioEndIoStatement(ptr %9)
  %12 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

.lr.ph:                                           ; preds = %0, %18
  %.017 = phi i64 [ %.1, %18 ], [ %6, %0 ]
  %.0916 = phi i64 [ %.neg12, %18 ], [ 1, %0 ]
  %.01015 = phi i64 [ %19, %18 ], [ 1, %0 ]
  %.neg12 = mul i64 %.0916, -2
  %13 = srem i64 %.017, %.neg12
  %.not13 = icmp eq i64 %13, 0
  br i1 %.not13, label %18, label %14

14:                                               ; preds = %.lr.ph
  %15 = add i64 %.01015, -1
  %16 = getelementptr [1000 x i64], ptr @_QFEans, i64 0, i64 %15
  store i64 1, ptr %16, align 8, !tbaa !3
  %17 = sub i64 %.017, %.0916
  br label %18

18:                                               ; preds = %14, %.lr.ph
  %.1 = phi i64 [ %17, %14 ], [ %.017, %.lr.ph ]
  %19 = add i64 %.01015, 1
  %.not = icmp eq i64 %.1, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %18
  %20 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28313030302849302929, i64 10, ptr null, i32 -1, ptr nonnull @_QQcl.300aedbb21d24808ec9a8540f0983cb6, i32 22)
  %21 = add i64 %.01015, -1
  %22 = call i64 @llvm.smax.i64(i64 %.01015, i64 0)
  %23 = getelementptr [1000 x i64], ptr @_QFEans, i64 0, i64 %21
  store ptr %23, ptr %1, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 8, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 10, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !7
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 %22, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  store i64 -8, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %24 = call i1 @_FortranAioOutputDescriptor(ptr %20, ptr nonnull %1)
  %25 = call i32 @_FortranAioEndIoStatement(ptr %20)
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

declare i1 @_FortranAioOutputDescriptor(ptr, ptr) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #0

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
