시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB2000.000%

문제

Bogdan is a fan of riddles and puzzles. He asked his friend Anton to come up with a secret code that Bogdan would then decode.

Anton has decided to use a non-negative integer without extra leading zeroes as a secret code. The code must satisfy the following condition. If you consider any three consecutive digits of it as a three-digit integer, it is divisible by three.

Anton has given all digits of his secret code, as well as possibly some other digits, to Bodgan. He claims that the maximal number satisfying the above condition that can be created out of these digits is the secret code.

Help Bogdan to find out what is the secret code.

입력

Input contains 10 integers: $c_0, \ldots, c_9$, here $c_i$ is the number of digits $i$ that Anton has given to Bogdan ($0 \le c_i \le 100\,000$). The sum of $c_i$ is strictly positive and doesn't exceed $100\,000$.

출력

Output the maximal integer that can be created out of these digits. It must satisfy the condition that an integer formed by any three consecutive digits is divisible by three. It is not required to use all of the given digits. Note that any one-digit or two-digit number automatically satisfies the above condition, because it doesn't have three consecutive digits. The answer must not contain extra leading zeroes: the first digit can be $0$ only if the number is zero, in this case it must be the only digit.

예제 입력 1

1 2 3 0 0 0 0 0 0 0

예제 출력 1

21021

예제 입력 2

1 1 1 1 1 1 1 1 1 1

예제 출력 2

9876543210