n, m, q = map(int, input().split())

def printf():
    for f in field:
        print(f)

field = []
for i in range(n):
    inp = input()
    field.append([])
    for j in range(m):
        field[i].append(inp[j])

simulation_finite = False

def simulate():
    global simulation_finite
    global time_now
    time_now += 1
    if simulation_finite:
        count()
        return
    changed=False
    for row in reversed(range(n-1)):
        for col in range(m):
            if row+1 >= n:
                continue
            if field[row][col] == '*':
                if field[row + 1][col] == '.':
                    changed=True
                    field[row + 1][col] = '*'
                    field[row][col] = '.'
    count()
    if not changed:
        simulation_finite = True


count_finite = False
last_count = 0
def count():
    global history_map
    global count_finite
    global last_count
    if count_finite:
        history_map[time_now] = last_count
        return last_count
    cnt = 0
    for col in range(m):
        for row in reversed(range(n)):
            if field[row][col] == '*':
                cnt += 1
            else:
                break
    if simulation_finite:
        count_finite = True
    last_count = cnt
    history_map[time_now] = cnt
    return cnt

time_now = 0
history_map = dict()
total_time_passed = 0
count()
for i in range(q):
    time = int(input())
    # print(history_map)
    while time not in history_map:
        simulate()
    print(history_map[time])
    total_time_passed += time-total_time_passed
