Helen is a hyperactive girl. She wants to schedule her activities so that at any moment of the day there is at least one thing she can do. She does not care if her activities overlap in time, as long as every moment of her day has an activity scheduled.
Helen divided the day in a particular way. The day starts at time $0$ and finishes at time $M$. Each moment of the day is represented by a real number between $0$ and $M$, inclusive. Helen made a list of all possible activities, with their start and finish times. Now she must decide which subset of activities to schedule.
If an activity starts at time $S$ and finishes at time $F$, then we say that it covers all moments between $S$ and $F$, inclusive. Helen does not want to waste any activities, so she will only choose minimal subsets of activities that cover the day to be scheduled. A subset of activities is a minimal subset that covers the day if and only if:
Note that some moments of the day may be covered by more than one activity
Given the list of possible activities for one day, you must help Helen by determining how many
distinct minimal subsets cover the day.
Each test case is given using several lines. The first line contains two integers $M$ and $N$, representing respectively the highest value for a moment in the day $(1 \leq M \leq 10^9)$ and the number of possible activities for the day $(1 \leq N \leq 100)$. Each of the next $N$ lines describes one possible activity and contains two integers $S$ and $F$, representing respectively the start and finish times of the activity $(0 \leq S \lt F \leq M)$.
The last test case is followed by a line containing two zeros.