
def calc(N, M, field, t) -> int:
    s = 0
    for m in range(M):
        dots = 0
        for n in reversed(range(N)):
            c = field[n][m]
            #print(c)
            if c == ".":
                dots += 1
                if dots > t:
                    #print("BREAK")
                    break
                continue
            s += 1
        
    return s




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

for t in T:
    print(calc(N, M, field, t))


