You can build a 4xW rectangle in turn. When you build the next line, the previous line can be in 6 different states:
XXXX (1 - filled)
XX
-XX- (3)
X
For example, if the previous line is (5), you must put two vertical dominoes, and then the next line will be (3):
XXXX
XABX
-AB-
X(W,q) 4xW, q, .
X(W-1,q) 6 q, X(W,q).
X(1,q) (q = 1..6 → 1, 1, 1, 1, 1, ). , W W.
: X(W,1) ( ).