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).
import java.util.*;

import java.io.*;
import java.math.*;
import java.awt.geom.*;

import static java.lang.Math.*;

public class Solution implements Runnable {

	long mod1 = (long) 1e9 + 7;
	int mod2 = 998244353;
	int n,m;
	char arr[][];
	int result[][],components[][],groupnumber[][];
	int start=0;
	boolean done[][],done1[][];

	public void solve() throws Exception {
	     n = sc.nextInt();
		 m = sc.nextInt();
		arr=new char[n][m];
		for(int i=0;i<n;i++)
		{
			arr[i]=sc.nextToken().toCharArray();
		}
		result=new int[n+100][m+100];
		components=new int[n+100][m+100];
		done=new boolean[n+100][m+100];
		done1=new boolean[n+100][m+100];
		groupnumber=new int[n+100][m+100];
		
		for(int i=0; i<n; i++)
		{
			for(int j=0; j<m; j++)
			{
				if(arr[i][j]=='.' && components[i][j]==0) {
				components[i][j]=dfs(i,j);
				groupnumber[i][j]=++start;
				dfs2(i,j,components[i][j]);
				}
			}
		}
		HashSet<Integer> group = new HashSet<>();
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<m;j++)
			{
				if(arr[i][j]=='*') {
					group = new HashSet<>();
				if(i-1>=0 && arr[i-1][j]=='.' && !group.contains(groupnumber[i-1][j]))
				{
					result[i][j]+=components[i-1][j];
					group.add(groupnumber[i-1][j]);
				}
				if(i+1<n && arr[i+1][j]=='.' && !group.contains(groupnumber[i+1][j]))
				{
					result[i][j]+=components[i+1][j];
					group.add(groupnumber[i+1][j]);
				}
				if(j-1>=0 && arr[i][j-1]=='.' && !group.contains(groupnumber[i][j-1]))
				{
					result[i][j]+=components[i][j-1];
					group.add(groupnumber[i][j-1]);
				}
				if(j+1<m && arr[i][j+1]=='.' && !group.contains(groupnumber[i][j+1]))
				{
					result[i][j]+=components[i][j+1];
					group.add(groupnumber[i][j+1]);
				}
				}
			}
		}
		
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<m;j++)
			{
				if(arr[i][j]=='*')
				{
					out.print((result[i][j]+1)%10);
				}
				else
				{
					out.print(".");
				}
				
			}
			out.println();
		}

	}
	
	public int dfs(int i, int j) {
		if(i<0 || i>=n || j<0 || j>=m || arr[i][j]=='*' || done[i][j]) return 0;
		int count=0;
		if(arr[i][j]=='.') count++;
		done[i][j]=true;
		if(i>0 && !done[i-1][j] && arr[i-1][j]=='.') {
            count+=dfs(i-1,j);
        }
        if(i<n-1 && !done[i+1][j] && arr[i+1][j]=='.') {
            count+=dfs(i+1,j);
        }
        if(j>0 && !done[i][j-1] && arr[i][j-1]=='.') {
            count+=dfs(i,j-1);
        }
        if(j<m-1 && !done[i][j+1] && arr[i][j+1]=='.') {
            count+=dfs(i,j+1);
        }
		return count;
		
	}
	
	public void dfs2(int i, int j,int value)
	{
		if(i<0 || i>=n || j<0 || j>=m || arr[i][j]=='*' || done1[i][j]) return;
		components[i][j]=value;
		groupnumber[i][j]=start;
		done1[i][j]=true;
		if(i>0 && !done1[i-1][j] && arr[i-1][j]=='.') {
            dfs2(i-1,j,value);
        }
        if(i<n-1 && !done1[i+1][j] && arr[i+1][j]=='.') {
            dfs2(i+1,j,value);
        }
        if(j>0 && !done1[i][j-1] && arr[i][j-1]=='.') {
            dfs2(i,j-1,value);
        }
        if(j<m-1 && !done1[i][j+1] && arr[i][j+1]=='.') {
            dfs2(i,j+1,value);
        }
	}
	
	

	static void sort(int[] a) {
		ArrayList<Integer> l = new ArrayList<>();
		for (int i : a)
			l.add(i);
		Collections.sort(l);
		for (int i = 0; i < a.length; i++)
			a[i] = l.get(i);
	}

	static long gcd(long a, long b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}

	static long ncr(int n, int r, long p) {
		if (r > n)
			return 0l;
		if (r > n - r)
			r = n - r;

		long C[] = new long[r + 1];

		C[0] = 1;

		for (int i = 1; i <= n; i++) {

			for (int j = Math.min(i, r); j > 0; j--)
				C[j] = (C[j] + C[j - 1]) % p;
		}
		return C[r] % p;
	}

	public long power(long x, long y, long p) {
		long res = 1;
		// out.println(x+" "+y);
		x = x % p;
		if (x == 0)
			return 0;

		while (y > 0) {
			if ((y & 1) == 1)
				res = (res * x) % p;
			y = y >> 1;
			x = (x * x) % p;
		}
		return res;
	}

	static Throwable uncaught;

	BufferedReader in;
	FastScanner sc;
	PrintWriter out;

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			sc = new FastScanner(in);
			solve();
		} catch (Throwable uncaught) {
			Solution.uncaught = uncaught;
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) throws Throwable {
		Thread thread = new Thread(null, new Solution(), "", (1 << 26));
		thread.start();
		thread.join();
		if (Solution.uncaught != null) {
			throw Solution.uncaught;
		}
	}

}

class FastScanner {

	BufferedReader in;
	StringTokenizer st;

	public FastScanner(BufferedReader in) {
		this.in = in;
	}

	public String nextToken() throws Exception {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	public int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}

	public int[] readArray(int n) throws Exception {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long nextLong() throws Exception {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws Exception {
		return Double.parseDouble(nextToken());
	}

}