NOTES: * Two ways of cutting are different if one has a cut at a spot that the other doesn't. Don't worry about eliminating symmetries or other complexities like that. * Do make sure, though, that the fence has greater than 0 area. * Rejoice that the answer will always fit into a signed 32-bit integer.
* Line 1: A single integer: N
* Line 1: A single integer that is the number of ways that Farmer John can cut the plank of wood into four pieces such that they form a valid quadrilateral.
Farmer John can cut the plank 10 ways into four pieces: (1, 1, 1, 3); (1, 1, 2, 2); (1, 1, 3, 1); (1, 2, 1, 2); (1, 2, 2, 1); (1, 3, 1, 1); (2, 1, 1, 2); (2, 1, 2, 1); (2, 2, 1, 1); or (3, 1, 1, 1). Four of these -- (1, 1, 1, 3), (1, 1, 3, 1), (1, 3, 1, 1), and (3, 1, 1, 1) -- cannot be used to form a quadrilateral, though.