405396: GYM101933 J Jumbled String
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
J. Jumbled Stringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
Recall that a subsequence of a string is any string obtained by removing some subset of characters from the string, for instance "string", "sing", "i" and "sg" are all subsequences of "string". If the same subsequence can be obtained in exactly $$$t$$$ different ways, by removing different subsets of characters, we say that the subsequence occurs $$$t$$$ times.
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.
The input consists of a single line with four integers $$$a$$$, $$$b$$$, $$$c$$$, and $$$d$$$ ($$$0 \leq a,b,c,d \leq 10^9$$$).
OutputOutput 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".
ExamplesInput3 4 2 1Output
01001Input
5 0 0 5Output
impossible