#Q234. 「一本通 6.6 练习 3」车的放置
「一本通 6.6 练习 3」车的放置
Description
There is a grid chessboard as shown below, where represent the lengths of the corresponding edges, i.e., the number of grid cells.

When , the chessboard looks like this:

We need to place rooks on this chessboard such that no two rooks attack each other, meaning no two rooks are in the same row or the same column. The task is to determine the number of possible arrangements. The answer should be output modulo .
Input Format
The first line contains five non-negative integers and .
Output Format
Output a single positive integer, which is the answer modulo .
Sample 1
2 2 2 2 2
38
Data Range and Hints
For all data, , and it is guaranteed that there is at least one feasible arrangement.