#D1665. Cube Dividing

    ID: 1389 Type: Default 5000ms 536MiB

Cube Dividing

Cube Dividing

Example

Input

2 2 2 4 0 0 0 1 1 0 1 0 1 0 1 1

Output

4

inputFormat

Input

2 2 2 4 0 0 0 1 1 0 1 0 1 0 1 1

outputFormat

Output

4

样例

2 2 2 4
0 0 0
1 1 0
1 0 1
0 1 1
4