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.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;

public class D {

    static boolean DEBUG=false;
    static int dcnt(int N) {
        return 2*N-1;
    }
    
    static int dlen(int N, int diag) {
        if(diag>=dcnt(N)) {
            throw new IllegalArgumentException();
        }
        if(diag<N) {
            return diag+1;
        } else {
            return 2*N-1-diag;
        }
    }
    
    static int row1(int N, int diag, int off) {
        if(diag>=dcnt(N)) {
            throw new IllegalArgumentException();
        }
        if(off>=dlen(N,diag)) {
            throw new IllegalArgumentException();
        }
        return Math.min(diag, N-1)-off;
    }
    
    static int col1(int N, int diag, int off) {
        if(diag>=dcnt(N)) {
            throw new IllegalArgumentException();
        }
        if(off>=dlen(N,diag)) {
            throw new IllegalArgumentException();
        }
        return Math.max(diag-(N-1), 0)+off;
    }
    
    static int row2(int N, int diag, int off) {
        return row1(N,diag,dlen(N,diag)-1-off);
    }
    
    static int col2(int N, int diag, int off) {
        return N-1-col1(N,diag,dlen(N,diag)-1-off);
    }
    
    static int diag1(int N, int row, int col) {
        return row+col;
    }

    static int off1(int N, int row, int col) {
        int diag=diag1(N,row,col);
        return col-Math.max(diag-(N-1), 0);
    }
    
    static int diag2(int N, int row, int col) {
        return diag1(N,row,N-1-col);
    }
    
    static int off2(int N, int row, int col) {
        return off1(N,row,N-1-col);
    }
    
    static int[][] to_rect(int[][] tbl) {
        int N=tbl.length, M=tbl[0].length;
        if(N==M) {
            return tbl;
        } else if(N>M) {
            int[][] ret=new int[N][N];
            for (int i=0; i<N; i++) {
                Arrays.fill(ret[i], 1);
                System.arraycopy(tbl[i], 0, ret[i], 0, M);
            }
            return ret;
        } else {
            int[][] ret=new int[M][M];
            for (int i=0; i<N; i++) {
                System.arraycopy(tbl[i], 0, ret[i], 0, M);
            }
            for (int i=N; i<M; i++) {
                Arrays.fill(ret[i], 1);
            }
            return ret;
            
        }
    }
    
    static long solve(int[][] tbl) {
        tbl=to_rect(tbl);
        int N=tbl.length;
        
        int[][] 
                l=new int[N][N],
                r=new int[N][N],
                t=new int[N][N],
                b=new int[N][N],
                tl=new int[N][N],
                tr=new int[N][N],
                bl=new int[N][N],
                br=new int[N][N];
        
        for (int row=0; row<N; row++) {
            int vl=-1, vr=N;
            for (int col=0; col<N; col++) {
                if(tbl[row][col]==1) {
                    vl=col;
                }
                if(tbl[row][N-1-col]==1) {
                    vr=N-1-col;
                }
                l[row][col]=col-vl;
                r[row][N-1-col]=vr-(N-1-col);
            }
        }

        for (int col=0; col<N; col++) {
            int vt=-1, vb=N;
            for (int row=0; row<N; row++) {
                if(tbl[row][col]==1) {
                    vt=row;
                }
                if(tbl[N-1-row][col]==1) {
                    vb=N-1-row;
                }
                t[row][col]=row-vt;
                b[N-1-row][col]=vb-(N-1-row);
            }
        }
        
        for (int diag=0; diag<dcnt(N); diag++) {
            int dlen=dlen(N,diag);
            int vbl=-1, vtr=dlen;
            for (int i=0; i<dlen; i++) {
                int row=row1(N,diag,i), col=col1(N,diag,i);
                if(tbl[row][col]==1) {
                    vbl=i;
                }
                bl[row][col]=i-vbl;
                
                row=row1(N,diag,dlen-1-i); col=col1(N,diag,dlen-1-i);
                if(tbl[row][col]==1) {
                    vtr=dlen-1-i;
                }
                tr[row][col]=vtr-(dlen-1-i);
            }
        }

        for (int diag=0; diag<dcnt(N); diag++) {
            int dlen=dlen(N,diag);
            int vtl=-1, vbr=dlen;
            for (int i=0; i<dlen; i++) {
                int row=row2(N,diag,i), col=col2(N,diag,i);
                if(tbl[row][col]==1) {
                    vtl=i;
                }
                tl[row][col]=i-vtl;
                
                row=row2(N,diag,dlen-1-i); col=col2(N,diag,dlen-1-i);
                if(tbl[row][col]==1) {
                    vbr=dlen-1-i;
                }
                br[row][col]=vbr-(dlen-1-i);
            }
        }
        
        long ret=0;
        for (int row=0; row<N; row++) {
            for (int col=0; col<N; col++) {
                int size=Math.min(t[row][col], r[row][col]);
                for (int i=1; i<size; i++) {
                    if(tl[row][col+i]>=i) {
                        ret++;
                        if(DEBUG) {
                            System.out.println(row+", "+col+", "+i+" tr");
                        }
                    }
                }
                size=Math.min(b[row][col], r[row][col]);
                for (int i=1; i<size; i++) {
                    if(bl[row][col+i]>=i) {
                        ret++;
                        if(DEBUG) {
                            System.out.println(row+", "+col+", "+i+" br");
                        }
                    }
                }
                size=Math.min(b[row][col], l[row][col]);
                for (int i=1; i<size; i++) {
                    if(br[row][col-i]>=i) {
                        ret++;
                        if(DEBUG) {
                            System.out.println(row+", "+col+", "+i+" bl");
                        }
                    }
                }
                size=Math.min(t[row][col], l[row][col]);
                for (int i=1; i<size; i++) {
                    if(tr[row][col-i]>=i) {
                        ret++;
                        if(DEBUG) {
                            System.out.println(row+", "+col+", "+i+" tl");
                        }
                    }
                }

                
                size=Math.min(tl[row][col], tr[row][col]);
                for (int i=1; i<size; i++) {
                    int row1=row1(N, diag1(N,row,col), off1(N,row,col)+i);
                    int col1=col1(N, diag1(N,row,col), off1(N,row,col)+i);
                    if(l[row1][col1]>=2*i) {
                        ret++;
                        if(DEBUG) {
                            System.out.println(row+", "+col+", "+i+" t");
                        }
                    }
                }
                size=Math.min(tr[row][col], br[row][col]);
                for (int i=1; i<size; i++) {
                    int row1=row1(N, diag1(N,row,col), off1(N,row,col)+i);
                    int col1=col1(N, diag1(N,row,col), off1(N,row,col)+i);
                    if(b[row1][col1]>=2*i) {
                        ret++;
                        if(DEBUG) {
                            System.out.println(row+", "+col+", "+i+" r");
                        }
                    }
                }
                size=Math.min(bl[row][col], br[row][col]);
                for (int i=1; i<size; i++) {
                    int row1=row1(N, diag1(N,row,col), off1(N,row,col)-i);
                    int col1=col1(N, diag1(N,row,col), off1(N,row,col)-i);
                    if(r[row1][col1]>=2*i) {
                        ret++;
                        if(DEBUG) {
                            System.out.println(row+", "+col+", "+i+" b");
                        }
                    }
                }
                size=Math.min(bl[row][col], tl[row][col]);
                for (int i=1; i<size; i++) {
                    int row1=row1(N, diag1(N,row,col), off1(N,row,col)-i);
                    int col1=col1(N, diag1(N,row,col), off1(N,row,col)-i);
                    if(t[row1][col1]>=2*i) {
                        ret++;
                        if(DEBUG) {
                            System.out.println(row+", "+col+", "+i+" l");
                        }
                    }
                }
            }
        }
        
        return ret;
    }
    
    static StringBuilder sb=new StringBuilder();
    static void parse(String l, int[] here) {
        sb.setLength(0);
        int len=l.length(), j=0;
        for (int i=0; i<len; i++) {
            char c=l.charAt(i);
            if(c==' ') {
                here[j++]=Integer.parseInt(sb.toString());
                sb.setLength(0);
            } else {
                sb.append(c);
            }
        }
        if(sb.length()>0) {
            here[j++]=Integer.parseInt(sb.toString());
        }
    }
    
    static void run_stream(InputStream ins) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String[] nm=br.readLine().split(" ");
        int n=Integer.parseInt(nm[0]);
        int m=Integer.parseInt(nm[1]);
        int[][] t=new int[n][m];
        for (int i=0; i<n; i++) {
            String s=br.readLine();
            for (int j=0; j<s.length(); j++) {
                t[i][j]=s.charAt(j)-'0';
            }
        }
        System.out.println(solve(t));
    }

    public static void main(String[] args) throws IOException {
        run_stream(System.in);
        
//        System.out.println(dlen(5, 0));
//        System.out.println(dlen(5, 1));
//        System.out.println(dlen(5, 2));
//        System.out.println(dlen(5, 3));
//        System.out.println(dlen(5, 4));
//        System.out.println(dlen(5, 5));
//        System.out.println(dlen(5, 6));
//        System.out.println(dlen(5, 7));
//        System.out.println(dlen(5, 8));
//        System.out.println();
//        System.out.println(row1(5,1,1)+" "+col1(5,1,1));
//        System.out.println(row1(5,3,2)+" "+col1(5,3,2));
//        System.out.println(row1(5,4,2)+" "+col1(5,4,2));
//        System.out.println(row1(5,6,1)+" "+col1(5,6,1));
//        System.out.println();
//        System.out.println(row2(5,1,1)+" "+col2(5,1,1));
//        System.out.println(row2(5,3,2)+" "+col2(5,3,2));
//        System.out.println(row2(5,4,2)+" "+col2(5,4,2));
//        System.out.println(row2(5,6,1)+" "+col2(5,6,1));
//        System.out.println();
//        int r=row1(5,1,1), c=col1(5,1,1);
//        System.out.println(diag1(5,r,c)+" "+off1(5,r,c));
//        r=row1(5,3,2); c=col1(5,3,2);
//        System.out.println(diag1(5,r,c)+" "+off1(5,r,c));
//        r=row1(5,4,2); c=col1(5,4,2);
//        System.out.println(diag1(5,r,c)+" "+off1(5,r,c));
//        r=row1(5,6,1); c=col1(5,6,1);
//        System.out.println(diag1(5,r,c)+" "+off1(5,r,c));
//        System.out.println();
//        r=row2(5,1,1); c=col2(5,1,1);
//        System.out.println(diag2(5,r,c)+" "+off2(5,r,c));
//        r=row2(5,3,2); c=col2(5,3,2);
//        System.out.println(diag2(5,r,c)+" "+off2(5,r,c));
//        r=row2(5,4,2); c=col2(5,4,2);
//        System.out.println(diag2(5,r,c)+" "+off2(5,r,c));
//        r=row2(5,6,1); c=col2(5,6,1);
//        System.out.println(diag2(5,r,c)+" "+off2(5,r,c));

    }

}
