#include using namespace atcoder; #include #define itr(x,c) for(auto x=c.begin();x!=c.end();x++) #define ritr(x,c) for(auto x=c.rbegin();x!=c.rend();x++) #define all(a) (a.begin()),(a.end()) #define rall(a) (a.rbegin()),(a.rend()) using namespace std; using ll=long long; using pll=pair; templatebool chmax(T &a, const T &b) {if(abool chmin(T &a, const T &b) {if(bistream& operator >> (istream& is, vector& v) { for(T& x:v) is >> x; return is; } templateostream& operator << (ostream& os, const vector& v) {for(int i=0;iistream& operator >> (istream& is, pair& p) { is >> p.first >> p.second; return is; } //istream& operator >> (istream& is, modint1000000007& x) { unsigned int t; is >> t; x=t; return is; } //istream& operator >> (istream& is, modint998244353& x) { unsigned int t; is >> t; x=t; return is; } ostream& operator << (ostream& os, const modint1000000007& x) { os << x.val(); return os; } ostream& operator << (ostream& os, const modint998244353& x) { os << x.val(); return os; } template void pt() { std::cout << "\n"; } template void pt_rest() { std::cout << "\n"; } template void pt_rest(const T& first, const A&... rest) { std::cout << " " << first; pt_rest(rest...); } template void pt(const T& first, const A&... rest) { std::cout << first; pt_rest(rest...); } static const ll INF=1e18+7; static const ll MAX=101010; static const ll MOD=1e9+7; static const double PI=acos(-1); static const double EPS=1e-10; //static const ll MOD=998244353; using v1d=vector; using v2d=vector; using v3d=vector; using v4d=vector; struct S{ modint1000000007 val; ll size; S(modint1000000007 val,ll size):val(val),size(size){} }; using F=modint1000000007; S op(S a,S b){ return {a.val+b.val,a.size+b.size}; } S e(){ return {0,0}; } S mapping(F f,S x){ return {x.val+f*x.size,x.size}; } F composition(F f,F g){ return f+g; } F id(){ return 0; } int main(void) { cin.tie(nullptr); ios::sync_with_stdio(false); ll i,j,k; ll N,M,K;cin>>N>>M>>K; vector l(M),r(M); for(i=0;i>l[i]>>r[i]; vector>seg(2,lazy_segtree(vector(N+1,{0,1}))); seg[0].set(1,{1,1}); ll tur=0; for(k=0;k(vector(N+1,{0,1})); for(i=0;i