
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  ll h,w;
  ll ans=0;
  ll mp[500][500];
  cin>>h>>w;
  rep(i,h){
    rep(j,w){
      cin>>mp[i][j];
      ans+=((i+1)*(h-i) )*((j+1)*(w-j) )*mp[i][j];
    }
  }
  cout<<ans<<endl;
  return 0;
}




