You are given an H × W grid.
The squares in the grid are described by H strings, S_1,...,S_H.
The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
`.` stands for an empty square, and `#` stands for a square containing a bomb.

Dolphin is interested in how many bomb squares are horizontally, vertically or diagonally adjacent to each empty square.
(Below, we will simply say "adjacent" for this meaning. For each square, there are at most eight adjacent squares.)
He decides to replace each `.` in our H strings with a digit that represents the number of bomb squares adjacent to the corresponding empty square.

Print the strings after the process.

Constraints

* 1 \leq H,W \leq 50
* S_i is a string of length W consisting of `#` and `.`.

Input

Input is given from Standard Input in the following format:


H W
S_1
:
S_H


Output

Print the H strings after the process.
The i-th line should contain a string T_i of length W, where the j-th character in T_i corresponds to the square at the i-th row from the top and j-th row from the left in the grid (1 \leq i \leq H, 1 \leq j \leq W).

Examples

Input

3 5
.....
.#.#.
.....


Output

11211
1#2#1
11211


Input

3 5


Output




Input

6 6
.
.#.##
.#
.#..#.
.##..
.#...


Output

3
8#7##
5#
4#65#2
5##21
4#310
#include <bits/stdc++.h>
using namespace std;
class MYCP {
 public:
  static string MakeString_LongLong(vector<long long> const& numbers,
                                    string const& str) {
    if (numbers.size() == 0) return "";
    string result = "" + to_string(numbers[0]);
    for (long long i = 1; i < numbers.size(); i++) {
      result += str;
      result += to_string(numbers[i]);
    }
    return result;
  }
  static string MakeString_LongLong(vector<long long> const& numbers) {
    if (numbers.size() == 0) return "";
    string result = "" + to_string(numbers[0]);
    for (long long i = 1; i < numbers.size(); i++) {
      result += " ";
      result += to_string(numbers[i]);
    }
    return result;
  }
  static string MakeString_VectorString(vector<string> const& str) {
    string result = "";
    for (long long i = 0; i < str.size(); i++) {
      result += str[i] + "\n";
    }
    return result;
  }
  static vector<string> MyReadLineSplit(long long n) {
    vector<string> str(n);
    for (long long i = 0; i < n; i++) {
      std::cin >> str[i];
    }
    return str;
  }
  static vector<long long> ReadInts(long long number) {
    vector<long long> a(number);
    for (int i = 0; i < number; i++) {
      std::cin >> a[i];
    }
    return a;
  }
  static bool PrimeCheck_Int(long long number) {
    if (number < 2) return false;
    for (unsigned long long i = 2; i * i <= number; i++) {
      if (number % i == 0) return false;
    }
    return true;
  }
  static vector<long long> MakePrimeList(long long n) {
    vector<long long> list;
    long long i, j, p;
    bool flag;
    for (i = 2; i <= n; i++) {
      flag = true;
      for (j = 0; j < list.size(); j++) {
        if (!(list[j] * list[j] <= i)) break;
        if (i % list[j] == 0) {
          flag = false;
          break;
        }
      }
      if (flag) list.push_back(i);
    }
    return list;
  }
  static vector<string> split(string const& str, char sep) {
    vector<std::string> v;
    auto first = str.begin();
    while (first != str.end()) {
      auto last = first;
      while (last != str.end() && *last != sep) last++;
      v.push_back(string(first, last));
      if (last != str.end()) last++;
      first = last;
    }
    return v;
  }
  static long long Sum(vector<long long> a) {
    long long i, sum = 0;
    for (i = 0; i < a.size(); i++) {
      sum += a[i];
    }
    return sum;
  }
  static bool Komoji(char a) {
    if (a >= 'a' && a <= 'z') return true;
    return false;
  }
  static bool Oomoji(char a) {
    if (a >= 'A' && a <= 'Z') return true;
    return false;
  }
  static long long GreatestCommonFactor(long long a, long long b) {
    long long temp;
    if (a < b) {
      temp = b;
      b = a;
      a = temp;
    }
    while (true) {
      temp = a % b;
      a = b;
      b = temp;
      if (b == 0) break;
    }
    return a;
  }
  static long long LeastCommonMultiple(long long a, long long b) {
    return (a / GreatestCommonFactor(a, b)) * b;
  }
};
class Syakutori {
 private:
  vector<long long> list;

 public:
  void MakeArray(vector<long long> data) {
    long long i;
    list = data;
    list.push_back(0);
    list[0] = 0;
    for (i = 1; i < list.size(); i++) {
      list[i] = list[i - 1] + data[i - 1];
    }
  }
  long long Sum(long long start, long long end) {
    if (end < start) {
      cout << "startがendより大きいです";
      return 0;
    }
    if (start < 0 || end >= list.size()) {
      cout << "範囲が異常";
      return 0;
    }
    return list[end] - list[start];
  }
};
int main(void) {
  int h, w;
  cin >> h >> w;
  h += 2;
  w += 2;
  vector<string> s(h);
  for (int i = 0; i < (int)(h); i++) {
    if (i == 0) i++;
    cin >> s[i];
    s[i] = 'x' + s[i] + 'x';
  }
  for (int i = 0; i < (int)(w); i++) {
    s[0][i] = 'x';
    s[h - 1][i] = 'x';
  }
  for (int i = 0; i < (int)(h); i++) {
    for (int j = 0; j < (int)(w); j++) {
      if (s[i][j] == '.') {
        s[i][j] = 0;
        for (int k = 0; k < (int)(3); k++) {
          for (int l = 0; l < (int)(3); l++) {
            if (s[i - 1 + k][i - 1 + l] == '#') {
              s[i][j]++;
            }
          }
        }
      }
    }
  }
  h--;
  w--;
  for (int i = 0; i < (int)(h); i++) {
    if (i == 0) i += (int)(1);
    for (int j = 0; j < (int)(w); j++) {
      if (j == 0) j += (int)(1);
      cout << s[i][j];
    }
    cout << endl;
  }
  return 0;
}
