#include <iostream>
#include <string>
using namespace std;

int main()
{
    int H, W;
    cin >> H >> W;
    string S[100];

    for (int i = 0; i < H; i++)
    {
        cin >> S[i];
    }

    int answer = 0;

    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if (j != W - 1)
            {
                if (S[i][j] == '.' && S[i][j + 1] == '.')
                {
                    answer++;
                }
            }
            if (i != H - 1)
            {
                if (S[i][j] == '.' && S[i + 1][j] == '.')
                {
                    answer++;
                }
            }
        }
    }

    cout << answer << endl;

    return 0;
}
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007LL
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define SHIFT(n) (1LL<<((ll)n))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;

bool exor(string s){
    ll ret = 0;
    for(int i = 0;i < s.size();i++){
        ret+=(s[i]-'0')%2;
    }
    return ret%2;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    vector<string>vs(n);
    for(auto &s:vs)cin>>s;
    ll ans = 0;
    vi cnt(10);
    for(int i = 0;i < n;i++){
        cnt[exor(vs[i])]++;
    }
    cout << cnt[0] * cnt[1] << endl;
    return 0;
}