#include <bits/stdc++.h>
using namespace std;
int prime(int);
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n, m;
  cin >> n >> m;
  int arr[n][m];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> arr[i][j];
  int ans = 0;
  for (int i = (0); i < ((int)(n)); i++) {
    int front = -10, end = -10;
    for (int j = 0; j < m; j++)
      if (arr[i][j] == 1) {
        front = j;
        break;
      }
    for (int j = m - 1; j >= 0; j--)
      if (arr[i][j] == 1) {
        end = j;
        break;
      }
    if (front >= 0 && end < m) {
      for (int j = 0; j < front; j++)
        if (arr[i][j] != 1) ans++;
      for (int j = front + 1; j < end; j++)
        if (arr[i][j] != 1) {
          ans += 2;
        }
      for (int j = end + 1; j < m; j++)
        if (arr[i][j] != 1) ans++;
    }
  }
  for (int i = (0); i < ((int)(m)); i++) {
    int front = -10, end = -10;
    for (int j = 0; j < n; j++)
      if (arr[j][i] == 1) {
        front = j;
        break;
      }
    for (int j = n - 1; j >= 0; j--)
      if (arr[j][i] == 1) {
        end = j;
        break;
      }
    if (front >= 0 && end < n) {
      for (int j = 0; j < front; j++)
        if (arr[j][i] != 1) ans++;
      for (int j = front + 1; j < end; j++)
        if (arr[j][i] != 1) {
          ans += 2;
        }
      for (int j = end + 1; j < n; j++)
        if (arr[j][i] != 1) ans++;
    }
  }
  cout << (ans) << ' ';
}
int prime(int n) {
  if (n <= 1) return 0;
  int flag = 0;
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {
      flag = 1;
      break;
    }
  }
  if (flag == 0)
    return 1;
  else
    return 0;
}
