废话不多说,上模板!
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
const int N=1e6+7;
const int mod=1e9+7;
ll ksm(ll a,ll b)//a^b
{
ll ans = 1;
while(b)
{
if(b&1)
ans = ans * a % mod;
b = b>>1;
a = a * a % mod;
}
return ans;
}