#include<bits/stdc++.h>
using namespace std; 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define length size()
#define int long long
#define ll long long
const int MOD = 1000000007;
const int MAX = 510000;
template<typename T> string join(vector<T> &vec ,const string &sp){
    int si = vec.length;
    if(si==0){
        return "";
    }else{
        stringstream ss;
        rep(i,si-1){
            ss << vec[i] << sp;
        }
        ss << vec[si - 1];
        return ss.str();
    }
}
signed main(void){
    int h,w;
    cin >> h >> w;
    vector<vector<char>> vec(h+1,vector<char>(w+1,'#'));
    int sum = 0;
    rep(i,h){
        rep(j,w){
            cin >> vec[i][j];
        }
    }
    rep(i,h){
        rep(j,w){
            if(vec[i][j]=='.'){
                if(vec[i][j+1]=='.') sum++;
                if(vec[i+1][j]=='.') sum++;
            }
        }
    }
    cout << sum << endl;
}

#include <bits/stdc++.h>
using namespace std;

#define endl "\n"
#define int long long int
#define mod 1000000007
#define vi vector<int>
#define pint pair<int,int>
#define vint vector<vector<int>>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

const int N = 1e6+5;
int A[N], B[N], P[N], Q[N][3], D[N][3];
string S[105];

int mat[5005][5005];
pint edges[N];
unordered_map<int, set<int>> m;

bool compare(vi a, vi b)
{
    return a[0] < b[0];
}

int lcm(int a, int b)
{
    return (a*b)/(__gcd(a,b));
}

int mypow(int a, int x)
{
    if(a<=1 || x==1) return a;
    if(x==0) return 1;

    int temp = mypow(a,x/2);
    if(x%2==0) return ((temp%mod) * (temp%mod))%mod;
    else return (a%mod * ((temp%mod) * (temp%mod))%mod)%mod;
}

int count_bits(int n)
{
    int cnt = 0;
    while(n)
    {
        n = n & (n-1);
        cnt++;
    }return cnt;
}

void bfs(int src, int n)
{
    unordered_map<int, bool> visited;
    for(int i=0;i<n;i++) visited[i] = false;
    queue<int> q;
    q.push(src);
    visited[src] = true;

    while(!q.empty())
    {
        int curr = q.front();
        q.pop();
        B[curr] -= min(B[curr], A[src]);
        //cout<<curr<<" "<<endl;

        for(auto neigh: m[curr])
        {
            if(visited[neigh] == false)
            {
                //cout<<neigh<<endl;
                q.push(neigh);
                visited[neigh] = true;
                m[src].erase(neigh);
                m[neigh].erase(src);
            }
        }
    }
}

int length_of_lis(int n)
{
    if(n<=1) return n;
    vector<int> res;

    res.push_back(A[0]);
    int i;

    for(i=1;i<n;i++)
    {
        if(A[i] > res.back()) res.push_back(A[i]);
        else
        {
            int index = lower_bound(res.begin(), res.end(), A[i]) - res.begin();
            res[index] = A[i];
        }
    }return res.size();
}

int solve(int h, int w)
{
    int i,j,k;
    int ans = 0;

    for(i=0;i<h;i++)
    {
        for(j=0;j<w-1;j++)
        {
            if(S[i][j] == '.' && S[i][j+1] == '.')
                ans++;
        }
    }

    for(i=0;i<w;i++)
    {
        for(j=0;j<h-1;j++)
        {
            if(S[j][i] == '.' && S[j+1][i] == '.')
                ans++;
        }
    }
    return ans;
}

int32_t main()
{
    //code
	IOS;

    int t,n,m,a,b,x,y,i,j,z;
    //cin>>t;
    t = 1;
    while(t--)
    {
        int h,w;
        cin>>h>>w;
        for(i=0;i<h;i++)
            cin>>S[i];
        cout<<solve(h,w)<<endl;
    }

	return 0;
}
