You got an old map, which turned out to be drawn by the infamous pirate "Captain Q". It shows the locations of a lot of treasure chests buried in an island.

The map is divided into square sections, each of which has a digit on it or has no digit. The digit represents the number of chests in its 9 neighboring sections (the section itself and its 8 neighbors). You may assume that there is at most one chest in each section.

Although you have the map, you can't determine the sections where the chests are buried. Even the total number of chests buried in the island is unknown. However, it is possible to calculate the minimum number of chests buried in the island. Your mission in this problem is to write a program that calculates it.



Input

The input is a sequence of datasets. Each dataset is formatted as follows.

h w
map

The first line of a dataset consists of two positive integers h and w. h is the height of the map and w is the width of the map. You may assume 1≤h≤15 and 1≤w≤15.

The following h lines give the map. Each line consists of w characters and corresponds to a horizontal strip of the map. Each of the characters in the line represents the state of a section as follows.

'.': The section is not a part of the island (water). No chest is here.

'*': The section is a part of the island, and the number of chests in its 9 neighbors is not known.

'0'-'9': The section is a part of the island, and the digit represents the number of chests in its 9 neighbors.

You may assume that the map is not self-contradicting, i.e., there is at least one arrangement of chests. You may also assume the number of sections with digits is at least one and at most 15.

A line containing two zeros indicates the end of the input.

Output

For each dataset, output a line that contains the minimum number of chests. The output should not contain any other character.

Examples

Input

5 6


Output

6


Input

5 6
*2.2**
..*...
..2...
..*...
*2.2**
6 5
.*2*.
..*..
..*..
..2..
..*..
.*2*.
5 6
.1111.
**...*
33....
**...0
.*2**.
6 9
....1....
...1.1...
....1....
.1..*..1.
1.1***1.1
.1..*..1.
9 9
*********
*4*4*4*4*
*********
*4*4*4*4*
*********
*4*4*4*4*
*********
*4*4*4***
*********
0 0


Output

6
5
5
6
23
#pragma GCC optimize "O3"

#define F first
#define S second
#define ALL(x) x.begin(), x.end()

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef pair<LL, int> PLI;

constexpr int N = 19, INF = INT_MAX / 2;
const int di[9] = {-1, -1, -1,  0, 0, 0,  1, 1, 1};
const int dj[9] = {-1,  0,  1, -1, 0, 1, -1, 0, 1};

int h, w, chts, digs, idigs[N], jdigs[N], ichts[N*N], jchts[N*N];
LL pw10[N];
char t[N][N];
bool poss[N][N];
map<PLI, int> dp;

inline bool in_border(int i, int j) {
  return i >= 0 && j >= 0 && i < h && j < w;
}
PLI init() {
  chts = digs = 0;
  dp.clear();
  for(int i = 0; i < h; ++i) {
    scanf("%s", t[i]);
    fill_n(poss[i], w, false);
  }
  PLI cur = {0, 0};
  for(int i = 0; i < h; ++i)
    for(int j = 0; j < w; ++j)
      if(isdigit(t[i][j])) {
        idigs[digs] = i;
        jdigs[digs] = j;
        cur.F += pw10[digs] * (t[i][j] - '0');
        ++digs;
        for(int k = 0; k < 9; ++k) {
          int ni = i + di[k], nj = j + dj[k];
          if(in_border(ni, nj) && t[ni][nj] != '.')
            poss[ni][nj] = true;
        }
      }
  for(int i = 0; i < h; ++i)
    for(int j = 0; j < w; ++j)
      if(poss[i][j]) {
        ichts[chts] = i;
        jchts[chts] = j;
        ++chts;
      }
  return cur;
}
inline bool is_near(int i, int j) {
  return abs(idigs[i] - ichts[j]) <= 1 && abs(jdigs[i] - jchts[j]) <= 1;
}
inline bool not_enough(PLI cur) {
  for(int i = 0; i < digs; ++i) {
    int tcnt = 0;
    for(int j = cur.S; j < chts; ++j)
      if(is_near(i, j))
        ++tcnt;
    if(tcnt < cur.F % pw10[i+1] / pw10[i])
      return true;
  }
  return false;
}
bool can_put(PLI cur) {
  for(int i = 0; i < digs; ++i)
    if(is_near(i, cur.S) && cur.F % pw10[i+1] / pw10[i] == 0)
      return false;
  return true;
}
LL process(PLI cur) {
  for(int i = 0; i < digs; ++i)
    if(is_near(i, cur.S))
      cur.F -= pw10[i];
  return cur.F;
}
int dfs(PLI cur) {
  if(dp.count(cur))
    return dp[cur];
  if(not_enough(cur))
    return dp[cur] = INF;
  if(cur.S == chts)
    return dp[cur] = 0;
  int rtn = INF;
  if(can_put(cur))
    rtn = min(rtn, dfs({process(cur), cur.S+1}) + 1);
  rtn = min(rtn, dfs({cur.F, cur.S+1}));
  dp[cur] = rtn;
  return rtn;
}
int main() {
  pw10[0] = 1;
  for(int i = 1; i < N; ++i)
    pw10[i] = pw10[i-1] * 10;
  while(scanf("%d %d", &h, &w) && (h+w))
    printf("%d\n", dfs(init()));
}

