object Main extends App {
  import scala.io.StdIn._

  val Array(h, w) = readLine.trim.split(' ').map(_.toInt)
  val state = Array.tabulate(h){_ ⇒ readLine.trim.split(' ').map(_.toLong)}

  println(
    (0 until h).map(y ⇒ (0 until w).map(x ⇒ (y + 1).toLong * (h - y) * (x + 1) * (w - x) * state(y)(x)).sum).sum
  )
  implicit class Scope[T](val value: T) extends AnyVal {
    @inline
    def let[A](func: T ⇒ A): A = func(value)
  }
}
