#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
# piles3: list[list[int]] = [[] for i in range(M)] # pile -> tick when will fall for each snowflake


def get_real_val(val, index, len):
    return val - (len-index-1)

# for i in range(len(piles)):
#     for j in range(len(piles[i])-1, -1, -1):
#         invj = len(piles[i])-j-1
#         print("ij", piles[i][j], "j", j, "invj", invj)
#         real_val = piles[i][j] - (len(piles[i])-j-1)
#         piles3[i].append(get_real_val(piles[i][j], j, len(piles[i])))

# print(piles)
# print(piles2)
# print(piles3)


def bisect_right(a, x, lo=0, hi=None, *, key=None):
    """Return the index where to insert item x in list a, assuming a is sorted.

    The return value i is such that all e in a[:i] have e <= x, and all e in
    a[i:] have e > x.  So if x already appears in the list, a.insert(i, x) will
    insert just after the rightmost x already there.

    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.

    A custom key function can be supplied to customize the sort order.
    """

    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    # Note, the comparison uses "<" to match the
    # __lt__() logic in list.sort() and in heapq.
    while lo < hi:
        mid = (lo + hi) // 2
        #print("x", x, "inarr", a[mid], "real", get_real_val(a[mid], mid, len(a)))
        if x < get_real_val(a[mid], mid, len(a)):
            lo = mid + 1
        else:
            hi = mid
    #return lo
    return len(a)-lo

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(piles)):
        pile = piles[pile_idx]

        found = find_le(pile, time) + 1
        #print("found", found)

        total_snowflakes += found

    print(total_snowflakes)
