#include <stdio.h>
#include <stdlib.h>

int main() {
    
    int N, M, Q;

    scanf("%d %d %d", &N, &M, &Q);
    char **m = (char**)malloc(N * sizeof(char*));
    for (int i = 0; i < N; i++) {
        getchar();
        m[i] = (char*)malloc(M * sizeof(char));
        for (int j = 0; j < M; j++) {
            scanf("%c", &(m[i][j]));
        }
    }

    int *n = (int*)malloc(Q * sizeof(int));
    for (int i = 0; i < Q; i++) {
        scanf("%d", &(n[i]));
    }

    int k = 0;
    for (int time = 0; time <= n[Q-1] && k < Q; time++) {

        if ( time == n[k] ) {
            int result = 0;
            for (int i = 0; i < M; i++) {
                if ( m[N-1][i] == '*' ) {
                    result++;
                    for (int j = N-2; j >= 0; j--) {
                        if (m[j][i] == '*' ) {
                            result++;
                        }
                        else {
                            break;
                        }
                    }
                }
            }

            printf("%d\n", result);
            k++;
        }

        for (int i = 0; i < M; i++) {
            for (int j = N-2; j >= 0; j--) {
                if (m[j][i] == '*' && m[j+1][i] == '.') {
                    m[j+1][i] = '*';
                    m[j][i] = '.';
                }
            }
        }

    }

    free(n);
    for (int i = 0; i < N; i++) {
        free(m[i]);
    }
    free(m);

    return 0;
}