
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("")))

heights = [N for _ in range(M)]
last_t = 0
final = 0
for t in T:
    res, heights = calc(N, M, field, t-last_t, heights)
    final += res
    last_t = t
    print(final)
    #print("-"*32)
    #print(heights)
    #print("-"*32)


