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

int main() {
    int n, m ,q;
    scanf("%d %d %d\n",&n,&m,&q);

    char *grid = malloc(m*n);

    for(int nn = 0; nn < n; nn++) {
        for (int mm = 0; mm < m; mm++) {
            grid[nn*m+mm] = getchar();
        }
        getchar(); // newline
    }
    int t[q];

    int tmax = 0;
    
    for (int qq = 0; qq < q; qq++)
    {
        int time;
        scanf("%d", &time);
        t[qq]=time;
        if (time > tmax ) {
            tmax = time;
        }
    }
    int ti=0;
    int results[q-1];
    for (int i = 0; i <= tmax; i++) {
        
        for (int asked =0; asked < q; asked++){
            int res = 0;
            if (t[asked]==i) {
                // count
                for (int mm = 0; mm < m; mm++) {
                    for (int nn = n-1; nn >= 0; nn--){
                        if (grid[nn*m+mm]=='.'){
                            break;
                        }
                        res++;
                    }
                }

                // printf("%d\n", res);
                ti++;
                // printf("time %d found in time %d for time %d\n", asked, t[asked], i);
                results[asked] = res;
            }
        // }

        // falling 
        for (int nn = n-1; nn > 0;nn--) {
            for (int mm = 0; mm < m; mm++) {
                if (grid[nn*m+mm] == '.'  && grid[(nn-1)*m+mm] == '*'){
                    grid[nn*m+mm] = '*';
                    grid[(nn-1)*m+mm] = '.';
                }
            }
        } 
    }
    for (int i = 0; i < q; i++){
        printf("%d\n",results[i]);
    }
    free(grid);
    return 0;
}