#C6496. Matrix Transformation

    ID: 50262 Type: Default 1000ms 256MiB

Matrix Transformation

Matrix Transformation

You are given a matrix of dimensions \(M \times N\). Your task is to transform the matrix using the following rules:

  • If an element is even, it remains unchanged.
  • If an element is odd, increment it by 1.

In mathematical notation, for each element \(a_{ij}\), the transformed value \(a'_{ij}\) is defined as:

\[ a'_{ij} = \begin{cases} a_{ij} & \text{if } a_{ij} \text{ is even} \\ a_{ij} + 1 & \text{if } a_{ij} \text{ is odd} \end{cases} \]

Output the transformed matrix with the same dimensions as the input.

inputFormat

The first line of input contains two integers \(M\) and \(N\), representing the number of rows and columns of the matrix, respectively. Each of the following \(M\) lines contains \(N\) space-separated integers, representing a row of the matrix.

outputFormat

Output the transformed matrix in the same format as the input. Print \(M\) lines, each containing \(N\) space-separated integers.

## sample
3 3
2 3 4
5 6 7
8 9 10
2 4 4

6 6 8 8 10 10

</p>