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.io.*;
import java.lang.ref.WeakReference;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.Clock;
import java.util.*;


public class Main {
    private static int[][] direct = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}};
    private static AWriter writer = new AWriter(System.out);
    private static AReader reader = new AReader(System.in);
    private static int n;
    private static int m;
    private static int[][] map;
    private static int[][] mark;
    private static int[][] out;
    private static int[] sum;
    private static int cnt=2;
    private final static int MAXN=27501321;
    public static void main(String[] args) throws IOException {
        m=reader.nextInt();
        n=reader.nextInt();
        map=new int[m+1][n+1];
        mark=new int[m+1][n+1];
        out=new int[m+1][n+1];
        sum=new int[1000000];
        for(int i=1;i<=m;i++){
            char[] temp=reader.next().toCharArray();
            for(int j=1;j<=n;j++){
                if(temp[j-1]=='.')
                    map[i][j]=1;
            }
        }
        for(int i=1;i<=m;i++){
            for(int j=1;j<=n;j++){
                if(map[i][j]==1){
                    map[i][j]=cnt;
                    dfs(i,j);
                    cnt++;
                }
            }
        }
        for(int i=1;i<=m;i++) {
            for (int j = 1; j <= n; j++) {
                if (map[i][j] != 0) {
                    sum[map[i][j]]++;
                }
            }
        }
        for(int i=1;i<=m;i++){
            for(int j=1;j<=n;j++){
                if(map[i][j]!=0)
                    continue;
                Set<Integer> temp=new HashSet<>();
                for(int k=0;k<4;k++){
                    int toX=i+direct[k][0];
                    int toY=j+direct[k][1];
                    if(judge2(toX,toY)&&map[toX][toY]!=0){
                        temp.add(map[toX][toY]);
                    }
                }
                out[i][j]=1;
                for(Integer t:temp){
                    out[i][j]+=sum[t];
                }
            }
        }
        for(int i=1;i<=m;i++){
            for(int j=1;j<=n;j++){
                if(out[i][j]==0)
                    writer.print('.');
                else
                    writer.print(out[i][j]%10);
            }
            writer.println("");
        }
        writer.close();
        reader.close();
    }
    private static void dfs(int x,int y){
        for(int i=0;i<4;i++){
            int toX=x+direct[i][0];
            int toY=y+direct[i][1];
            if(judge(toX,toY)){
                map[toX][toY]=cnt;
                dfs(toX,toY);
            }
        }
    }
    private static final boolean judge(int x,int y){
        return x<=m&&x>0&&y<=n&&y>0&&map[x][y]==1;
    }
    private static final boolean judge2(int x,int y){
        return x<=m&&x>0&&y<=n&&y>0;
    }
}

class AReader implements Closeable {
    private BufferedReader reader;
    private StringTokenizer tokenizer;
    public AReader(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
        tokenizer = new StringTokenizer("");
    }
    private String innerNextLine() {
        try {
            return reader.readLine();
        } catch (IOException ex) {
            return null;
        }
    }
    public boolean hasNext() {
        while (!tokenizer.hasMoreTokens()) {
            String nextLine = innerNextLine();
            if (nextLine == null) {
                return false;
            }
            tokenizer = new StringTokenizer(nextLine);
        }
        return true;
    }
    public String nextLine() {
        tokenizer = new StringTokenizer("");
        return innerNextLine();
    }
    public String next() {
        hasNext();
        return tokenizer.nextToken();
    }
    public int nextInt() {
        return Integer.valueOf(next());
    }
    public long nextLong() {
        return Long.valueOf(next());
    }
    public double nextDouble() {
        return Double.valueOf(next());
    }
    public BigDecimal nextBigDecimal(){ return new BigDecimal(next()); }
    public BigInteger nextBigInteger() {
        return new BigInteger(next());
    }
    @Override
    public void close() throws IOException {
        reader.close();
    }
}

// Fast writer for ACM By Azure99
class AWriter implements Closeable {
    private BufferedWriter writer;

    public AWriter(OutputStream outputStream) {
        writer = new BufferedWriter(new OutputStreamWriter(outputStream));
    }

    public void print(Object object) throws IOException {
        writer.write(object.toString());
    }

    public void println(Object object) throws IOException {
        writer.write(object.toString());
        writer.write("\n");
    }

    @Override
    public void close() throws IOException {
        writer.close();
    }
}