You are given an n × m grid, some of its nodes are black, the others are white. Moreover, it's not an ordinary grid — each unit square of the grid has painted diagonals.

The figure below is an example of such grid of size 3 × 5. Four nodes of this grid are black, the other 11 nodes are white.

<image>

Your task is to count the number of such triangles on the given grid that:

  * the corners match the white nodes, and the area is positive; 
  * all sides go along the grid lines (horizontal, vertical or diagonal); 
  * no side contains black nodes. 

Input

The first line contains two integers n and m (2 ≤ n, m ≤ 400). Each of the following n lines contain m characters (zeros and ones) — the description of the grid. If the j-th character in the i-th line equals zero, then the node on the i-th horizontal line and on the j-th vertical line is painted white. Otherwise, the node is painted black.

The horizontal lines are numbered starting from one from top to bottom, the vertical lines are numbered starting from one from left to right. 

Output

Print a single integer — the number of required triangles.

Examples

Input

3 5
10000
10010
00001


Output

20


Input

2 2
00
00


Output

4


Input

2 2
11
11


Output

0

Note

The figure below shows red and blue triangles. They are the examples of the required triangles in the first sample. One of the invalid triangles is painted green. It is invalid because not all sides go along the grid lines.

<image>
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Sheng Cao
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskD {
    public int n1 = 0, m1 = 0;
    public char[][] grid = null;
    public int[][] horizontal = null, vertical = null;
    public boolean good (int x, int y){
        return grid[x][y] != '1';
    }
    public boolean bound(int x, int y){
        return !(x < 0 || y < 0 || x >= n1 || y >= m1);
    }
    public boolean goodLine(int x1, int y1, int x2, int y2){
        if (x1 == x2){
            if (y1 > y2){
                int t = y1;
                y1 = y2;
                y2 = t;
            }
            return horizontal[x1 + 1][Math.max(y1, y2) + 1] - horizontal[x1 + 1][Math.min(y1, y2)] == 0;
        }
        else if (y1==y2){
            if (x1 > x2){
                int t = x1;
                x1 = x2;
                x2 = t;
            }
            return vertical[Math.max(x1,x2) + 1][y1 + 1] - vertical[Math.min(x1, x2)][y1 + 1] == 0;
        }
        throw new RuntimeException();
    }
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        n1 = in.nextInt();
        m1 = in.nextInt();

        grid = new char[n1][];
        for (int i = 0 ; i < n1; i++){
            grid[i] = in.next().toCharArray();
        }
//      n1 = 400;
//      m1= 400;
//      grid = new char[400][400];
//      for (int i = 0 ; i < n1; i++){
//          for (int j =0; j < m1;j++){
//              grid[i][j] = '0';
//          }
//      }
        horizontal = new int[n1 + 1][m1 + 1];
        vertical = new int[n1 + 1][m1 + 1];
        for (int i = 0 ;  i< n1; i++){
            for (int j = 0 ; j < m1;j ++){
                if (grid[i][j] == '1'){
                    horizontal[i + 1][j + 1] = 1;
                    vertical[i + 1][j + 1] = 1;
                }
            }
        }
        for (int i = 0; i < n1 + 1; i++){
            for (int j = 0 ; j < m1 + 1; j++){
                if (j > 0) horizontal[i][j] += horizontal[i][j - 1];
                if (i > 0) vertical[i][j] += vertical[i - 1][j];
            }
        }
        // bot 1
        check(0,1,1,1);
        // bot 2
        check(1,0,1,1);
        // top 1
        check(-1,0,-1,1);
        // top 2
        check(0,1,-1,1);

        // bot
        check(1,1,1,-1);
        // right
        check(1,1,-1,1);
        // top
        check(-1,1,-1,-1);
        // left
        check(-1,-1,1,-1);


        out.printLine(ans);
    }
    public int ans = 0;
    public void check(int xx1, int yy1, int xx2, int yy2){
        for (int i = 0; i < n1; i++){
            for (int j = 0; j < m1; j++){
                if (!good(i, j)) continue;
                int qq1 = i;
                int ww1 = j;
                int qq2 = i;
                int ww2 = j;
                int cnt = 0;
                for (;;){
                    qq1 += xx1;
                    ww1 += yy1;
                    qq2 += xx2;
                    ww2 += yy2;
//                  DebugZ.print(qq1,ww1,qq2,ww2);
                    if (!bound(qq1, ww1)) break;
                    if (!bound(qq2, ww2)) break;
//                  DebugZ.print(qq1,ww1,qq2,ww2);
                    if (!good(qq1, ww1)) break;
                    if (!good(qq2, ww2)) break;
//                  DebugZ.print(qq1,ww1,qq2,ww2);
                    if (goodLine(qq1,ww1,qq2,ww2)) ans++;
                    cnt++;
                }
//              DebugZ.print(i,j,cnt);
            }
        }
//      DebugZ.print(ans);
    }
}

class InputReader {
    private BufferedReader in = null;
    private StringTokenizer st = null;

    public InputReader(InputStream usingStream) {
        in = new BufferedReader(new InputStreamReader(usingStream));

    }
    public String next(){
        for (;st == null || !st.hasMoreTokens();){
            String currentLine = null;
            try {
                currentLine = in.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (currentLine == null) return null;
            st = new StringTokenizer(currentLine);
        }
        return st.nextToken();
    }
    public int nextInt(){
        return Integer.parseInt(next());
    }
}

class OutputWriter {
    private PrintWriter usingPrintWriter = null;

    public OutputWriter(OutputStream usingStream){
        usingPrintWriter = new PrintWriter(usingStream);
    }
    public OutputWriter(Writer usingWriter){
        usingPrintWriter = new PrintWriter(usingWriter);
    }

    public void printLine(Object... l1){
        for (int i = 0;i < l1.length; i++){
            if (i != 0) usingPrintWriter.print(" ");
            usingPrintWriter.print(l1[i]);
        }
        usingPrintWriter.println();
    }
    public void flush(){
        usingPrintWriter.flush();
    }
    public void close(){
        flush();
        usingPrintWriter.close();
    }
}
