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

const vector<int> XS = { 0, 0, 1, 1 };
const vector<int> YS = { 0, 1, 0, 1 };
const char BLACK = '#';

int count(int i, int j, vector<string> &s) {
	int count = 0;
	for (int k = 0; k < int(XS.size()); k++) {
		if (BLACK == s[i + XS[k]][j + YS[k]]) {
			count++;
		}
	}
	return count;
}

int main(void) {
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}
	int ans = 0;
	for (int i = 0; i < h - 1; i++) {
		for (int j = 0; j < w - 1; j++) {
			if (1 == (1 & count(i, j, s))) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=b;i--)
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())

#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7:合同式の法
 
int main(){

    ll n,k;
    cin >> n >> k;

    vector<ll> vec;
    REP(i,n){
        REP(j,k){
            ll tmp = 100*(i+1);
            tmp += j+1;
            vec.push_back(tmp);
        }
    }
    /*
    REP(i,vec.size()){
        cout << vec[i] << endl;
    }*/

    cout << accumulate(vec.begin(),vec.end(),0) << endl;
    
    return 0;
}