#include using namespace std; const long mod=1e9+7; long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;} int N; long L[1<<17],R[1<<17],D[1<<17]; main() { cin>>N; for(int i=0;i>L[i]; for(int i=0;i>R[i]; int zc=0; for(int i=0;i>D[i]; if(D[i]==0)zc++; } if(zc>0) { if(zc==N)cout<<1<0&&D[i-1]==D[i])now=(now+1)%mod; ans=ans*now%mod; } cout<