P1790 Rectangle Partition

Description

There is a rectangle of length $a$ and width $b$ ($1 \le a \le 6$, $2 \le b \le 6$). You can regard this rectangle as an $a\times b$ grid of unit squares. We are now given the following task: please compute the total number of ways to partition this rectangle into two parts. You are not allowed to partition the large rectangle arbitrarily; it must satisfy: After the partition, each part must contain at least one cell that lies on the outer border of the large rectangle (that is, on the outermost ring of cells).

Input Format

The input contains only two integers, $a$ and $b$.

Output Format

Output a single line containing one integer, the total number of ways to partition.

Explanation/Hint

![](https://cdn.luogu.com.cn/upload/image_hosting/buv0992j.png) Translated by ChatGPT 5