- Time limit: 1.00 s
- Memory limit: 512 MB
You are given an grid representing the map of a forest. Each square is either empty or contains a tree. The upper-left square has coordinates , and the lower-right square has coordinates .
Your task is to process queries of the form: how many trees are inside a given rectangle in the forest?
Input
The first input line has two integers and : the size of the forest and the number of queries.
Then, there are lines describing the forest. Each line has characters: .
is an empty square and *
is a tree.
Finally, there are lines describing the queries. Each line has four integers , , , corresponding to the corners of a rectangle.
Output
Print the number of trees inside each rectangle.
Constraints
Example
Input:
4 3 .*.. *.** **.. **** 2 2 3 4 3 1 3 1 1 1 2 2
Output:
3 1 2