There are twelve types of tiles, numbered through , as shown in Fig. 1. You are given a table (grid) of rows and columns. Your task is to fill the R \times C grid using the available tiles.
An arrangement is valid if all of the following conditions are satisfied:
Each cell is covered by exactly one tile.
The center of the upper-left cell and the center of the lower-right cell (R, C) are connected by the roads on the tiles.

Fig. 1: Types of tiles.
The first line contains two integers and (2 \leq R \times C \leq 15). It is guaranteed that at least one of or is greater than .
The second line contains twelve integers: t_1, t_2, \ldots, t_{12} (0 \leq t_1 + t_2 + \cdots + t_{12} \leq 15), where t_i is the number of available tiles of type .
Output the number of valid arrangements.
Example 1