QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 256 MB مجموع النقاط: 100

#101. 打孔机

الإحصائيات

莫斯科大都会公共交通部门决定在公交车和航空系统中引入打孔机。每位乘客都需要将矩形车票插入打孔机,然后取回带有若干方孔的车票。打孔机由 $(2N + 1) \times (2M + 1)$ 个方格组成。设矩形的行编号为 $1$ 到 $2N + 1$,列编号为 $1$ 到 $2M + 1$。部分方格(至少一个,但可能不是所有方格)上装有方形针。这些方格定义了打孔机的图案。当车票被插入时,每一根针都会在车票上打出一个方孔。打孔机在打孔时,每一根针都必须完全位于车票内部。

为了防止一张车票被多次使用,每辆公交车都必须有自己的打孔机。如果两个打孔机的图案不能通过旋转、平移和/或翻转来匹配,则认为它们是不同的。

给定 $N$ 和 $M$,求大小为 $(2N + 1) \times (2M + 1)$ 的不同打孔机的数量,结果对 $10^9 + 7$ 取模。

输入格式

输入包含多个测试用例。每个测试用例占一行,包含两个整数 $N$ 和 $M$ ($1 \le N, M \le 1000$)。输入以 $N = M = 0$ 结束,该行不应被处理。单次测试中最多有 $100\,000$ 个测试用例(不包括终止的 $N = M = 0$ 情况)。

输出格式

对于每个测试用例,输出大小为 $(2N + 1) \times (2M + 1)$ 的不同打孔机的数量,结果对 $10^9 + 7$ 取模。

样例

样例输入 1

2 2
2 3
0 0

样例输出 1

5
19

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.