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.*;

public class C {

    static char f[][];
    static int color[][];
    static int size[];
    static int n, m;

    static void paint(int i, int j, int col) {
        if (i < 0 || j < 0 || i >= n || j >= m) return;
        if (f[i][j] != '.') return;
        if (color[i][j] != 0) return;

        color[i][j] = col;
        size[col]++;

        for (int di = -1; di <= 1; di++)
            for (int dj = -1; dj <= 1; dj++)
                if (di * di + dj * dj == 1)
                    paint(i + di, j + dj, col);
    }

    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        n = in.nextInt();
        m = in.nextInt();
        f = new char[n][];
        for (int i = 0; i < n; i++) f[i] = in.next().toCharArray();

        color = new int[n][m];
        size = new int[n * m + 1];
        int colCnt = 0;
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
                if (f[i][j] == '.' && color[i][j] == 0)
                    paint(i, j, ++colCnt);

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (f[i][j] == '.')  continue;
                Set<Integer> s = new TreeSet<>();
                int ans = 1;
                for (int di = -1; di <= 1; di++) {
                    for (int dj = -1; dj <= 1; dj++) {
                        if (di * di + dj * dj != 1) continue;
                        if (i + di < 0 || j + dj < 0 || i + di >= n || j + dj >= m) continue;
                        if (s.contains(color[i + di][j + dj])) continue;
                        ans += size[color[i + di][j + dj]];
                        s.add(color[i + di][j + dj]);
                    }
                }
                f[i][j] = (char) ('0' + (ans % 10));
            }
        }
        for (int i = 0; i < n; i++) {
            out.println(f[i]);
        }
        out.close();
    }

    static PrintWriter out;
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner() { br = new BufferedReader(new InputStreamReader(System.in)); }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try { st = new StringTokenizer(br.readLine()); }
                catch (IOException e) { e.printStackTrace(); }
            }
            return st.nextToken();
        }
        int nextInt() { return Integer.parseInt(next()); }
        long nextLong() { return Long.parseLong(next()); }
        double nextDouble() { return Double.parseDouble(next());}
        String nextLine(){
            String str = "";
            try { str = br.readLine();}
            catch (IOException e) { e.printStackTrace(); }
            return str;
        }
    }

}
