Problem: 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

Solution (in CPP):

Solution:
#include<iostream>
#include<map>
#include<cmath>
using namespace std;

#define f(i,a) for(int i=0;i<a;i++)
#define absc(x) abs(ir[i]-row[x])<2&&abs(ic[i]-col[x])<2

char str[17][17];
int dx[]={-1,-1,-1,0,0,0,1,1,1},dy[]={-1,0,1,-1,0,1,-1,0,1};
int u[17][17],v[17][17],ir[17],ic[17];
int row[300],col[300];
int id,sz,a,b;
long long p[17];

struct st{
    long long v;
    int i;
    st(){i=0,v=0;}
};
bool operator<(const st& a,const st& b){
    return a.v!=b.v?a.v<b.v:a.i<b.i;
}
map<st,int>dp;
int solve(int a,st b){
    if(dp.count(b))return dp[b];
    f(i,id){
        int cnt=0;
        for(int j=a;j<sz;j++)
            if(absc(j))cnt++;
        if(cnt<b.v%p[i+1]/p[i])
            return dp[b]=1e9;
    }
    if(a==sz)return dp[b]=0;
    int ret=1e9;
    b.i++;
    bool ne=true;
    f(i,id)if(absc(a)&&b.v%p[i+1]/p[i]==0)ne=false;
    if(ne){
        f(i,id)if(absc(a))b.v-=p[i];
        ret=min(ret,solve(a+1,b)+1);
        f(i,id)if(absc(a))b.v+=p[i];
    }
    ret=min(ret,solve(a+1,b));
    b.i--;
    return dp[b]=ret;
}
int main(){
    p[0]=1;
    for(int i=1;i<17;i++)p[i]=p[i-1]*10;
    while(cin>>a>>b,a){
        id=sz=0;
        dp.clear();
        st w;
        f(i,a)
            cin>>str[i];
        f(i,a)f(j,b)
            v[i][j]=u[i][j]=0;
        f(i,a)f(j,b)
            if('0'<=str[i][j]&&str[i][j]<='9'){
                ir[id]=i;
                ic[id]=j;
                w.v+=p[id++]*(str[i][j]-'0');
                v[i][j]=str[i][j]-'0';
                f(k,9)
                    if(0<=i+dx[k]&&i+dx[k]<a&&0<=j+dy[k]&&j+dy[k]<b&&str[i+dx[k]][j+dy[k]]!='.')
                        u[i+dx[k]][j+dy[k]]++;
            }
        f(i,a)f(j,b)if(u[i][j])
            row[sz]=i,col[sz++]=j;
        cout<<solve(0,w)<<endl;
    }
}