Problem J
Jumbled String
Jingfei wants to create a nonempty bit string that has the following properties:
-
the subsequence 00 occurs $a$ times,
-
the subsequence 01 occurs $b$ times,
-
the subsequence 10 occurs $c$ times, and
-
the subsequence 11 occurs $d$ times.
However, Jingfei does not know how to create such a string – or whether it is even possible. Could you help her?
Input
The input consists of a single line with four integers $a$, $b$, $c$, and $d$ ($0 \leq a,b,c,d \leq 10^9$).
Output
Output a bit string that satisfies the given requirements. If there are several solutions, output any one of them. If there are no solutions, output “impossible”.
Sample Input 1 | Sample Output 1 |
---|---|
3 4 2 1 |
01001 |
Sample Input 2 | Sample Output 2 |
---|---|
5 0 0 5 |
impossible |