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
import Data.List(sortBy, groupBy)
import Data.Ord(comparing)
import Control.Monad(forM_)

type Point = (Int, Int)
type Row = [(Int, String)]

type Score = (Point, String)

main = do
  ns <- lines <$> getContents
  let h = read $ head $ words $ head ns
  let w = read $ last $ words $ head ns
  let lines = tail ns
  let res = solve h w lines
  forM_ res putStrLn 

newRow :: String -> Row
newRow src = filter (\(y, v) -> v == "#") $ zipWith (\n v -> (n, if v == '.' then "0" else "#")) [0 .. (subtract 1 $ length src)] src

makePs :: Score -> [Point]
makePs ((x, y), v) = [(x', y') | x'<- [(subtract 1 x) .. (x + 1)], y'<- [(subtract 1 y) .. (y + 1)], (x,y) /= (x', y')]

sortPs :: Point -> Point -> Ordering
sortPs (x1, y1) (x2, y2)
  | x1 < x2 = LT
  | and [x1 == x2, y1 < y2] = LT
  | x1 > x2 = GT
  | and [x1 == x2, y1 > y2] = GT
  | and [x1 == x2, y1 == y2] = EQ

eqPs :: Point -> Point -> Bool
eqPs (x1, y1) (x2, y2)
  | and [x1 == x2, y1 == y2] = True
  | otherwise = False

sortedPs :: [String] -> [[Point]]
sortedPs s = groupBy eqPs $ sortBy sortPs $ concatMap makePs $ getMs s

countPs :: [[Point]] -> [Score]
countPs ps = zipWith (\p c -> ((head p), show c)) ps (map length ps)

preChoose :: Point -> [Score] -> Score
preChoose p ss
  | 0 < length res = head res
  | otherwise = ((0, 0), "0")
  where
    res = filter (\s -> p == (fst s)) ss

choose :: [Score] -> [Score] -> Point -> Score
choose ms ss p
  | snd v == "#" = v
  | otherwise = preChoose p ss
  where
    v =  preChoose p ms

grByP :: Score -> Score -> Bool
grByP ((ax, ay), av) ((bx, by), bv) 
  | ax == bx = True
  | otherwise = False

toShow :: [Score] -> String
toShow ss = concat $ map (\s -> snd s) ss

solve :: Int -> Int -> [String] -> [String]
solve h w line = map toShow ls
  where
    ps = [(x, y) | x <- [0 .. subtract 1 h], y <- [0 .. subtract 1 w]]
    ms = getMs line
    ss = countPs (sortedPs line)
    res = map (choose ms ss) ps
    ls = groupBy grByP res

ps = [(x :: Int , y :: Int ) | x <- [0 .. 2] , y <- [0 .. 2]]
ms = getMs ["#..", ".#.", "..#"]
ss = countPs $ sortedPs ["#..", ".#.", "..#"]

getMs :: [String] -> [Score]
getMs ls = wrap (zip [0 .. length ls] (map fspl ls)) []

wrap :: [(Int,[(Int, Char)])] -> [Score] -> [Score]
wrap [] acc = acc
wrap ns acc = wrap (tail ns) (elm ++ acc)
  where 
    h = head ns
    x = fst h
    src = snd h
    elm = conv x src [] 

conv :: Int -> [(Int, Char)] -> [Score] -> [Score]
conv x [] acc = acc
conv x src acc = conv x (tail src) acc'
  where
    h = head src
    val = snd h
    acc' = if val == '#' then ((x, fst h), "#") : acc
          else acc 

fspl :: String -> [(Int, Char)]
fspl s = zip [0 .. length s] s