#include using ll = long long int; using ulli = unsigned long long int; using namespace std; char grid[1000][1000]; ll time_points[100009]; ll snow_time[100009]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll N, M, Q; cin >> N >> M >> Q; for(ll i = 0; i < N; i++){ for(ll j = 0; j < M; j++){ cin >> grid[i][j]; } } for(ll i = 0; i < Q; i++){ cin >> time_points[i]; } ll timestep = 0; ll max_timestep = 0; for(ll j = 0; j < M; j++){ timestep = 0; for(ll i = N-1; i >= 0; i--){ if(grid[i][j] == '*'){ snow_time[timestep]++; } else{ timestep++; } } if (timestep > max_timestep){ max_timestep = timestep; } } // cout << "i = 0" << "; snow_time = " << snow_time[0] << endl; for(ll i = 1; i <= max_timestep; i++){ snow_time[i] += snow_time[i-1]; // cout << "i = " << i << "; snow_time = " << snow_time[i] << endl; } for(ll i = 0; i < Q; i++){ if(time_points[i] > max_timestep){ cout << snow_time[max_timestep] << endl; } else{ cout << snow_time[time_points[i]] << endl; } } // ulli mod_val = 10010101; // ulli ans = 1; // if (N == 0){ // ans = 1; // } // else if(N % 2 == 0){ // for(ulli k = 1; k <= N/2; k++){ // ans *= (2*k % mod_val); // ans %= mod_val; // } // } // else if (N % 2 == 1){ // for(ulli k = 1; k <= (N+1)/2; k++){ // ans *= ((2*k - 1) % mod_val); // ans %= mod_val; // } // } // cout << ans; return 0; }