#C3596. Grid Sequence Product

    ID: 47040 Type: Default 1000ms 256MiB

Grid Sequence Product

Grid Sequence Product

In this problem, you are given three integers ( m ), ( n ), and ( k ). The next line contains ( k ) integers forming a sequence, and then there are ( m ) lines each containing a string of length ( n ) representing a grid. Although the grid is provided, it does not affect the final computation. Your task is to compute the result defined as: [ \text{result} = \left( \sum_{i=1}^{k} a_i \right) \times k, ] where ( a_1, a_2, \ldots, a_k ) are the elements of the sequence. Print the computed result to standard output.

inputFormat

The first line contains three integers ( m ), ( n ), and ( k ) separated by spaces. The second line contains ( k ) space-separated integers which form the sequence. The following ( m ) lines each contain a string of exactly ( n ) characters representing the grid.

outputFormat

Output a single integer -- the value of ( \left(\sum_{i=1}^{k} a_i\right) \times k ).## sample

5 4 4
2 2 5 5
BCDE
A.CB
.B.A
DECD
EDAB
56

</p>