#codefestival2015okinawah. [code_festival_2015_okinawa_h]Happy 2015
[code_festival_2015_okinawa_h]Happy 2015
Problem
As the end of year approaching, the downtown area has been lighted up to celebrate year’s end. At this year, Cat Snuke also enjoys making a light-up device for the downtown area.
The downtown can be regarded as a one-dimensional line of numbers. There are lights that have been installed on this number line. When the power of the light is on, it can illuminate an interval of \[l_i, r_i\] (inclusive).
Although Cat Snuke can switch on the lights independently as his wish, he wants to try different illumination combinations as many as possible. Then, if we had tried all the combinations of illumination combinations, we want to know how many different illumination combinations there are, of which each combination is a set of points that for each point in it can be illuminated by one or more lights.
When we tried all the illumination combination, please answer the number of the different illumination combinations, modulo .
Input
Inputs will be given by standard input in following format
:
- At the first line, an integer will be given divided by a space.
- From the second line there are additional lines to give the information about the illumination range. For the line, integer , will be given divided by a space.
Output
Please answer the number of the different illumination combinations, modulo .
Print a newline at the end of output.
Input Example 1
4
0 1
1 2
0 2
1 3
Output Example 1
6
There are different ways of attaching the light power, but there are only different illumination combinations, $\\{φ\\}, \\{\[0, 1\]\\}, \\{\[1, 2\]\\}, \\{\[0, 2\]\\}, \\{\[1, 3\]\\}, \\{\[0, 3\]\\}$.
Input Example 2
12
0 4
7 12
1 3
6 8
2 3
4 6
8 9
2 7
9 11
1 2
3 5
7 9
Output Example 2
240
Input Example 3
14
0 1
2 3
4 5
6 7
8 9
10 11
12 13
14 15
16 17
18 19
0 3
4 7
8 13
14 19
Output Example 3
2025