func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = (int)2e9;   const long long INFL = (long long)9e18;   const int MAXINT = ((~0) ^ (1 << 31));   const long long MAXLL = ((~0) ^ ((long long)1 << 63));   template <class T>   inline T pow2(T a) {     return a * a;   }   template <class T>   inline bool mineq(T& a, T b) {     return (a > b) ? (a = b, true) : false;   }   template <class T>   inline bool maxeq(T& a, T b) {     return (a < b) ? (a = b, true) : false;   }   const int maxn = (int)2222;   ;   char grid[maxn][maxn];   int v[maxn][maxn], h[maxn][maxn], t[maxn][maxn], n, m;   long long ans0() {     long long ans = 0;     for (int i = 2; i < (int)(n); i++) {       ans += (v[i][m] == 0);     }     return ans;   }   long long ans1() {     long long ans = 0;     for (int i = 2; i < (int)(n); i++) {       for (int j = 2; j < (int)(m); j++) {         if (grid[i][j] ==  # ) continue;         ans += (h[i][j] == 0 && v[i][j] == 0);         ans += (h[i][j] == h[n][j] && v[i][j] == 0);         ans += (h[i][j] == 0 && v[i][j] == v[i][m]);         ans += (h[i][j] == h[n][j] && v[i][j] == v[i][m]);       }     }     return ans;   }   long long ans2() {     long long ans = 0;     int up[maxn] = {}, down[maxn] = {};     for (int i = 2; i < (int)(n); i++) {       int l = 2, r;       while (l < m) {         if (grid[i][l] ==  # ) {           l++;           continue;         }         r = l;         while (r < m && v[i][l] == v[i][r]) r++;         for (int j = l; j < (int)(r); j++) {           up[j] = (h[i][j] == 0);           down[j] = (h[i][j] == h[n][j]);           if (j - 2 >= l) ans += up[j] * up[j - 2] + down[j] * down[j - 2];           if (j - 1 >= l) ans += up[j] * down[j - 1] + down[j] * up[j - 1];           if (j != l) up[j] += up[j - 1];           if (j != l) down[j] += down[j - 1];         }         l = r;       }     }     return ans;   }   void pre() {     for (int i = 1; i < (int)(n + 1); i++) {       for (int j = 1; j < (int)(m + 1); j++) {         v[i][j] = v[i][j - 1] + (grid[i][j] ==  # );         h[i][j] = h[i - 1][j] + (grid[i][j] ==  # );       }     }   }   void reversegrid() {     for (int i = 1; i < (int)(n + 1); i++)       for (int j = 1; j < (int)(m + 1); j++) t[j][i] = grid[i][j];     for (int i = 1; i < (int)(m + 1); i++)       for (int j = 1; j < (int)(n + 1); j++) grid[i][j] = t[i][j];     swap(n, m);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n >> m;     for (int i = 1; i < (int)(n + 1); i++)       for (int j = 1; j < (int)(m + 1); j++) cin >> grid[i][j];     pre();     long long ans = ans0() + ans1() + ans2();     reversegrid();     pre();     cout << ans + ans0() + ans2();   }   