#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cmath>
// 文件模板
// -------------------
#include <bits/stdc++.h>
using namespace std;
namespace {
#define L(i, j, k) for(int i = (j), _e = (k); i <= _e; ++i)
#define R(i, j, k) for(int i = (j), _e = (k); i >= _e; --i)
#define gc cin.get
#define pc cout.put
#define inl static inline
#define pr(x) (cerr << (x))
#define db(...) fprintf(stderr, __VA_ARGS__)
#define _assume(x) { if (!(x)) __builtin_unreachable(); }
typedef long long ll; typedef unsigned un; typedef unsigned long long ull; typedef pair<int, int> pii;
template<typename T = int> inl T read() { char c; while ((c = gc()) <= ' '); int f = (c != '-' ? 1 : (c = gc(), -1)); T a = c - '0'; while ((c = gc()) >= '0') a = a * 10 + c - '0'; return a * f; } template<typename T> inl void read(T & a) { a = read<T>(); } inl void read(char & c) { while ((c = gc()) <= ' '); } inl int rstr(char * s) { char * t = s; while ((*t = gc()) <= ' '); while ((*++t = gc()) > ' '); *t = '\0'; return t - s; } template<typename T, typename ... A> inl void read(T & a, A & ... args) { read(a), read(args...); } template<typename T> inl void putz(T x) { _assume(x >= 0); static char b[40]; int p = 0; do b[p++] = x % 10 + '0'; while (x /= 10); do pc(b[--p]); while (p); } template<typename T> inl void put(T x) { putz(x < 0 ? (pc('-'), -x) : x); } template<typename T, typename ... A> inl void put(T x, A ... args) { put(x), pc(' '), put(args...); } inl void putln() { pc('\n'); } template<typename ... A> inl void putln(A ... args) { put(args...), pc('\n'); } template<typename T> inl void out(const T & x) { pr(x); } template<typename T> inl void out(T b, T e) { T i = b; pr(*i); while (++i != e) pr(' '), pr(*i); } template<typename T_, typename T> inl void out(const T_ & s, T b, T e) { out(s), out(b, e); } inl void outln() { pr('\n'); } template<typename ... A> inl void outln(A ... args) { out(args...), pr('\n'); } inl void ps(const char * s) { while (*s != '\0') pc(*s++); } inl void ps(const string & s) { ps(s.c_str()); } inl void yes() { ps("yes\n"); } inl void Yes() { ps("Yes\n"); } inl void YES() { ps("YES\n"); } inl void no() { ps("no\n"); } inl void No() { ps("No\n"); } inl void NO() { ps("NO\n"); }
}
constexpr int N = 2e5 + 5;
int n;
int main() {
ios::sync_with_stdio(false); cin.tie(0);
}
// -------------------
// 快读(非负实数,小数表示法)
double read_real() {
int c; while (isspace(c = getchar()));
long long a = c & 15; while (isdigit(c = getchar())) a = (a << 3) + (a << 1) + (c & 15);
if (c != '.') return a;
else {
double t = 1.0, b = 0.0;
while (isdigit(c = getchar())) b += (c & 15) * (t *= 0.1);
return a + b;
}
}
// 快读(实数,小数表示法)
double read_real() {
long long a; int c; double f;
while (isspace(c = getchar()));
f = (c == '-' ? (a = 0, -1.0) : (a = c & 15, 1.0));
while (isdigit(c = getchar())) a = (a << 3) + (a << 1) + (c & 15);
if (c != '.') return a * f;
else {
double t = 1.0, b = a;
while (isdigit(c = getchar())) b += (c & 15) * (t *= 0.1);
return b * f;
}
}
// 快读(实数,完整版本)
double read_real() {
long long a; int c; double f;
while (isspace(c = getchar()));
f = (c == '-' ? (a = 0, -1.0) : (a = (c == '+' ? 0 : c & 15), 1.0));
while (isdigit(c = getchar())) a = (a << 3) + (a << 1) + (c & 15);
double b = a;
if (c == '.') {
double t = 1.0;
while (isdigit(c = getchar())) b += (c & 15) * (t *= 0.1);
}
b *= f;
if (c == 'E' || c == 'e') {
c = getchar(), f = (c == '-' ? (a = 0, 0.1) : (a = (c == '+' ? 0 : c & 15), 10.0));
while (isdigit(c = getchar())) a = (a << 3) + (a << 1) + (c & 15);
return b * pow(f, a);
} else return b;
}
// 基数排序(目前只有从小到大排序的版本)
#define U unsigned
static U __t[256];
// 用 OP 访问字节略显繁琐,但可以对结构体排序
#define SORTBYTE(I, A, E, B, OP) {\
memset(__t, 0, sizeof(__t));\
I * const __a = (A), * const __e = (E), * const __b = (B);\
for (I * i = __a; i != __e; ++i) ++__t[OP((*i))];\
for (U * i = __t, * const e = __t + 255; i != e; ++i) *(i + 1) += *i;\
for (I * i = __e - 1; i != __a; --i) __b[--__t[OP((*i))]] = *i;\
__b[__t[OP((*__a))] - 1] = *__a;\
}
// 直接按照 BIT 取出字节
#define SORTBYTE(I, A, E, B, BIT) {\
memset(__t, 0, sizeof(__t));\
I * const __a = (A), * const __e = (E), * const __b = (B); U __bit = (BIT);\
for (I * i = __a; i != __e; ++i) ++__t[*i >> __bit & 255];\
for (U * i = __t, * const e = __t + 255; i != e; ++i) *(i + 1) += *i;\
for (I * i = __e - 1; i != __a; --i) __b[--__t[*i >> __bit & 255]] = *i;\
__b[__t[*__a >> __bit & 255] - 1] = *__a;\
}
// 对有符号字节排序
#define SORTSBYTE(I, A, E, B, BIT) {\
memset(__t, 0, sizeof(__t));\
I * const __a = (A), * const __e = (E), * const __b = (B); U __bit = (BIT);\
for (I * i = __a; i != __e; ++i) ++__t[*i >> __bit & 255];\
for (U * i = __t + 128, * const e = __t + 255; i != e; ++i) *(i + 1) += *i;\
*__t += *(__t + 255);\
for (U * i = __t, * const e = __t + 127; i != e; ++i) *(i + 1) += *i;\
for (I * i = __e - 1; i >= __a; --i) __b[--__t[*i >> __bit & 255]] = *i;\
}
// 示例:
void radix_sort(int * a, int n) {
int * b = (int *)malloc(n * sizeof(int));
#define OP(i) (i & 255)
SORTBYTE(int, a, a + n, b, OP)
#undef OP
#define OP(i) (i >> 8 & 255)
SORTBYTE(int, b, b + n, a, OP)
#undef OP
#define OP(i) (i >> 16 & 255)
SORTBYTE(int, a, a + n, b, OP)
#undef OP
#define OP(i) (i >> 24 & 255)
SORTBYTE(int, b, b + n, a, OP)
#undef OP
free(b);
}
void radix_sort(int * a, int n) {
int * b = (int *)malloc(n * sizeof(int));
SORTBYTE(int, a, b, n, 0)
SORTBYTE(int, b, a, n, 8)
SORTBYTE(int, a, b, n, 16)
SORTSBYTE(int, b, a, n, 24)
free(b);
}
// 索引优先队列
struct IndexPQ {
int p;
int a[maxn];
int t[maxn * 3];
IndexPQ() {}
IndexPQ(int n) { build(n); }
void build(int n) { for (p = 1; p < n + 2; p <<= 1); for (int i = 1; i <= n; ++i) t[i + p] = i;}
inline int get(int l, int r) { return a[l] > a[r] ? l : r; }
void set(int i, int k) {
a[i] = k;
for (i = (p + i) >> 1; i; i >>= 1) t[i] = get(t[i << 1], t[i << 1 | 1]);
}
inline void erase(int i) { set(i, 0); }
inline int top() { return t[1]; }
inline int topval() { return a[top()]; }
inline void pop() { set(t[1], 0); }
};
constexpr un mod = 1e9 + 7;
struct mi {
un x;
mi(){} mi(const mi& y):x(y.x){}
template<typename T>mi(T y):x(y%mod){}
inline mi operator=(mi y){x=y.x; return y;}
inline mi operator+=(mi y) { if((x+=y.x)>=mod)x-=mod;return *this; }
inline mi operator-=(mi y) { if(x>=y.x)x-=y.x;else x+=mod-y.x;return *this; }
mi operator*=(mi y) { x=(ull)x*y.x%mod;return *this; }
constexpr static un inv(un a) {
un p = mod - 2, t = 1;
for (; p; p >>= 1, a = (ull)a * a % mod) if (p & 1) t = (ull)t * a % mod;
return t;
}
mi operator/=(mi y) { x=(ull)x*inv(y.x)%mod;return *this; }
bool operator==(mi y) {return x==y.x;}
};
mi operator+(mi x, mi y){return mi(x)+=y;}
mi operator-(mi x, mi y){return mi(x)-=y;}
mi operator*(mi x, mi y){return mi(x)*=y;}
mi operator/(mi x, mi y){return mi(x)/=y;}