307. Cipher

Time limit per test: 0.25 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard



ASN has just invented a brand new cipher. Its key is just a H x W matrix of 0's and 1's. A tool by Macrosoft is recommended to be used as a manager of those keys. This tool stores a fingerprint for each key to protect from storage failures. Such a fingerprint is an (H-1) x (W-1) matrix consisting of 2 x 2 sums; i.e., if A is the key and B is the fingerprint, then Bij=Aij+Ai+1,j+Ai,j+1+Ai+1,j+1. Given the fingerprint, you are to find at least one key with such fingerprint, or to report that the fingerprint is corrupt (in case no key can produce it).

Input
The first line of the input file contains two numbers, H and W (2 ≤ H, W ≤ 300). The next H-1 lines contain W-1 characters each with no spaces in between, describing the fingerprint. Each of those characters will be either
0
,
1
,
2
,
3
, or
4
.

Output
Output the key using the format similar to that of the input file: output H lines containing W characters (
0
or
1
) each, with no spaces in between.

If the fingerprint is corrupt, output
CORRUPT
on the only line of output.

Example(s)
sample input
sample output
3 4
222
222
0110
1001
0110




Online Contester Team © 2002 - 2010. All rights reserved.