Peaceful Rooks
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
A rook is a chess piece that moves along ranks and files.
Let us consider k white rooks and l black rooks on an m×n chessboard. We call the arrangement of the rooks on the chessboard peaceful if no white rook attacks a black one (and vice-versa).
Given m, n, k and l, find the number of peaceful arrangements of the rooks on the chessboard.
Input
The input file contains four integer numbers: m, n, k and l (2 ≤ m, n ≤ 10, 1 ≤ k, 1 ≤ l, k + l ≤ m·n).
Output
Output one integer number - the number of peaceful arrangements of k white and l black rooks on the m×n chessboard.
Examples
Input #1
Answer #1
Submissions 42
Acceptance rate 24%