
def calc(N, M, field, t, heights) -> int:
    #print(t)
    s = 0
    for m in range(M):
        dots = 0
        #print("|"*16)
        if t >= 0: # Upward move
            for n in reversed(range(0, heights[m])):
                #print(f"{n=}")
                c = field[n][m]
                #print(c)
                if c == ".":
                    dots += 1
                    if dots > t:
                        #print("BREAK")
                        heights[m] = n+1
                        break
                    continue
                s += 1
                heights[m] = n
        else: # Downward move
            t = -t
            for n in range(heights[m], N):
                #print(f"{n=}")
                c = field[n][m]
                #print(c)
                if c == ".":
                    dots += 1
                    if dots > t:
                        #print("BREAK")
                        heights[m] = n+1
                        break
                    continue
                s -= 1
                heights[m] = n

        
    return s, heights




N, M, Q = list(map(int, input("").split()))

field = []
for _ in range(N):
    field.append(input(""))

T = []
for _ in range(Q):
    T.append(int(input("")))

cache = {}
heights_zero = [N for _ in range(M)]
for t in T: # Theoretical non optimal order in the cache
    found = False
    biggest = None
    nextBig = False
    for it in cache:
        if it <= t:
            biggest = it
        if it > t:
            nextBig = it
            break # We dont want bigger values

    if biggest or nextBig:
        # Choose between cache up or down
        if nextBig and nextBig - t < t - biggest: #Â Eval downward
            res, heights = cache[nextBig]
            diff = t-nextBig
        elif biggest:
            res, heights = cache[biggest]
            diff = t-biggest

        new_res, new_heights = calc(N, M, field, diff, heights.copy())
        cache[t] = (new_res + res, new_heights)
    else:
        cache[t] = calc(N, M, field, t, heights_zero.copy())
    print(cache[t][0])
      

