One Clean Slice!

No attempts yetTime limit1sMemory limit16 MB

Problem

There is a tasty jelly. To make it easy to cut, the jelly is divided into unit cubes of volume 1: RR cells wide, CC cells deep and HH cells tall. The jelly holds NN raisins. No raisin spans more than one cell, and no cell holds two or more raisins. So the jelly can be read as a three dimensional array, and the position of a raisin is written as three integers (r,c,h)(r, c, h). See the figure below.

Tokkaengi wants to divide the jelly into exactly NN pieces so that every piece holds exactly one raisin. A cut follows cell boundaries exactly, goes all the way through the piece being cut and leaves two rectangular boxes; a cut cannot stop halfway. Among the NN pieces, Tokkaengi wants the smallest volume to be as large as possible. Help Tokkaengi cut the jelly.

Input

The first line contains the jelly size RR, CC, HH and the number of raisins NN, separated by spaces. (1R,C,H71 \le R, C, H \le 7, 1Nmin(R×C×H,77)1 \le N \le \min(R \times C \times H, 77))

Each of the next NN lines contains three integers rr, cc, hh giving the position of one raisin, separated by spaces. (1rR1 \le r \le R, 1cC1 \le c \le C, 1hH1 \le h \le H) No two raisins share a position.

Output

Print the largest volume the smallest piece can have when the jelly is divided into exactly NN pieces with one raisin in each piece.

Hint

This is the jelly of the example input seen from above. However well it is cut, the three pieces have volumes 2, 3 and 4.