OnlineJudge 3 现已推出。点此体验新版：Wooden Blocks | SDUT OnlineJudge
Time Limit: 1000 ms Memory Limit: 65536 KiB
Your program will be tested on one or more test cases. Each test case is specified on a separate input line. Each piece is specified using the digit associated with it as in the previous figure. An arrangement is specified by listing its digits with no spaces between the digits. Each arrangement will have at least one piece, but no more than 10,000 pieces.
The last line in the input file will have a single 0. That line is not part of the test cases.
142 1587862 132 143 0
1. VALID 2. VALID 3. NOT 4. NOT