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.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class SpecialGrid {

	static int n, m;
	static boolean[][] in;
	static int[][] left, up, upLeft, upRight;

	static long hypUp(int i, int j) {
		int size = 1;
		long count = 0;
		while (j + size < m && i - size >= 0 && j - size >= 0) {
			if (in[i - size][j - size] && in[i - size][j + size]) {
				if (left[i - size][j + size] >= 2 * size && upLeft[i][j] >= size && upRight[i][j] >= size) {
					count++;
				}
			} else {
				break;
			}
			size++;
		}
		return count;
	}

	static long hypLeft(int i, int j) {
		int size = 1;
		long count = 0;
		while (j + size < m && i - 2 * size >= 0) {
			if (in[i - 2 * size][j] && in[i - 2 * size + 1][j] && in[i - size][j + size]) {
				if (upLeft[i - size][j + size] >= size && upRight[i][j] >= size && up[i][j] >= size) {
					count++;
				}
			} else {
				break;
			}
			size++;
		}
		return count;
	}

	static long hypRight(int i, int j) {
		int size = 1;
		long count = 0;
		while (j - size >= 0 && i - 2 * size >= 0) {
			if (in[i - size][j - size] && in[i - 2 * size][j] && in[i - 2 * size + 1][j]) {
				if (upRight[i - size][j - size] >= size && upLeft[i][j] >= size && up[i][j] >= size) {
					count++;
				}
			} else {
				break;
			}
			size++;
		}
		return count;
	}

	static long hypDown(int i, int j) {
		int size = 1;
		long count = 0;
		while (j - 2 * size >= 0 && i - size >= 0) {
			if (in[i - size][j - size] && in[i][j - 2 * size] && in[i][j - (2 * size) + 1]) {
				if (upRight[i][j - 2 * size] >= size && left[i][j] >= size && upLeft[i][j] >= size) {
					count++;
				}
			} else {
				break;
			}
			size++;
		}
		return count;
	}

	static long hypUpLeft(int i, int j) {
		int size = 1;
		long count = 0;
		while (j - size >= 0 && i - size >= 0) {
			if (in[i - size][j] && in[i][j - size]) {
				if (upRight[i][j - size] >= size && left[i][j] >= size && up[i][j] >= size) {
					count++;
				}
			} else {
				break;
			}
			size++;
		}
		return count;
	}

	static long hypDownRight(int i, int j) {
		int size = 1;
		long count = 0;
		while (j + size < m && i - size >= 0) {
			if (in[i - size][j] && in[i - size][j + size]) {
				if (left[i - size][j + size] >= size && up[i][j] >= size && upRight[i][j] >= size) {
					count++;
				}
			} else {
				break;
			}
			size++;
		}
		return count;
	}

	static long hypDownLeft(int i, int j) {
		int size = 1;
		long count = 0;
		while (j - size >= 0 && i - size >= 0) {
			if (in[i - size][j - size] && in[i - size][j]) {
				if (left[i - size][j] >= size && up[i][j] >= size && upLeft[i][j] >= size) {
					count++;
				}
			} else {
				break;
			}
			size++;
		}
		return count;
	}

	static long hypUpRight(int i, int j) {
		int size = 1;
		long count = 0;
		while (j - size >= 0 && i - size >= 0) {
			if (in[i - size][j - size] && in[i][j - size]) {
				if (up[i][j - size] >= size && left[i][j] >= size && upLeft[i][j] >= size) {
					count++;
				}
			} else {
				break;
			}
			size++;
		}
		return count;
	}

	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		n = sc.nextInt();
		m = sc.nextInt();
		in = new boolean[n][m];
		left = new int[n][m];
		upRight = new int[n][m];
		up = new int[n][m];
		upLeft = new int[n][m];
		for (int i = 0; i < n; i++) {
			char[] c = sc.next().toCharArray();
			for (int j = 0; j < m; j++)
				in[i][j] = c[j] == '0';
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (in[i][j]) {
					if (j > 0) {
						left[i][j] = left[i][j - 1] + 1;
					}
					if (i > 0) {
						up[i][j] = up[i - 1][j] + 1;
					}
					if (i > 0 && j < m - 1) {
						upRight[i][j] = upRight[i - 1][j + 1] + 1;
					}
					if (i > 0 && j > 0) {
						upLeft[i][j] = upLeft[i - 1][j - 1] + 1;
					}
				}
			}
		}
		long ans = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (in[i][j]) {
					ans += hypUpRight(i, j);
					ans += hypDownLeft(i, j);
					ans += hypDownRight(i, j);
					ans += hypUpLeft(i, j);
					ans += hypDown(i, j);
					ans += hypRight(i, j);
					ans += hypLeft(i, j);
					ans += hypUp(i, j);
				}
			}
		}
		out.println(ans);
		out.flush();
		out.close();
	}

	static class MyScanner {
		StringTokenizer st;
		BufferedReader br;

		public MyScanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public MyScanner(String filename) throws IOException {
			br = new BufferedReader(new FileReader(new File(filename)));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}
}
