Məsələlər
Pipeline Plans
Pipeline Plans
There are twelve types of tiles in \textit{\textbf{Fig. 1}}. You were asked to fill a table with \textbf{R}×\textbf{C} cells with these tiles. \textbf{R} is the number of rows and \textbf{C} is the number of columns.
How many arrangements in the table meet the following constraints?
\begin{itemize}
\item Each cell has one tile.
\item the center of the upper left cell (\textbf{1}, \textbf{1}) and the center of the lower right cell (\textbf{C}, \textbf{R}) are connected by some roads.
\end{itemize}
\includegraphics{https://static.e-olymp.com/content/69/6987355e557348b43864bdfad0e35278a4f5ae17.jpg}
\textit{\textbf{Fig. 1}}: the types of tiles
\InputFile
The first line contains two integers \textbf{R} and \textbf{C} (\textbf{2} ≤ \textbf{R}×\textbf{C} ≤ \textbf{15}). You can safely assume at least one of \textbf{R} and \textbf{C} is greater than \textbf{1}.
The second line contains twelve integers, \textbf{t_1}, \textbf{t_2}, ..., \textbf{t_12} (\textbf{0} ≤ \textbf{t_1} + … + \textbf{t_12} ≤ \textbf{15}). \textbf{t_i} represents the number of the \textbf{i}-th tiles you have.
\OutputFile
Output the number of arrangments in a line.
Giriş verilənləri #1
3 3 4 2 2 0 0 0 0 0 0 0 0 1
Çıxış verilənləri #1
2