Calculating the number of ways from point A to point B on a grid.