984_B. Minesweeper
One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but he rarely won.

Alex has grown up since then, so he easily wins the most difficult levels. This quickly bored him, and he thought: what if the computer gave him invalid fields in the childhood and Alex could not win because of it?

He needs your help to check it.

A Minesweeper field is a rectangle n × m, where each cell is either empty, or contains a digit from 1 to 8, or a bomb. The field is valid if for each cell: 

  * if there is a digit k in the cell, then exactly k neighboring cells have bombs. 
  * if the cell is empty, then all neighboring cells have no bombs. 



Two cells are neighbors if they have a common side or a corner (i. e. a cell has at most 8 neighboring cells).

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the field.

The next n lines contain the description of the field. Each line contains m characters, each of them is "." (if this cell is empty), "*" (if there is bomb in this cell), or a digit from 1 to 8, inclusive.

Output

Print "YES", if the field is valid and "NO" otherwise.

You can choose the case (lower or upper) for each letter arbitrarily.

Examples

Input

3 3
111
1*1
111


Output

YES

Input

2 4
*.*.
1211


Output

NO

Note

In the second example the answer is "NO" because, if the positions of the bombs are preserved, the first line of the field should be *2*1.

You can read more about Minesweeper in Wikipedia's article.
```python
arr = []

def valid(i, j):
    bombs = 0
    if arr[i][j] == '*':
        return True
    if i != len(arr) - 1:
        if arr[i + 1][j] == '*':
            bombs += 1
    if i != 0:
        if arr[i - 1][j] == '*':
            bombs += 1
    if j != len(arr[0]) - 1:
        if arr[i][j + 1] == '*':
            bombs += 1
    if j != 0:
        if arr[i][j - 1] == '*':
            bombs += 1
    if i != 0 and j != 0:
        if arr[i-1][j - 1] == '*':
            bombs += 1
    if i != 0 and j != len(arr[0]) - 1:
        if arr[i-1][j + 1] == '*':
            bombs += 1
    if i != len(arr) - 1 and j != 0:
        if arr[i+1][j - 1] == '*':
            bombs += 1
    if i != len(arr) - 1 and j != len(arr[0]) - 1:
        if arr[i+1][j + 1] == '*':
            bombs += 1
    if bombs == 0 and (arr[i][j] == '.'):
        return True
    if arr[i][j] == '.':
        return False
    if int(arr[i][j]) == bombs:
        return True
    return False


n, m = list(map(int, input().split()))


for i in range(n):
    line = input()
    arr2 = []
    for j in range(m):
        arr2.append(line[j:j+1])
    arr.append(arr2)

ans = "YES"

for i in range(n):
    for j in range(m):
        if not valid(i, j):
            ans = "NO"

print(ans)



```