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
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 missingdays <missingdays@missingdays>
#
# Distributed under terms of the MIT license.

"""

"""
def read_list():
    return [int(i) for i in input().split()]
def new_list(n):
    return [0 for i in range(n)]
def new_matrix(n, m=0):
    return [[0 for i in range(m)] for i in range(n)]


m = 2005

h, w = read_list()

d = []
for i in range(h):
    d.append(input())

ver = new_matrix(m, m)
hor = new_matrix(m, m)

for j in range(h):
    for i in range(w):
        hor[i+1][j+1] = hor[i+1][j] + hor[i][j+1] - hor[i][j]
        ver[i+1][j+1] = ver[i+1][j] + ver[i][j+1] - ver[i][j]

        if d[j][i] == ".":
            if i < w-1 and d[j][i+1] == ".":
                hor[i+1][j+1] += 1
            if j < h-1 and d[j+1][i] == ".":
                ver[i+1][j+1] += 1


n = int(input())

for i in range(n):
    y1, x1, y2, x2 = read_list()

    x1 -= 1
    y1 -= 1

    answ = 0
    answ += (hor[x2-1][y2] - hor[x1][y2] - hor[x2-1][y1] + hor[x1][y1])
    answ += (ver[x2][y2-1] - ver[x1][y2-1] - ver[x2][y1] + ver[x1][y1])

    print(answ)
