CF37D Lesson Timetable

题目描述

## 题目大意 P某人所在的大学有 $ m $ 间教室, $ n $ 个小组,对于第 $ i $ 间教室,初始时有 $ x_i $ 组在这个教室,且这个教室最多可以供 $ y_i $ 组同时上课。 每组学生第一次上课的教室的编号小于等于第二次上课的教室的编号。 P某人想为这些小组制定时间表,时间表有 $ 2n $ 个数,对于每个组,求第一节课和第二节课的教室标号。 你只需要求出共有多少种分组方法,不需求出具体方案。 由于答案可能很大,输出取模 $ 10^9+7 $

输入格式

第一行包含一个整数 $ m $ ( $ 1

输出格式

在单行输出问题的答案 (计划表的数量取模 $ 10^9+7 $ ) ------------ Translation by MC小萌新.

说明/提示

In the second sample test the first and the second lessons of each group must take place in the same classroom, that’s why the timetables will only be different in the rearrangement of the classrooms’ numbers for each group, e.g. $ 3!=6 $ .