#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
ll m_pow(ll a, ll b){
ll res = 1;
a %= mod;
assert(b >= 0);
for(; b; b>>=1)
{
if(b&1)
res = res*a%mod;
a = a*a%mod;
}
return res;
}
ll gcd(ll a, ll b){
return b ? gcd(b,a%b) : a;
}
// head
typedef unsigned long long u64; //用%llu输入
typedef __int128_t i128;
typedef __uint128_t u128;
struct Mod64 {
Mod64():n_(0) {}
Mod64(u64 n):n_(init(n)) {}
static u64 init(u64 w) { return reduce(u128(w) * r2); }
static void set_mod(u64 m) {
mod=m; assert(mod&1);
inv=m;
for(int i=0;i<5;i++)
inv*=2-inv*m;
r2=-u128(m)%m;
}
static u64 reduce(u128 x) {
u64 y=u64(x>>64)-u64((u128(u64(x)*inv)*mod)>>64);
return ll(y)<0?y+mod:y;
}
Mod64& operator += (Mod64 rhs) { n_+=rhs.n_-mod; if (ll(n_)<0) n_+=mod; return *this; }
Mod64 operator + (Mod64 rhs) const { return Mod64(*this)+=rhs; }
Mod64& operator -= (Mod64 rhs) { n_-=rhs.n_; if (ll(n_)<0) n_+=mod; return *this; }
Mod64 operator - (Mod64 rhs) const { return Mod64(*this)-=rhs; }
Mod64& operator *= (Mod64 rhs) { n_=reduce(u128(n_)*rhs.n_); return *this; }
Mod64 operator * (Mod64 rhs) const { return Mod64(*this)*=rhs; }
u64 get() const { return reduce(n_); }
static u64 mod,inv,r2;
u64 n_;
};
u64 Mod64::mod,Mod64::inv,Mod64::r2;
//a*b%p 的防止超ll限度的写法
u64 pmod(u64 a,u64 b,u64 p) {
u64 d=(u64)floor(a*(long double)b/p+0.5);
ll ret=a*b-d*p;
if (ret<0) ret+=p;
return ret;
}
Mod64::set_mod(M); //模设定
Mod64 a(_a); //定义,初始化
_a = a.get(); //转数值