QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 32 MB Total points: 100

#11496. Cipher

الإحصائيات

Notice: task description has been slightly modified with regard to original version from competition, to allow sending programs instead of output files.

We are given a sequence of positive integers $a_i$ (for $i = 1, 2, \ldots, n$). This sequence is used to encrypt n-bit messages. If we have a message consisting of consecutive bits$(t_1, \ldots, t_n)$ ($t_i$ is either $0$ or $1$), then its encryption it the number.

$$S = t_1a_1 + t_2a_2 + \ldots + t_na_n$$

You are given encrypted messages and sequences of numbers ($a_i$), that have been used to encrypt the messages. Your task is to decrypt the encrypted messages and to save them in particular files. You are not expected to present any program. It is sufficient that you write the decrypted messages.

Input

In the first line of the standard input there is one integer $n$, $5 \le n \le 40$. In the successive $n$ lines there is a sequence of numbers ($a_i$) written: in the line of number $i+1$ there is one positive integer $a_i$. The sum of the numbers $a_i$ does not exceed $2\,000\,000\,000$. In the line of number $n+2$ there is one integer $S$ - the encrypted message, $0 \le S \le a_1 + a_2 + \ldots + a_n$.

Output

In the first line of standard output you should write the successive numbers $t_i$, without any spaces between them. The test data were chosen so that the encrypted messages are unambiguously determined.

Example

Input

24
19226985
123697
67356296
19721773
1113273
69335448
23680077
9029881
85168664
93676782
5253843
77616588
78572630
13375812
17199980
101508862
59248276
3505733
35790095
62028546
85726819
56462819
103373994
91757169
667509506

Output

110001000101101100010101

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.