Under construction

Still being built. Things may change

Machine Learning

Time limit2sMemory limit512 MB

Summary
Count length-n arrays with values from 0 to k where each value is a submask of every later value, and the given index pairs must differ, modulo 1e9+7.
Level

Hard8 of 10

Topics
Bit manipulation, Combinatorics, Dynamic programming
Solved
No attempts yet

Problem

An artificial intelligence lab developed a new machine learning method. Training uses nn iterations. In each iteration, the training program runs on one training set.

Training sets with complexity from 0 to kk are prepared. A training plan is an array [a1,a2,…,an][a_1, a_2, \ldots, a_n], where aia_i is the complexity of the set used in iteration ii. For every ii from 1 to nn, it must hold that 0≤ai≤k0 \le a_i \le k.

The effectiveness of a plan depends on the binary representations of the complexities. A plan is effective if, for any two indices ii and jj with 1≤i<j≤n1 \le i < j \le n, it holds that (ai & aj)=ai(a_i \,\&\, a_j) = a_i, where &\& is the bitwise AND. For example, (14 & 7)=(11102 & 01112)=1102=6(14 \,\&\, 7) = (1110_2 \,\&\, 0111_2) = 110_2 = 6.

Using sets of the same complexity over and over does not make progress. So there are mm requirements. Each requirement gives two numbers lil_i and rir_i and means ali≠aria_{l_i} \ne a_{r_i}.

Count the effective plans that satisfy all requirements. Output the count modulo 109+710^9 + 7.

Input

The first line contains three integers nn, mm, and kk (1≤n≤3⋅1051 \le n \le 3 \cdot 10^5, 0≤m≤3⋅1050 \le m \le 3 \cdot 10^5, 0≤k≤10180 \le k \le 10^{18}), the number of iterations, the number of requirements, and the maximum complexity.

Each of the next mm lines contains two integers lil_i and rir_i (1≤li<ri≤n1 \le l_i < r_i \le n). All requirements are distinct.

Output

Print one integer, the number of effective plans that satisfy all requirements, modulo 109+710^9 + 7.

Examples2

  1. Example 1

    Input
    2 0 3
    
    Expected output
    9
    
  2. Example 2

    Input
    3 1 2
    1 2
    
    Expected output
    2