Shooting Range#828

Shooting Range

3 seconds
64 megabytes
Very hard

Six shooters went to the shooting range, where six targets were set up. Each shooter shot at all the targets. Later, they gathered and each shooter stated how many times they hit a target. The next day, the number of holes in each target was counted. Determine if any shooter made a mistake in their report, and find the number of possible shooting configurations that could produce the given results. No two bullets hit the same hole.

Input

The first line contains numbers — the number of hits for each shooter.

The third line contains numbers — the number of holes in each target.

Output

The first line should contain the number of possible shooting configurations.

If there is exactly one configuration, then for each shooter, output numbers — one for each target: 0 (miss) or 1 (hit).

Examples

Example 1

Loading
Loading