#include using namespace std; typedef long long ll; typedef pair pi; typedef vector vi; #define sz(x) ((ll)(x).size()) #define all(x) begin(x), end(x) #define rep(i, a, b) for(int i = a; i < (b); ++i) int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cin.exceptions(ios::failbit); int height, width, query_cnt; cin >> height >> width >> query_cnt; vector> snow(height, vector(width, false)); for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { char current; cin >> current; snow.at(y).at(x) = current =='*'; } } vector cnt(height, 0); for (int x = 0; x < width; ++x) { int empty_cnt = 0; for (int y = height -1; y >= 0; --y) { if (snow.at(y).at(x)) { cnt.at(empty_cnt)++; } else { empty_cnt++; } } } vector cum(height, 0); cum.at(0) = cnt.at(0); for (int idx = 1; idx < height; ++idx) { cum.at(idx) = cum.at(idx - 1) + cnt.at(idx); } for (int i = 0; i < query_cnt; ++i) { int q; cin >> q; if (q >= sz(cum)) { int result = cum.back(); cout << result << '\n'; } else { int result = cum.at(q); cout << result << '\n'; } } }