{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\n \u003ch1\u003e\u003c/h1\u003e\n \u003cp\u003eThere are twelve types of tiles in Fig. 1. You were asked to fill a table with \u003cvar\u003eR × C\u003c/var\u003e cells with these tiles. \u003cvar\u003eR\u003c/var\u003e is the number of rows and \u003cvar\u003eC\u003c/var\u003e is the number of columns.\u003c/p\u003e\n \u003cp\u003eHow many arrangements in the table meet the following constraints?\u003c/p\u003e\n \u003cul\u003e\n \u003cli\u003e\u003cp\u003eEach cell has one tile.\u003c/p\u003e\u003c/li\u003e\n \u003cli\u003e\u003cp\u003ethe center of the upper left cell (1,1) and the center of the lower right cell (\u003cvar\u003eC\u003c/var\u003e, \u003cvar\u003eR\u003c/var\u003e) are connected by some roads.\u003c/p\u003e\u003c/li\u003e\n \u003c/ul\u003e\n \u003cp\u003e\u003c/p\u003e\n \u003ccenter\u003e\n \u003cimg src\u003d\"CDN_BASE_URL/9392f63337d913ac6fe6a5c8f64ce8bf?v\u003d1679361243\" height\u003d\"634\" width\u003d\"926\"\u003e\n \u003c/center\u003e\n \u003cp\u003e\u003c/p\u003e\n \u003cp\u003e\u003c/p\u003e\n \u003ccenter\u003e\n \u003ci\u003eFig. 1: the types of tiles\u003c/i\u003e\n \u003c/center\u003e\n \u003cp\u003e\u003c/p\u003e\n \u003cp\u003e\u003c/p\u003e\n \u003ch2\u003eInput\u003c/h2\u003e\n \u003cp\u003eThe first line contains two integers \u003cvar\u003eR\u003c/var\u003e and \u003cvar\u003eC\u003c/var\u003e \u003cvar\u003e(2 ≤ R × C ≤ 15)\u003c/var\u003e. You can safely assume at least one of \u003cvar\u003eR\u003c/var\u003e and \u003cvar\u003eC\u003c/var\u003e is greater than 1.\u003cbr\u003e\n The second line contains twelve integers, \u003cvar\u003et\u003csub\u003e1\u003c/sub\u003e\u003c/var\u003e, \u003cvar\u003et\u003csub\u003e2\u003c/sub\u003e\u003c/var\u003e, ..., \u003cvar\u003et\u003csub\u003e12\u003c/sub\u003e\u003c/var\u003e \u003cvar\u003e(0 ≤ t\u003csub\u003e1\u003c/sub\u003e + .... + t\u003csub\u003e12\u003c/sub\u003e ≤ 15)\u003c/var\u003e. \u003cvar\u003et\u003csub\u003ei\u003c/sub\u003e\u003c/var\u003e represents the number of the \u003cvar\u003ei\u003c/var\u003e-th tiles you have.\u003c/p\u003e\n \u003ch2\u003eOutput\u003c/h2\u003e\n \u003cp\u003eOutput the number of arrangments in a line.\u003c/p\u003e\n \u003ch2\u003eSample Input 1\u003c/h2\u003e\n \u003cpre\u003e3 3\n4 2 2 0 0 0 0 0 0 0 0 1\n\u003c/pre\u003e\n \u003ch2\u003eOutput for the Sample Input 1\u003c/h2\u003e\n \u003cpre\u003e2\n\u003c/pre\u003e\n \u003ch2\u003eSample Input 2\u003c/h2\u003e\n \u003cpre\u003e3 3\n0 1 1 0 0 0 0 0 0 0 0 7\n\u003c/pre\u003e\n \u003ch2\u003eOutput for the Sample Input 2\u003c/h2\u003e\n \u003cpre\u003e66\n\u003c/pre\u003e\n \u003ch2\u003eSample Input 3\u003c/h2\u003e\n \u003cpre\u003e3 3\n0 0 0 0 0 0 0 0 0 0 0 10\n\u003c/pre\u003e\n \u003ch2\u003eOutput for the Sample Input 3\u003c/h2\u003e\n \u003cpre\u003e1\n\u003c/pre\u003e\n \u003ch2\u003eSample Input 4\u003c/h2\u003e\n \u003cpre\u003e2 4\n0 0 1 1 1 2 0 1 0 0 1 1\n\u003c/pre\u003e\n \u003ch2\u003eOutput for the Sample Input 4\u003c/h2\u003e\n \u003cpre\u003e2012\n\u003c/pre\u003e\n \u003ch2\u003eSample Input 5\u003c/h2\u003e\n \u003cpre\u003e5 2\n0 1 1 1 0 1 2 1 2 0 0 1\n\u003c/pre\u003e\n \u003ch2\u003eOutput for the Sample Input 5\u003c/h2\u003e\n \u003cpre\u003e8512\n\u003c/pre\u003e\n \u003c/body\u003e\n\u003c/html\u003e"}}]}