101963: [AtCoder]ABC196 D - Hanjo

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $400$ points

Problem Statement

We have a rectangular room that is $H$ meters long and $W$ meters wide.
We will cover this room with $A$ indistinguishable $2$ meters $\times$ $1$ meters rectangular tatami mats and $B$ indistinguishable $1$ meter $\times$ $1$ meter square tatami mats. The rectangular mats can be used in either direction: they can be $2$ meters long and $1$ meter wide, or $1$ meter long and $2$ meters wide.
How many ways are there to do this?
Here, it is guaranteed that $2A + B = HW$, and two ways are distinguished if they match only after rotation, reflection, or both.

Constraints

  • All values in input are integers.
  • $1 ≤ H, W$
  • $HW ≤ 16$
  • $0 ≤ A, B$
  • $2A + B = HW$

Input

Input is given from Standard Input in the following format:

$H$ $W$ $A$ $B$

Output

Print the answer.


Sample Input 1

2 2 1 2

Sample Output 1

4

There are four ways as follows:


Sample Input 2

3 3 4 1

Sample Output 2

18

There are six ways as follows, and their rotations.


Sample Input 3

4 4 8 0

Sample Output 3

36

Input

题意翻译

# 题目大意 给定一个$H\times W$的矩形,求把这个矩形分割成$A$个$2\times 1$的小矩形和B个$1\times 1$的小矩形的方案数 # 输入 一行,分别为: $HWAB$

加入题单

算法标签: