#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define inf 1000000007
#define int long long

signed main() {
	int h, w;
	cin >> h >> w;
	int all = 0;
	rep(i, h) {
		rep(j, w) {
			int p;
			cin >> p;
			all += p * (i + 1) * (h - i) * (j + 1) * (w - j);
		}
	}
	cout << all << endl;
}
