#include
#include
using namespace std;
//#define PI acos(-1)
const long double PI = acos(-1.0);
const int maxn = 500000 + 7;
struct Complex{
long double real,imag;
Complex(long double _real = 0.0,long double _imag = 0.0){
real = _real;
imag = _imag;
}
}Card[4][maxn*4];
Complex operator + (const Complex &c1, const Complex &c2)
{
return Complex(c1.real + c2.real, c1.imag + c2.imag);
}
Complex operator - (const Complex &c1, const Complex &c2)
{
return Complex(c1.real - c2.real, c1.imag - c2.imag);
}
Complex operator * (const Complex &c1, const Complex &c2)
{
return Complex(c1.real*c2.real - c1.imag*c2.imag, c1.real*c2.imag + c1.imag*c2.real);
}
bool judge[maxn],Delete[4][maxn];
char extra[10];
int prime[maxn],tot,pos[maxn*4];
void init(){
tot = 0;
memset(judge,0,sizeof(judge));
for(int i = 2;i=maxn)break;
judge[prime[j]*i] = 1;
if(i%prime[j]==0)break;
}
}
}
void FFT(Complex*A,int type,int n){
for(int i = 0;i>1;
Complex Wn(cos(2.0*PI/L),type*sin(2.0*PI/L));
for(int R = 0;R=b+1){Card[j][i].real = 0;continue;}
if(judge[i]&&!Delete[j][i])Card[j][i].real = 1.0;
else Card[j][i].real = 0.0;
}
pos[i] = (pos[i>>1]>>1)|((i&1)<<(l-1));
}
for(int i = 0;i<4;i++){
FFT(Card[i],1,maxLen);
}
for(int i = 0;i