Little Elephant from the Zoo of Lviv has a board with 2 rows and M columns. Each cell of the board must be painted in one of three colors: red, green, or blue.
The board is called magical if and only if it has the following properties:
-
No two adjacent cells share the same color. (Two cells are adjacent if they share an edge.)
-
Every 2x2 block contains at least one cell of each of the three colors.
You are given four ints M, R, G and B. Let X be the total number of different magical boards with 2 rows and M columns that contain exactly R red cells, G green cells, and B blue cells. Return the value (X modulo 1,000,000,007).