#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_
void debug_out() {cerr << endl;}
template<typename Head,typename... Tail> void debug_out(Head H,Tail... T){cerr << ' ' << H; debug_out(T...);}
#define debug(...) cerr << 'L' << __LINE__ << " [" << #__VA_ARGS__ << "]:",debug_out(__VA_ARGS__)
#define dump(x) cerr << 'L' << __LINE__ << " " << #x << " = " << (x) << endl;
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int H,W; cin >> H >> W;
    vector<string> S(H);
    rep(i,H) cin >> S[i];

    int ans = 0;
    rep(i,H) {
        rep(j,W) {
            if (S[i][j] == '#') continue;
            if (i + 1 < H && S[i+1][j] == '.') ++ans;
            if (j + 1 < W && S[i][j+1] == '.') ++ans;
        }
    }
    cout << ans << '\n';
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
const int mod1=998244353,mod2=(int)1e9+7;
int power(int n,int k,int mod){int ans=1; n=n%mod;while(k>0){if(k&1)ans=(ans*n)%mod;n=(n*n)%mod;k>>=1;}return (ans+mod)%mod;}//negative nos & 0^0
struct triplet{int a,b,c;};bool operator < (const triplet &t1,const triplet &t2){if(t1.a<t2.a)return true;if(t1.a==t2.a && t1.b <t2.b)return true;if(t1.a==t2.a && t1.b ==t2.b && t1.c<t2.c)return true;return false;}
// memset(dp, -1, sizeof dp);


void problemSolver()
{

	int n,k,ans=0;
	cin>>n>>k;

	for(int y=2;y<=2*n;y++)
	{
		int x=k+y;
		if(x<=1 || x>2*n) continue;
		int ans1=(2*n-x+1),ans2=(2*n-y+1);
		if(x<=n)
			ans1=x-1;
		if(y<=n)
			ans2=y-1;
		ans+=ans1*ans2;
	}
	cout<<ans;
}
int32_t main()
{

	fio;
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	int testcases=1;
    // cin>>testcases;
    while(testcases--)
    problemSolver(); 

}