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.BufferedReader;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.StringTokenizer;
import java.io.InputStream;

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

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {

        StringTokenizer st = new StringTokenizer(in.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        int a[][] = new int[n][m];
        for (int i = 0; i < n; i++) {
            String s = in.readLine();
            for (int j = 0; j < m; j++) {
                if(s.charAt(j) == '1') {
                    a[i][j] = 1;
                } else {
                    a[i][j] = 0;
                }
            }
        }


        int d[][][] = new int[n][m][9];

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if(a[i][j] == 0) {
                    if (j > 0) {
                        if (a[i][j - 1] == 0) {
                            d[i][j][7] = d[i][j - 1][7] + 1;
                        }
                        if(i>0) {
                            if (a[i-1][j - 1] == 0) {
                                d[i][j][8] = d[i-1][j - 1][8] + 1;
                            }
                        }
                    }
                    if(i>0) {
                        if (a[i-1][j] == 0) {
                            d[i][j][1] = d[i-1][j][1] + 1;
                        }
                        if(j<m-1){
                            if (a[i-1][j+1] == 0) {
                                d[i][j][2] = d[i-1][j+1][2] + 1;
                            }
                        }
                    }
                }
            }
        }
        for (int i = n-1; i >= 0; i--) {
            for (int j = m-1; j >= 0; j--) {
                if(a[i][j] == 0) {
                    if (j < m-1) {
                        if (a[i][j + 1] == 0) {
                            d[i][j][3] = d[i][j + 1][3] + 1;
                        }
                        if(i < n-1) {
                            if (a[i+1][j + 1] == 0) {
                                d[i][j][4] = d[i+1][j + 1][4] + 1;
                            }
                        }
                    }
                    if(i < n-1) {
                        if (a[i+1][j] == 0) {
                            d[i][j][5] = d[i+1][j][5] + 1;
                        }
                        if(j>0){
                            if (a[i+1][j-1] == 0) {
                                d[i][j][6] = d[i+1][j-1][6] + 1;
                            }
                        }
                    }
                }
            }
        }



        long ans = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if(a[i][j] == 0) {
                    for (int k = 0; k < d[i][j][3]; k++) {

                        if(d[i][j][1] >  k && d[i][j+k+1][8] > k) {
                            ans++;
                        }
                        if(d[i][j+k+1][1] >  k && d[i][j][2] > k) {
                            ans++;
                        }
                        if(d[i][j][5] >  k && d[i][j+k+1][6] > k) {
                            ans++;
                        }
                        if(d[i][j+k+1][5] >  k && d[i][j][4] > k) {
                            ans++;
                        }

                        if(k %2 == 1) {
                            if(d[i][j][2] > k/2 && d[i][j+k+1][8] > k/2) {
                                ans++;
                            }
                            if(d[i][j][4] > k/2 && d[i][j+k+1][6] > k/2) {
                                ans++;
                            }
                        }

                    }
                    for (int k = 0; k < d[i][j][5]; k++) {
                        if(k %2 == 1) {
                            if(d[i][j][4] >  k/2 && d[i+k+1][j][2] > k/2) {
                                ans++;
                            }
                            if(d[i][j][6] >  k/2 && d[i+k+1][j][8] > k/2) {
                                ans++;
                            }
                        }
                    }
                }

            }
        }
        out.println(ans);




//        long d[][] = new long[m][m];
//        long pd[][] = new long[m][m];
//        long ans = 0;
//        for (int i = 1; i < n; i++) {
//            for (int j = 0; j < m; j++) {
//                if(a[i][j] > 0) {
//                    for (int k = 1; k < a[i][j]; k++) {
//                        if(k==1) {
//                            if(a[i-1][j] > 0) {
//                                d[j][k] |= 1;
//                                ans ++;
//                            }
//                            if(j + 1 < m && a[i-1][j+1] > 0) {//todo:
//                                d[j][k] |= 2;
//                                ans ++;
//                            }
//                        } else {
//                            if(k%2 == 1) {
//                                if((pd[j+1][k-2]&4) > 0) {
//                                    d[j][k] |=4;
//                                    ans++;
//                                }
//                            }
//                            if((pd[j+1][k-1]&2) > 0) {
//                                d[j][k] |=2;
//                                ans++;
//                            }
//                            if((pd[j][k-1]&1) > 0) {
//                                d[j][k] |=1;
//                                ans++;
//                            }
//
//                        }
//                    }
//                }
//            }
//        }
    }
}

class InputReader  extends BufferedReader {
    public InputReader(InputStream st) {
        super(new InputStreamReader(st));
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }


}
