This page is still under construction.

Parts of this page are still being built. What you see may change.

Binary Sum

Interview

Time limit1sMemory limit128 MB

Summary
Given k, print in binary the sum of all integers from 1 to the largest k-digit binary number.
Level

Medium5 of 10

Topics
Math, Bit manipulation
Solved
No attempts yet

Problem

You want to add up every natural number whose binary representation has at most kk digits.

A natural number is included in the sum when, written in binary, it has kk or fewer digits. In other words, you add every natural number from 11 up to the largest number that fits in kk binary digits.

Given an integer kk, write a program that prints this sum in binary.

Input

The first line contains an integer kk. (1≤k≤1061 \le k \le 10^6)

Output

On the first line, print in binary the sum of every natural number whose binary representation has at most kk digits.

Hint

For example, when k=3k = 3 the natural numbers with at most 33 binary digits are 11 through 77. Their sum is 1+2+3+4+5+6+7=281 + 2 + 3 + 4 + 5 + 6 + 7 = 28, which in binary is 1110011100.

Examples1

  1. Example 1

    Input
    3
    
    Expected output
    11100