124 - ZOJ Monthly, March 2013 - B
Michael takes the Discrete Mathematics course in this semester. Now it's close to the final exam, and he wants to take a complete review of this course.
The whole book he needs to review has N chapter, because of the knowledge system of the course is kinds of discrete as its name, and due to his perfectionism, he wants to arrange exactly N days to take his review, and one chapter by each day.
But at the same time, he has other courses to review and he also has to take time to hang out with his girlfriend or do some other things. So the free time he has in each day is different, he can not finish a big chapter in some particular busy days.
To make his perfect review plan, he needs you to help him.
There are multiple test cases. For each test case:
The first line contains two integers N(1≤N≤50), M(0≤M≤25), N is the number of the days and also the number of the chapters in the book.
Then followed by M lines. Each line contains two integers D(1≤D≤N) and C(1≤C≤N), means at the Dth day he can not finish the review of the Cth chapter.
There is a blank line between every two cases.
Process to the end of input.
One line for each case. The number of the different appropriate plans module 55566677.
4 3 1 2 4 3 2 1 6 5 1 1 2 6 3 5 4 4 3 4
Author: LI, Huang