There is a grid of W columns and H rows. The upper left cell is (1,1): the first coordinate grows to the right and the second coordinate grows downward. You stand on (1,1) and you want to reach (W,H).
From cell (x,y) you may move only to the cell below and to the left (x−1,y+1), the cell directly below (x,y+1), or the cell below and to the right (x+1,y+1).
Some cells hold an obstruction. You cannot move onto an obstructed cell, and you cannot leave the grid. Write a program that prints the number of paths reaching (W,H), modulo 1,000,000,009. The cell (1,1) never holds an obstruction.