MATH2 - Math II

no tags 

Background

This is a mathematical(?) problem. See problem MATH1 and AMATH.

Input

The first line of the input contains a single integer c(1<=c<=2).

The second line contains 3 integer numbers separated by single spaces, D(1<=D<=1 000 000 000),n(1<=n<=700),m(1<=m<=700).

n lines follow, each contains m space-separated integer numbers.The number which is in the i-th row and j-th column is defined as a(i,j).

Output

You should output n lines, each contains m integers,which is either 0 or 1.We define the number in the i-th row and j-th column of your output b(i,j).

Score

If your answer is valid, the score of your program equals to the sum of the scores of each test case multiply 10000.

The score for each test case is calculated in the following way:

a) c=1

The score S equals to

If S>1.5, your score will be multiplied by 10000.

b) c=2

The score S equals to

If S>2, your score will be multiplied by 10000.

Example

Input #1:
1
7 3 4
1 6 4 6
7 0 3 3
2 5 1 5

Output #1:
0 1 0 1
1 0 1 0
0 1 0 1

Input #2:
2
7 3 4
1 6 4 6
7 0 3 3
2 5 1 5

Output #2:
0 1 0 1
1 0 1 0
0 1 0 1

Score:
11428.5714

Warning: large input/output data, be careful with certain languages.

Some unofficial tests were added.

The score system has been changed to avoid Wrong Answer.



Added by:Fudan University Problem Setters
Date:2007-05-16
Time limit:5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: C99 ERL GOSU JS-RHINO
Resource:IOI Chinese Team Selection Contest(CTSC) 2007