
def calc(N, M, field, t, heights) -> int:
    #print(t)
    s = 0
    for m in range(M):
        dots = 0
        #print("|"*16)
        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
        
    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:
    found = False
    for it in cache:
        if it <= t:
            res, heights = cache[it]
            cache[t] = calc(N, M, field, t-it, heights.copy())
            print(res + cache[t][0])
            found = True
            break
    if not found:
        cache[t] = calc(N, M, field, t, heights_zero.copy())
        print(cache[t][0])
      

