Codeforces 37D-Lesson Timetable
When Petya has free from computer games time, he attends university classes. Every day the lessons on Petya’s faculty consist of two double classes. The floor where the lessons take place is a long corridor with M classrooms numbered from 1 to M, situated along it.
All the students of Petya’s year are divided into N
Once Petya decided to count the number of ways in which one can make a lesson timetable for all these groups. The timetable is a set of 2N
1) On the first lesson in classroom i exactly Xi groups must be present.
2) In classroom i no more than Yi groups may be placed.
Help Petya count the number of timetables satisfying all those conditionsю As there can be a lot of such timetables, output modulo 109 + 7.