// ######      ###      #######    #######    ##     #     #####        ###     ##### //
// #     #    #   #          #        #       # #    #    #     #      #   #     ###  //
// #     #   #     #        #         #       #  #   #   #       #    #     #    ###  //
// ######   #########      #          #       #   #  #   #           #########    #   //
// #     #  #       #     #           #       #    # #   #    ####   #       #    #   //
// #     #  #       #    #            #       #     ##   #    #  #   #       #        //
// ######   #       #   #######    #######    #      #    #####  #   #       #    #   //

// #pragma GCC optimize(2)
// #pragma GCC optimize(3)
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> ppl;
#define ain(a,n) for(ll i=0;i<(n);++i)  cin>>(a)[i];
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(ll i=0;i<(n);++i)
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FORD(i,a,b) for(ll i=(a);i>=(b);--i)
#define cases ll T=0;cin>>T;while(T--)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define END "\n"
#define pb push_back
#define mp make_pair
#define go(c,itr) for(auto itr=(c).begin(); itr!=(c).end(); ++itr)
// #define back(c,itr) for(auto itr=(c).rbegin(); itr!=(c).rend(); ++itr)
#define PI 3.14159265359
#define inf 9e18
#define MOD 1000000007
#define MODU 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MAXN 1000005
#define BLOCK 555
const string alpha = "abcdefghijklmnopqrstuvwxyz";
const ll N = 1000005;
const long double epsilon = 1e-9;
inline ll myceil(ll a, ll  b) {
    return (ceil(1.0 * a / b * 1.0));
}
ll binexp(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
ll modinvfermat(ll a, ll m)
{
    return binexp(a, m - 2, m);
}
void task(bool flag)
{
    if (flag)
        cout << "YES\n";
    else
        cout << "NO\n";
}
ll lcm(ll a, ll b)
{
    return ((1LL * a * b) / (__gcd(a, b)));
}



signed main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast
    ll n, m;
    cin >> n >> m;
    vector<vector<char>> grid(n, vector<char>(m));
    loop(i, n)   loop(j, m)   cin >> grid[i][j];
    ll ans = 0;
    loop(i, n)
    {
        ll len = 0, j = 0;
        while (j < m)
        {
            if (grid[i][j] == '.')
            {
                len = 0;
                while (j < m && grid[i][j] == '.')
                    ++j , ++len;
                ans += len - 1;
            }
            else
                ++j;
        }
    }
    loop(j, m)
    {
        ll len = 0, i = 0;
        while (i < n)
        {
            if (grid[i][j] == '.')
            {
                len = 0;
                while (i < n && grid[i][j] == '.')
                    ++i , ++len;
                ans += len - 1;
            }
            else
                ++i;
        }
    }
    cout << ans << END;


#ifndef ONLINE_JUDGE
    cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
    return 0;
}


#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;
}
