from bisect import bisect_right



line1 = input().strip().split(" ")
N = int(line1[0]) # rows
M = int(line1[1]) # cols
Q = int(line1[2]) # time points

piles: list[list[int]] = [[] for i in range(M)] # pile -> tick when will fall for each snowflake


for i in range(N):
    # tick 0
    snow_line = input().strip()
    for char_idx in range(len(snow_line)):
        if snow_line[char_idx] == "*":
            time_to_fall = N-i-1
            piles[char_idx].append(time_to_fall)

piles2: list[list[int]] = [[] for i in range(M)] # pile -> tick when will fall for each snowflake

for i in range(len(piles)):
    agg = 0
    pile = piles[i]
    for j in range(len(piles[i])-1, -1, -1):
        piles2[i].append(piles[i][j] - agg)
        agg += 1


def find_le(a, x):
    #print("searching", a, x)
    i = bisect_right(a, x)
    if i:
        return i-1
    return -1

for i in range(Q):
    time = int(input().strip())
    #pile_ptrs = [0 for x in range(len(piles))]
    total_snowflakes = 0
    #print("time", time)

    for pile_idx in range(len(piles2)):
        pile = piles2[pile_idx]

        found = find_le(pile, time) + 1

        total_snowflakes += found

    print(total_snowflakes)
