Shooting Range
Six Voroshilov shooters decided to enhance their precision and headed to the shooting range. At the range, six targets were set up, and each shooter took a shot at all the targets. Later, they gathered at a bar, where each shooter shared the number of times they hit a target. The bartender remembered these numbers, and the following day, he counted the number of holes in each target. We need to assist the bartender in determining if any of the shooters might have made an error in their report, and to find out how many possible shooting configurations (i.e., which shooter hit which targets) could result in the observed outcomes. It is assumed that no two bullets hit the same hole.
Input
The input file begins with a line for each shooter, indicating the number of hits they claimed during the discussion. The third line records the number of holes in each target.
Output
On the first line, output the number of possible shooting configurations. If there is exactly one configuration, then for each shooter, provide a line where each target is represented by a 0 for a miss and a 1 for a hit.