Sanggeun is building a swimming pool in Jeongin's front yard.
The pool site is $w$ columns wide and $h$ rows tall, divided into $1 \times 1$ square cells. A pool consists of $0$ or more hole cells, which will later be filled with water.
Before construction, each cell is either a hole (.) or grass (#). Turning the site into a pool must follow these rules:
Given the initial state of the site, write a program that computes the minimum cost to finish the pool.
The first line contains the number of test cases $T$. ($1 \le T \le 100$)
For each test case, the first line contains the site dimensions $w$ and $h$, separated by a space. ($2 \le w, h \le 50$) The second line contains three integers $d$, $f$, and $b$. ($1 \le d, f, b \le 10000$) The next $h$ lines describe the initial state of the site; each line consists of $w$ characters, where # denotes grass and . denotes a hole.
For each test case, print the minimum cost to finish the pool on its own line.