题目描述
Problem Description
There is a piece of paper with a grid of $H$ rows and $W$ columns. The cell at the $i$-th row from the top and the $j$-th column from the left (denoted as cell $(i, j)$) is referred to as cell $(i, j)$ where $1 \leq i \leq H$ and $1 \leq j \leq W$.
There is a stamp of size $N$ rows and $M$ columns. The impression of this stamp is represented by $N$ strings of length $M$, denoted as $A_1, A_2, ..., A_N$. When the top-left corner of the stamp is aligned with the top-left corner of cell $(s, t)$ (where $1 \leq s \leq H - N + 1$ and $1 \leq t \leq W - M + 1$), pressing the stamp will change the color of each cell $(u, v)$ (where $s \leq u \leq s + N - 1$ and $t \leq v \leq t + M - 1$) as follows:
- If the $j$-th character of string $A_i$ is
#, the color of cell $(s + i - 1, t + j - 1)$ changes to black. - If the $j$-th character of string $A_i$ is
., the color of cell $(s + i - 1, t + j - 1)$ does not change.
Initially, all cells are white. For each $s, t$ satisfying $1 \leq s \leq H - N + 1$ and $1 \leq t \leq W - M + 1$, the top-left corner of the stamp is aligned with the top-left corner of cell $(s, t)$ and the stamp is pressed.
Determine the number of cells whose color has changed to black.
Input Format
The input is given from the standard input in the following format:
$H$ $W$ $N$ $M$ $A_1$ $A_2$ $:$ $A_N$
Output Format
Output the answer.
Sample Input and Output
Sample Input #1
3 4
2 3
..#
##.
Sample Output #1
9
Sample Input #2
5 5
4 4
####
#..#
#..#
####
Sample Output #2
24
Sample Input #3
10 12
1 1
.
Sample Output #3
0
Sample Input #4
20 20
5 5
##.##
.##.#
..##.
...##
....#
Sample Output #4
390
Sample Input #5
1000000000 1000000000
5 4
.#..
....
..#.
.#..
....
Sample Output #5
999999996999999999
Notes/Hints
Constraints
- $1 \leq H, W \leq 10^9$
- $1 \leq N, M \leq 1000$
- $N \leq H$
- $M \leq W$
- $|A_i| = M$ for $1 \leq i \leq N$
- For each $i$, each character in $A_i$ is either
#or.
Sample Explanation 1
The top-left corner of the stamp is aligned with the cells $(1, 1)$, $(1, 2)$, $(2, 1)$, and $(2, 2)$. When the stamp is pressed in this order, the color of each cell changes as shown in the figure below. After pressing the stamp in all positions, there are 9 cells whose color has changed to black. 
Sample Explanation 2
All cells except the middle one turn black.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分