#include #define pb push_back #define P make_pair #define rep(i,a,b) for(int i=(a);i<=(b);++i) #define per(i,a,b) for(int i=(a);i>=(b);--i) #define fi first #define se second using namespace std; typedef long long ll; inline ll read(){ ll x=0;char c=getchar(); while(c<'0'||c>'9')c=getchar(); while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar(); return x; } typedef pair pii; const int N=1e6+3; const int mod=1e9+7; int n,m,V; pii a[N]; inline int fp(int x,int p){ int res=1; for(;p;p>>=1){ if(p&1)res=1ll*res*x%mod; x=1ll*x*x%mod; } return res; } inline void Mi(int &x,int y){x=x