#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
const double PI = acos(-1.0);
//复数结构体
struct Complex
{
double x,y;//实部和虚部 x+yi
Complex(double _x = 0.0,double _y = 0.0)
{
x = _x;
y = _y;
}
Complex operator -(const Complex &b)const
{
return Complex(x-b.x,y-b.y);
}
Complex operator +(const Complex &b)const
{
return Complex(x+b.x,y+b.y);
}
Complex operator *(const Complex &b)const
{
return Complex(x*b.x-y*b.y,x*b.y+y*b.x);
}
};
class myfft
{
public:
Complex x1[100],x2[100];
Complex x[100];
int sum[100];
void fft(Complex p[],int len,int on)
{
Complex pcpy[100];
for(int width=2;width<=len;width*=2)
{
memcpy(pcpy,p,sizeof(pcpy));
Complex wn(cos(on*2*PI/width),sin(on*2*PI/width));
int jiange=len/width;
for(int i=0;i<jiange;i++)
{
Complex w(1,0);
int ap=i;
int bp=ap+jiange;
int cp=i;
int dp=i+width/2*jiange;
for(int j=0;j<width/2;j++)
{
p[cp]=pcpy[ap]+w*pcpy[bp];
p[dp]=pcpy[ap]-w*pcpy[bp];
w=w*wn;
ap+=2*jiange;
bp+=2*jiange;
cp+=jiange;
dp+=jiange;
}
}
}
}
void solve(int a,int b)
{
int len1=0;
int len2=0;
for(int i=0; i<100; i++)
x1[i].x=x1[i].y=x2[i].x=x2[i].y=0;
while(a)
{
x1[len1++].x=a%10;
a/=10;
}
while(b)
{
x2[len2++].x=b%10;
b/=10;
}
int len=1;
while(len<len1*2||len<len2*2)len*=2;
fft(x1,len,1);
fft(x2,len,1);
for(int i=0; i<len; i++)
x[i]=x1[i]*x2[i];
fft(x,len,-1);
for(int i=0; i<len; i++)
x[i].x=x[i].x/len;
for(int i=0; i<len; i++)
sum[i]=(int)(x[i].x+0.5);
for(int i=0; i<len; i++)
{
sum[i+1]+=sum[i]/10;
sum[i]=sum[i]%10;
}
int i;
for(i=len-1; i>=0; i--)
if(sum[i])
break;
for(; i>=0; i--)
printf("%d",sum[i]);
printf("\n");
}
};
myfft m;
int main()
{
int a,b;
scanf("%d%d",&a,&b);
m.solve(a,b);
return 0;
}
#include <string.h>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
const double PI = acos(-1.0);
//复数结构体
struct Complex
{
double x,y;//实部和虚部 x+yi
Complex(double _x = 0.0,double _y = 0.0)
{
x = _x;
y = _y;
}
Complex operator -(const Complex &b)const
{
return Complex(x-b.x,y-b.y);
}
Complex operator +(const Complex &b)const
{
return Complex(x+b.x,y+b.y);
}
Complex operator *(const Complex &b)const
{
return Complex(x*b.x-y*b.y,x*b.y+y*b.x);
}
};
class myfft
{
public:
Complex x1[100],x2[100];
Complex x[100];
int sum[100];
void fft(Complex p[],int len,int on)
{
Complex pcpy[100];
for(int width=2;width<=len;width*=2)
{
memcpy(pcpy,p,sizeof(pcpy));
Complex wn(cos(on*2*PI/width),sin(on*2*PI/width));
int jiange=len/width;
for(int i=0;i<jiange;i++)
{
Complex w(1,0);
int ap=i;
int bp=ap+jiange;
int cp=i;
int dp=i+width/2*jiange;
for(int j=0;j<width/2;j++)
{
p[cp]=pcpy[ap]+w*pcpy[bp];
p[dp]=pcpy[ap]-w*pcpy[bp];
w=w*wn;
ap+=2*jiange;
bp+=2*jiange;
cp+=jiange;
dp+=jiange;
}
}
}
}
void solve(int a,int b)
{
int len1=0;
int len2=0;
for(int i=0; i<100; i++)
x1[i].x=x1[i].y=x2[i].x=x2[i].y=0;
while(a)
{
x1[len1++].x=a%10;
a/=10;
}
while(b)
{
x2[len2++].x=b%10;
b/=10;
}
int len=1;
while(len<len1*2||len<len2*2)len*=2;
fft(x1,len,1);
fft(x2,len,1);
for(int i=0; i<len; i++)
x[i]=x1[i]*x2[i];
fft(x,len,-1);
for(int i=0; i<len; i++)
x[i].x=x[i].x/len;
for(int i=0; i<len; i++)
sum[i]=(int)(x[i].x+0.5);
for(int i=0; i<len; i++)
{
sum[i+1]+=sum[i]/10;
sum[i]=sum[i]%10;
}
int i;
for(i=len-1; i>=0; i--)
if(sum[i])
break;
for(; i>=0; i--)
printf("%d",sum[i]);
printf("\n");
}
};
myfft m;
int main()
{
int a,b;
scanf("%d%d",&a,&b);
m.solve(a,b);
return 0;
}