#include #include using namespace std; int main() { int n,m,q; cin >> n >> m >> q; char grid[n][m]; for (int i = 0; i < n; i ++){ for(int j = 0; j < m; j++){ cin >> grid[i][j]; } } int tt[q]; int max_t = 0; for(int i = 0; i < q; i ++){ cin >> tt[i]; max_t = max(max_t,tt[i]); } int offsets[m]; int total_snow_flakes[q]; total_snow_flakes[0] = 0; for (int i = 0; i < m; i ++){ offsets[i] = 0; int x = n-1; while(grid[x][i] == '*' && x >= 0){ offsets[i]++; x--; } total_snow_flakes[0] += offsets[i]; } //cout << "total snow flaskes at step: " << 0 << "; "<< total_snow_flakes[0] << endl; for(int t = 1; t < max_t+1; t++){ total_snow_flakes[t] = total_snow_flakes[t-1]; for(int i = 0; i < m; i++){ int j = n-offsets[i]-1; if(j < 0)continue; offsets[i] ++; if(grid[j][i] == '*') total_snow_flakes[t] ++; int x = j-1; while(x>= 0 && grid[x][i] == '*'){ offsets[i]++; x--; total_snow_flakes[t] ++; } } } for(int i = 0; i < q; i ++){ cout << total_snow_flakes[tt[i]] << endl; } }