### National Olympiad in Informatics, China, 1999

## Day 1, Problem 1 - 01 Sequence

Given 7 positive integers `N`, `A _{0}`,

`B`,

_{0}`L`,

_{0}`A`,

_{1}`B`,

_{1}`L`, determine a 01 sequence

_{1}`S`=

`s`, such that:

_{1}s_{2}… s_{i}… s_{N}`s`= 0 or_{i}`s`= 1 for 1 ≤_{i}`i`≤`N`;- For any of
`S`'s length`L`consecutive subsequence_{0}`s`, the number of 0's must be between_{j}s_{j+1}… s_{j+L0-1}`A`and_{0}`B`, inclusive._{0} - For any of
`S`'s length`L`consecutive subsequence_{1}`s`, the number of 1's must be between_{j}s_{j+1}… s_{j+L1-1}`A`and_{1}`B`, inclusive._{1}

For example, if `N` = 6, `A _{0}` = 1,

`B`= 2,

_{0}`L`= 3,

_{0}`A`= 1,

_{1}`B`= 1,

_{1}`L`= 2, then a sequence that satisfies the above conditions is

_{1}`S`= 010101.

### Input Format

The input will consist of one line with 7 space-separated positive integers, the values `N`, `A _{0}`,

`B`,

_{0}`L`,

_{0}`A`,

_{1}`B`,

_{1}`L`(3 ≤

_{1}`N`≤ 1000, 1 ≤

`A`≤

_{0}`B`≤

_{0}`L`≤

_{0}`N`, 1 ≤

`A`≤

_{1}`B`≤

_{1}`L`≤

_{1}`N`).

### Output Format

The output should consist of one line. If there does not exist a 01 sequence satisfying the above conditions, the output the integer -1. Otherwise, output any 01 sequence that satisfies the conditions.

### Sample Input

6 1 2 3 1 1 2

### Sample Output

010101

All Submissions

Best Solutions

**Point Value:** 20 (partial)

**Time Limit:** 1.00s

**Memory Limit:** 16M

**Added:** May 04, 2014

**Languages Allowed:**

C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

## Comments (Search)

It's quiet in here...