/*  -*- coding: utf-8 -*-
 *
 * 2925.cc: Angel Relief
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

typedef long long ll;

/* global variables */

/* subroutines */

/* main */

int main() {
  int h, w;
  scanf("%d%d", &h, &w);

  ll sum = 0;
  for (int y = 0; y < h; y++)
    for (int x = 0; x < w; x++) {
      int a;
      scanf("%d", &a);
      sum += (ll)(y + 1) * (h - y) * (x + 1) * (w - x) * a;
    }

  printf("%lld\n", sum);
  return 0;
}

