rows rows and 3 columns is painted with three colours: each cell gets exactly one colour, and no two cells sharing a side (horizontally or vertically) may have the same colour.
Count such colourings. The answer can be large, so return it modulo 10⁹ + 7.rows=1 → 12
Three cells in a row: the first takes any of 3 colours, each next one any of the other 2: 3 · 2 · 2 = 12.
rows=2 → 54
rows=3 → 246
rows=1
12
Run checks the first 3 tests in your browser. Submit checks all 39 tests on the server, hidden ones included.