#include <bits/stdc++.h>
using namespace std;
# define gc() (iS==iT && (iT=(iS=ibuf)+fread(ibuf,1,SIZE,stdin),iS==iT)?EOF:*iS++)
# define pc(c) ((oT==oS+SIZE && flush()),*oT++=(c))
const int SIZE=(1<<21)+1;
char ibuf[SIZE],obuf[SIZE],*iS,*iT,*oS=obuf,*oT=obuf;
char* flush(){fwrite(obuf,1,oT-oS,stdout);return oT=obuf;}
struct Flusher{~Flusher(){flush();}}flusher;
template<typename T=int>
T read()
{
T x=0;
char ch=gc();
for(;ch<'0' || ch>'9';ch=gc());
for(;ch>='0' && ch<='9';ch=gc()) x=x*10+(ch-'0');
return x;
}
template<typename T>
void write(T x)
{
if(x>=10) write(x/10);
pc(x%10+'0');
}
#include <bits/stdc++.h>
using namespace std;
int read() {
int x = 0, w = 1;
char ch = 0;
while (ch < '0' || ch > '9') {
if (ch == '-') w = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = x * 10 + (ch - '0');
ch = getchar();
}
return x * w;
}
void write(int x) {
if (x < 0) {
x = -x;
putchar('-');
}
if (x > 9) write(x / 10);
putchar(x % 10 + '0');
}