#include <algorithm>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <thread>
#include <tuple>
#include <type_traits>
#include <vector>


#define rep(i, n) for (int i = 0; i < (n); i++)
#define pii pair<int, int>

using namespace std;

using ll = long long;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define M (1'000'000'007)

int main() {
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;

    vector<string> s(h);
    for (int i = 0; i < h; i++) {
        cin >> s[i];
    }

    int ans = 0;
    int dx[] = {-1, 1, 0, 0};
    int dy[] = {0, 0, -1, 1};
    for (int x = 0; x < w; x++) {
        for (int y = 0; y < h; y++) {
            if (s[y][x] != '.')
                continue;
            for (int i = 0; i < 4; i++) {
                if (x + dx[i] >= 0 && x + dx[i] < w && y + dy[i] >= 0 &&
                    y + dy[i] < h) {
                    if (s[y + dy[i]][x + dx[i]] == '.')
                        ans++;
                }
            }
        }
    }

    cout << ans / 2 << endl;

    return 0;
}

//Bismillah Hir Rehmanir Rahim
//Allah knows best
using namespace std;
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include<bits/stdc++.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#define endl "\n"
#define mini -10000000000000000
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define f(i, a, n) for( i=a; i<n;i++)
#define ll long long
#define pi 3.141592653589793
#define vi              vector<int>
#define si              set<int>
#define pb              push_back
#define mp              make_pair
#define mod             1000000007
#define rr              return 0
#define ff              first
#define in              insert
#define ss              second
#define setbits(x)      __builtin_popcountll(x)
#define zrbits(x)       __builtin_ctzll(x)
#define deb(x)          cout << #x << " = " << x << endl
#define set_bit(x, idx) x = x|1LL<<idx
#define check_bit(x, idx) min(x&(1LL<<idx),1LL)
#define toggle_bit(x, idx) x = x^(1LL<<idx)
int main()
{
     ios;
      #ifdef DEBUG
     freopen("input.txt", "r", stdin);
     #endif
     ll i,j,k,n,m;
     cin>>n>>m;
     string s[n],t;
     f(i,0,n) cin>>s[i];
     ll c=0,ct=0,ans=0;
     for(i=0;i<n;i++)
     {
         t=s[i];
         c=0;
         for(j=0;j<m;j++)
         {
             if(t[j]=='.')
             c++;
             else
             {
                 if(c>1)
                 ans=ans+c-1;
                 c=0;
             } 
         }
         if(c>1)
           {
            ans=ans+c-1;
             c=0; 
           }
     }
     if(c>1)
     {
            ans=ans+c-1;
             c=0; 
     }
     c=0;
     //deb(ans);
     for(j=0;j<m;j++)
     {
         c=0;
        for(i=0;i<n;i++)
        {
           // deb(s[i][j]);
            if(s[i][j]=='.')
            c++;
            else
            {
                 if(c>1)
                 ans=ans+c-1;
                 c=0;
            }
        }
           if(c>1)
          {
            ans=ans+c-1;
             c=0; 
          }
          c=0;
     }
     cout<<ans<<endl;
     rr;
}