시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 369 191 167 52.188%

문제

창영이는 크로스워드 퍼즐을 매우 좋아한다. 세계에 존재하는 모든 크로스워드 퍼즐을 다 푼 창영이는 이제 퍼즐을 예쁘게 장식하려고 한다.

퍼즐은 총 M×N개의 글자로 이루어져 있다. 창영이는 위에 U개, 왼쪽에 L개, 오른쪽에 R개, 아래에 D개 두께로 글자를 추가해 퍼즐을 장식하려고 한다.

장식은 #와 .로 이루어져 있으며, 체스판과 같은 형태로 장식한다. 크로스워드 퍼즐을 체스판 위에 올려놓는 다고 생각을 하면 되며, 빨간 칸에 #를 채운다. 아래 예제를 참고하는 것이 좋다.

입력

첫재 줄에 M과 N이 주어진다. (1 ≤ M, N ≤ 10)

둘째 줄에 U, L, R, D (0 ≤ U, L, R, D ≤ 5)가 주어진다.

다음 M개 줄에는 크로스워드 퍼즐을 나타내는 N개의 글자가 주어진다.

출력

예쁘게 장식한 크로스워드 퍼즐을 출력한다.

예제 입력 1

4 4
2 2 2 2
honi
oker
nera
irak

예제 출력 1

#.#.#.#.
.#.#.#.#
#.honi#.
.#oker.#
#.nera#.
.#irak.#
#.#.#.#.
.#.#.#.#
W3sicHJvYmxlbV9pZCI6Ijk2MjYiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQwNmNcdWI4NWNcdWMyYTRcdWM2Y2NcdWI0ZGMgXHVkMzdjXHVjOTkwIiwiZGVzY3JpcHRpb24iOiI8cD5cdWNjM2RcdWM2MDFcdWM3NzRcdWIyOTQgXHVkMDZjXHViODVjXHVjMmE0XHVjNmNjXHViNGRjIFx1ZDM3Y1x1Yzk5MFx1Yzc0NCBcdWI5ZTRcdWM2YjAgXHVjODhiXHVjNTQ0XHVkNTVjXHViMmU0LiBcdWMxMzhcdWFjYzRcdWM1ZDAgXHVjODc0XHVjN2FjXHVkNTU4XHViMjk0IFx1YmFhOFx1YjRlMCBcdWQwNmNcdWI4NWNcdWMyYTRcdW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