There is an grid. Each cell is either empty or an obstacle.
Let the bottom-left corner of the grid be and the top-right corner be . Every grid point has integer coordinates.
You are given queries. Each query gives two distinct grid points and .
Find the number of obstacle cells whose interior is crossed by the line segment joining the two points. If the segment only touches an edge or a corner of an obstacle cell without passing through its interior, that cell is not counted.
The input is given in the following format.
For each query, print the number of obstacle cells whose interior is crossed by the segment on its own line.
The grid rows are given from top to bottom. The -th character of represents the cell with and . The character . denotes an empty cell, and # denotes an obstacle cell.
.#