They say "years are like dominoes, tumbling one after the other". But would a year fit into a grid? I don't think so.

Limak is a little polar bear who loves to play. He has recently got a rectangular grid with *h* rows and *w* columns. Each cell is a square, either empty (denoted by '.') or forbidden (denoted by '#'). Rows are numbered 1 through *h* from top to bottom. Columns are numbered 1 through *w* from left to right.

Also, Limak has a single domino. He wants to put it somewhere in a grid. A domino will occupy exactly two adjacent cells, located either in one row or in one column. Both adjacent cells must be empty and must be inside a grid.

Limak needs more fun and thus he is going to consider some queries. In each query he chooses some rectangle and wonders, how many way are there to put a single domino inside of the chosen rectangle?
The first line of the input contains two integers *h* and *w* (1 ≤ *h*, *w* ≤ 500) – the number of rows and the number of columns, respectively.

The next *h* lines describe a grid. Each line contains a string of the length *w*. Each character is either '.' or '#' — denoting an empty or forbidden cell, respectively.

The next line contains a single integer *q* (1 ≤ *q* ≤ 100 000) — the number of queries.

Each of the next *q* lines contains four integers *r*1<sub class="lower-index">*i*</sub>, *c*1<sub class="lower-index">*i*</sub>, *r*2<sub class="lower-index">*i*</sub>, *c*2<sub class="lower-index">*i*</sub> (1 ≤ *r*1<sub class="lower-index">*i*</sub> ≤ *r*2<sub class="lower-index">*i*</sub> ≤ *h*, 1 ≤ *c*1<sub class="lower-index">*i*</sub> ≤ *c*2<sub class="lower-index">*i*</sub> ≤ *w*) — the *i*-th query. Numbers *r*1<sub class="lower-index">*i*</sub> and *c*1<sub class="lower-index">*i*</sub> denote the row and the column (respectively) of the upper left cell of the rectangle. Numbers *r*2<sub class="lower-index">*i*</sub> and *c*2<sub class="lower-index">*i*</sub> denote the row and the column (respectively) of the bottom right cell of the rectangle.
A red frame below corresponds to the first query of the first sample. A domino can be placed in 4 possible ways.
5 8
....#..#
.#......
##.#....
##..#.##
........
4
1 1 2 3
4 1 4 1
1 2 4 5
2 5 5 8
4
0
10
15
7 39
.......................................
.###..###..#..###.....###..###..#..###.
...#..#.#..#..#.........#..#.#..#..#...
.###..#.#..#..###.....###..#.#..#..###.
.#....#.#..#....#.....#....#.#..#..#.#.
.###..###..#..###.....###..###..#..###.
.......................................
6
1 1 3 20
2 10 6 30
2 10 7 30
2 2 7 7
1 7 7 7
1 8 7 8
53
89
120
23
0
2
2 20
.#..................
....................
15
1 3 1 13
1 11 2 14
1 17 1 20
1 2 2 3
1 7 1 10
1 7 2 17
1 4 1 9
2 6 2 8
1 8 2 20
2 7 2 16
1 4 2 16
1 6 1 9
1 4 2 7
1 9 1 20
2 2 2 12
10
10
3
2
3
31
5
2
37
9
37
3
10
11
10
15 3
...
.#.
.#.
.#.
..#
...
.#.
.##
.#.
...
...
.##
..#
.#.
#.#
20
1 1 10 1
2 1 9 3
1 2 15 3
10 2 12 2
4 1 8 1
5 2 8 2
10 1 12 3
11 1 11 3
7 2 14 3
6 2 12 3
8 1 11 2
7 1 9 1
2 1 6 2
6 3 7 3
7 1 10 2
6 1 10 2
1 1 2 2
10 1 15 3
1 1 11 1
9 1 15 1
9
14
12
1
4
1
8
2
5
7
6
2
7
1
4
6
2
11
10
5
7 19
.##.#.#.#....#.#...
.#...##..........#.
..#.........#..#.#.
#.#....#....#......
.#.#.#.#....###...#
.....##.....#......
..........#.#..#.#.
10
2 2 3 10
4 10 5 16
3 3 6 12
2 12 6 14
5 1 5 19
3 11 3 13
4 10 5 17
1 13 4 19
5 3 5 17
4 15 7 19
15
10
43
8
5
1
13
24
4
19
1 1
.
1
1 1 1 1
0
1 1
#
1
1 1 1 1
0
h, w = map(int, input().split())
a = []
b = []
c = []
a.append('#' * (w+1))
for i in range(h):
    a.append('#' + input())
h += 1
w += 1
for i in range(h):
    b.append([0] * w)
    c.append([0] * w)
for i in range(1, h):
    for j in range(1, w):
        b[i][j] = b[i-1][j] + b[i][j-1] - b[i-1][j-1]
        c[i][j] = c[i-1][j] + c[i][j-1] - c[i-1][j-1]
        if a[i][j]+a[i][j-1] == '..':
            b[i][j] += 1
        if a[i][j]+a[i-1][j] == '..':
            c[i][j] += 1

q = int(input())
for i in range(q):
    r1, c1, r2, c2 = map(int, input().split())
    ans = b[r2][c2] - b[r1-1][c2] - b[r2][c1] + b[r1-1][c1]
    ans += c[r2][c2] - c[r1][c2] - c[r2][c1-1] + c[r1][c1-1]
    print(ans)
        
        
        