#include <bits/stdc++.h>
int main() {
  std::ios_base::sync_with_stdio(false);
  int n, m;
  std::cin >> n >> m;
  std::vector<std::vector<int> > s(n, std::vector<int>(m, 0));
  for (int row = 0; row < n; row++) {
    for (int col = 0; col < m; col++) {
      std::cin >> s[row][col];
    }
  }
  long count(0);
  for (int row = 0; row < n; row++) {
    int left(0);
    for (int col = 0; col < m; col++) {
      if (s[row][col]) {
        left = 1;
      } else {
        count += left;
      }
    }
    int right(0);
    for (int col = m - 1; col >= 0; col--) {
      if (s[row][col]) {
        right = 1;
      } else {
        count += right;
      }
    }
  }
  for (int col = 0; col < m; col++) {
    int up(0);
    for (int row = 0; row < n; row++) {
      if (s[row][col]) {
        up = 1;
      } else {
        count += up;
      }
    }
    int down(0);
    for (int row = n - 1; row >= 0; row--) {
      if (s[row][col]) {
        down = 1;
      } else {
        count += down;
      }
    }
  }
  std::cout << count << std::endl;
  return 0;
}

### Prompt

In cpp, your task is to solve the following problem:

Theater stage is a rectangular field of size n × m. The director gave you the stage's plan which actors will follow. For each cell it is stated in the plan if there would be an actor in this cell or not.

You are to place a spotlight on the stage in some good position. The spotlight will project light in one of the four directions (if you look at the stage from above) — left, right, up or down. Thus, the spotlight's position is a cell it is placed to and a direction it shines.

A position is good if two conditions hold: 

  * there is no actor in the cell the spotlight is placed to; 
  * there is at least one actor in the direction the spotlight projects. 



Count the number of good positions for placing the spotlight. Two positions of spotlight are considered to be different if the location cells or projection direction differ.

Input

The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and the number of columns in the plan.

The next n lines contain m integers, 0 or 1 each — the description of the plan. Integer 1, means there will be an actor in the corresponding cell, while 0 means the cell will remain empty. It is guaranteed that there is at least one actor in the plan.

Output

Print one integer — the number of good positions for placing the spotlight.

Examples

Input

2 4
0 1 0 0
1 0 1 0


Output

9


Input

4 4
0 0 0 0
1 0 0 1
0 1 1 0
0 1 0 0


Output

20

Note

In the first example the following positions are good:

  1. the (1, 1) cell and right direction; 
  2. the (1, 1) cell and down direction; 
  3. the (1, 3) cell and left direction; 
  4. the (1, 3) cell and down direction; 
  5. the (1, 4) cell and left direction; 
  6. the (2, 2) cell and left direction; 
  7. the (2, 2) cell and up direction; 
  8. the (2, 2) and right direction; 
  9. the (2, 4) cell and left direction. 



Therefore, there are 9 good positions in this example.

### Response

```cpp
#include <bits/stdc++.h>
int main() {
  std::ios_base::sync_with_stdio(false);
  int n, m;
  std::cin >> n >> m;
  std::vector<std::vector<int> > s(n, std::vector<int>(m, 0));
  for (int row = 0; row < n; row++) {
    for (int col = 0; col < m; col++) {
      std::cin >> s[row][col];
    }
  }
  long count(0);
  for (int row = 0; row < n; row++) {
    int left(0);
    for (int col = 0; col < m; col++) {
      if (s[row][col]) {
        left = 1;
      } else {
        count += left;
      }
    }
    int right(0);
    for (int col = m - 1; col >= 0; col--) {
      if (s[row][col]) {
        right = 1;
      } else {
        count += right;
      }
    }
  }
  for (int col = 0; col < m; col++) {
    int up(0);
    for (int row = 0; row < n; row++) {
      if (s[row][col]) {
        up = 1;
      } else {
        count += up;
      }
    }
    int down(0);
    for (int row = n - 1; row >= 0; row--) {
      if (s[row][col]) {
        down = 1;
      } else {
        count += down;
      }
    }
  }
  std::cout << count << std::endl;
  return 0;
}

```