#include <iostream>
#include <stdio.h>
using namespace std;
int main( )
{
int i ;
int j ;
int c = 1 ;
char ar[ 102 ] [ 102 ] ;
while ( scanf ( "%d %d" , & i, & j) == 2 && i && j)
{
if ( c ! = 1 ) printf ( "\n " ) ;
if ( i == 0 && j == 0 )
break ;
for ( int m = 0 ; m< i; m++ )
{
for ( int n = 0 ; n< j; n++ )
{
cin >> ar[ m] [ n] ;
}
}
//cout<<endl;
//cout<<"Field #"<<c<<":"<<endl;
printf ( "Field #%d:\n " , c++ ) ;
int number[ 102 ] [ 102 ] = { 0 } ;
for ( int m= 0 ; m< i; m++ )
{
for ( int n= 0 ; n< j; n++ )
{
if ( ar[ m] [ n] == '*' )
continue ;
for ( int a= - 1 ; a<= 1 ; a++ )
{
for ( int b= - 1 ; b<= 1 ; b++ )
{
if ( m+ a < 0 || m+ a > i || n+ b < 0 || n+ b> j )
continue ;
if ( m+ a== i&& n+ b== j)
continue ;
if ( ar[ m+ a] [ n+ b] == '*' )
{
number[ m] [ n] ++ ;
}
}
}
}
}
for ( int u= 0 ; u< i; u++ )
{
for ( int v= 0 ; v< j; v++ )
{
if ( ar[ u] [ v] == '*' )
cout << '*' ;
else
cout << number[ u] [ v] ;
}
cout << endl;
}
//cout<<endl;
i= 0 ;
j
I2luY2x1ZGUgPGlvc3RyZWFtPgoKI2luY2x1ZGUgPHN0ZGlvLmg+CgoKCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgoKCmludCBtYWluKCkKCnsKCglpbnQgaSA7CgoJaW50IGogOwoKCQoKCWludCBjID0xOwoKCWNoYXIgYXJbMTAyXVsxMDJdOwoKCXdoaWxlKHNjYW5mKCIlZCAlZCIsICZpLCAmaikgPT0gMiAmJiBpICYmIGopCgoJewoKCQkJaWYgKGMgIT0gMSkgcHJpbnRmKCJcbiIpOyAKCgkJCgoJCQoKCQkKCgkJaWYgKGkgPT0wJiZqID09MCkKCgkJYnJlYWs7CgoJCQoKCQkKCgkJCgoJCWZvciAoaW50IG0gPSAw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