

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

#print(N, M, Q)


piles: list[list[int]] = [] # pile -> tick when will fall for each snowflake

for i in range(M):
    piles.append([])

snow_lines = []
for i in range(N):
    # tick 0
    line2 = input().strip()
    snow_lines.append(line2)


for line_idx in range(N-1, -1, -1):
    snow_line = snow_lines[line_idx]
    for char_idx in range(len(snow_line)):
        if snow_line[char_idx] == "*":
            line_idx_from_bot = N - line_idx - 1
            time_to_fall = line_idx_from_bot - len(piles[char_idx])
            piles[char_idx].append(time_to_fall) # time when will be added
            #if Q-piles[i]-1 == M: # stihne dopadnout
            #    piles[i]+=1

pile_ptrs = [0 for x in range(len(piles))]

for i in range(Q):
    time = int(input().strip())
    #print("time", time)
    # for each time for each col get first flake that is piled
    # two pointers

    total_snowflakes = 0

    for pile_idx in range(len(piles)):
        pile_snowflakes = 0
        pile = piles[pile_idx]

        # adv index to correct pos
        #print( pile_ptrs[pile_idx], len(pile))
        #print(pile[pile_ptrs[pile_idx]], time)
        while pile_ptrs[pile_idx] < len(pile) and pile[pile_ptrs[pile_idx]] < time:
            #print("a")
            pile_ptrs[pile_idx] += 1

        # equals or too big
        while pile_ptrs[pile_idx] < len(pile) and pile[pile_ptrs[pile_idx]] == time:
            pile_snowflakes = (pile_ptrs[pile_idx])
            #print("time", time, "pile", pile_idx, "snow",pile_snowflakes)
            total_snowflakes += pile_snowflakes
            pile_ptrs[pile_idx] += 1

    print(sum(pile_ptrs))
    #print("pile_ptrs after this time", pile_ptrs)

#print(results)

#for time in times_orig:
#    print(results[time])


