You are given a rectangular field of n × m cells. Each cell is either empty or impassable (contains an obstacle). Empty cells are marked with '.', impassable cells are marked with '*'. Let's call two empty cells adjacent if they share a side.

Let's call a connected component any non-extendible set of cells such that any two of them are connected by the path of adjacent cells. It is a typical well-known definition of a connected component.

For each impassable cell (x, y) imagine that it is an empty cell (all other cells remain unchanged) and find the size (the number of cells) of the connected component which contains (x, y). You should do it for each impassable cell independently.

The answer should be printed as a matrix with n rows and m columns. The j-th symbol of the i-th row should be "." if the cell is empty at the start. Otherwise the j-th symbol of the i-th row should contain the only digit —- the answer modulo 10. The matrix should be printed without any spaces.

To make your output faster it is recommended to build the output as an array of n strings having length m and print it as a sequence of lines. It will be much faster than writing character-by-character.

As input/output can reach huge size it is recommended to use fast input/output methods: for example, prefer to use scanf/printf instead of cin/cout in C++, prefer to use BufferedReader/PrintWriter instead of Scanner/System.out in Java.

Input

The first line contains two integers n, m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the field.

Each of the next n lines contains m symbols: "." for empty cells, "*" for impassable cells.

Output

Print the answer as a matrix as described above. See the examples to precise the format of the output.

Examples

Input

3 3
*.*
.*.
*.*


Output

3.3
.5.
3.3


Input

4 5
**..*
..***
.*.*.
*.*.*


Output

46..3
..732
.6.4.
5.4.3

Note

In first example, if we imagine that the central cell is empty then it will be included to component of size 5 (cross). If any of the corner cell will be empty then it will be included to component of size 3 (corner).
//package math_codet;

import java.io.*;
import java.util.*;
import java.math.*;
 /******************************************
*    AUTHOR:         AMAN KUMAR SINGH        *
*    INSTITUITION:   KALYANI GOVERNMENT ENGINEERING COLLEGE  *
******************************************/
public class lets_do {
    InputReader in;
    PrintWriter out;
    Helper_class h;
    final long mod=1000000007;
    final int N=200005;
    int MAX_Ai=100005;
    public static void main(String[] args) throws java.lang.Exception{
        new lets_do().run();
    }
    void run() throws Exception{
        in=new InputReader(System.in);
        out = new PrintWriter(System.out);
        h = new Helper_class();
        int t=1;
        while(t-->0){
            solve();
        }
        out.flush();    
        out.close();
    }
    boolean[][] visited;
    int[][] which_comp;
    int[] comp_val;
    int size=0;
    int[][] arr;
    int n, m;
    void dfs(int i, int j, int cnt){
    	size++;
    	which_comp[i][j]=cnt;
    	visited[i][j]=true;
    	if(i-1>=0 && !visited[i-1][j] && arr[i-1][j]==1)
    		dfs(i-1,j,cnt);
    	if(j-1>=0 && !visited[i][j-1] && arr[i][j-1]==1)
    		dfs(i,j-1,cnt);
    	if(i+1<n && !visited[i+1][j] && arr[i+1][j]==1)
    		dfs(i+1,j,cnt);
    	if(j+1<m && !visited[i][j+1] && arr[i][j+1]==1)
    		dfs(i,j+1,cnt);
    }
    void solve(){
        n=h.ni();
        m=h.ni();
        arr=new int[n][m];
        which_comp=new int[n][m];
        comp_val=new int[n*m];
        int i=0,j=0;
        ArrayList<Integer> dot=new ArrayList<Integer>();
        for(i=0;i<n;i++){
        	String st=h.n();
        	for(j=0;j<m;j++){
        		if(st.charAt(j)=='*')
        			arr[i][j]=0;
        		else{
        			dot.add(i*m+j);
        			arr[i][j]=1;
        		}
        	}
        }
        visited=new boolean[n][m];
        int cnt=0;
        for(i=0;i<dot.size();i++){
        	int x=dot.get(i)/m;
        	int y=dot.get(i)%m;
        	//h.pn(x+" "+y);
        	if(!visited[x][y]){
        		size=0;
        		dfs(x,y,cnt);
        		comp_val[cnt]=size;
        		//h.pn(x+" "+y+" "+cnt+" "+size);
        		cnt++;
        	}
        }
        for(i=0;i<n;i++){
        	for(j=0;j<m;j++){
        		if(arr[i][j]==0){
        			int sum=1;
        			HashSet<Integer> hset=new HashSet<Integer>();
        			if(i-1>=0 && arr[i-1][j]==1){
        				int which=which_comp[i-1][j];
        				hset.add(which);
        				//sum+=comp_val[which];
        			}
        			if(i+1<n && arr[i+1][j]==1){
        				int which=which_comp[i+1][j];
        				hset.add(which);
        				//sum+=comp_val[which];
        			}
        			if(j-1>=0 && arr[i][j-1]==1){
        				int which=which_comp[i][j-1];
        				hset.add(which);
        				//sum+=comp_val[which];
        			}
        			if(j+1<m && arr[i][j+1]==1){
        				int which=which_comp[i][j+1];
        				hset.add(which);
        				//sum+=comp_val[which];
        			}
        			for(int v: hset)
        			    sum+=comp_val[v];
        			h.p(sum%10);
        		}
        		else
        			h.p(".");
        	}
        	h.pn("");
        }
    }

    final Comparator<Entity> com=new Comparator<Entity>(){
        public int compare(Entity x, Entity y){
            int xx=Integer.compare(y.a,x.a);
            if(xx==0){
                int xxx=Integer.compare(y.b,x.b);
                if(xxx==0)
                    return Integer.compare(x.c,y.c);
                else
                    return xxx;
            }
            else
                return xx;
        }
    };
    class Entity{
        int a;
        int b;
        int c;
        Entity(int p, int q, int r){
            a=p;
            b=q;
            c=r;
        }
    }
    

    class Helper_class{
        long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
        int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
        long gcd1(long a, long b){return (b==0)?a:gcd(b,a%b);}
        int bitcount(long n){return (n==0)?0:(1+bitcount(n&(n-1)));}
        void p(Object o){out.print(o);}
        void pn(Object o){out.println(o);}
        void pni(Object o){out.println(o);out.flush();}
        String n(){return in.next();}
        String nln(){return in.nextLine();}
        int ni(){return in.nextInt();}
        long nl(){return in.nextLong();}
        double nd(){return in.nextDouble();}

        long mul(long a,long b){
            if(a>=mod)a%=mod;
            if(b>=mod)b%=mod;
            a*=b;
            if(a>=mod)a%=mod;
            return a;
        }
        long modPow(long a, long p){
            long o = 1;
            while(p>0){
                if((p&1)==1)o = mul(o,a);
                a = mul(a,a);
                p>>=1;
            }
            return o;
        }
        long add(long a, long b){
            if(a>=mod)a%=mod;
            if(b>=mod)b%=mod;
            if(b<0)b+=mod;
            a+=b;
            if(a>=mod)a-=mod;
            return a;
        }
    }

    class InputReader{
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
 
        public InputReader(InputStream stream) {
            this.stream = stream;
        }
 
        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }
 
        public void skip(int x) {
            while (x-- > 0)
                read();
        }
 
        public int nextInt() {
            return Integer.parseInt(next());
        }
 
        public long nextLong() {
            return Long.parseLong(next());
        }
 
        public String nextString() {
            return next();
        }
 
        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
 
            return res.toString();
        }
 
        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }
 
        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
 
        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }
 
        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }
}