暂存
#include <iostream>
#include <cstdlib>
#include <cstdio>
#define LL long long
using namespace std;
int buf[10],rt;
template<int siz=10100,int len=8,LL maxn=10000000>//maxn输出用的
class Int
{
// private:
public:
LL a[siz/len+5];//共siz位,压len位
int le;
bool sign;
void rd()
{
char ch=getchar();
if(ch<'0'|ch>'9'){return;}
rd();
buf[++rt]=ch-'0';
if(rt==len){a[++le]=0;while(rt)a[le]=a[le]*10+buf[rt--];}
}
void init()
{
le=-1,sign=0;
}
bool abscmp(Int<> tmp,int x)//绝对值小于
{
if(this->le-x!=tmp.le)return this->le-x<tmp.le;
for(int i=this->le,j=tmp.le;~j;i--,j--)if(this->a[i]!=tmp.a[j])return this->a[i]<tmp.a[j];
return 0;
}
void minus(Int<> tmp,int x)
{
for(int i=x,j=0;j<=tmp.le;i++,j++)
{
this->a[i]-=tmp.a[j];
if(this->a[i]<0)this->a[i]+=maxn*10,this->a[i+1]--;
}
while(~this->le&&!this->a[this->le])this->le--;
if(!~this->le)this->le=0,this->sign=0;
}
Int<> absadd(Int<> tmp)
{
Int<> p;p.sign=this->sign,p.a[0]=0;
if(this->le>tmp.le){p.le=this->le;for(int i=tmp.le+1;i<=this->le;i++)tmp.a[i]=0;}
else{p.le=tmp.le;for(int i=this->le+1;i<=tmp.le;i++)this->a[i]=0;}
for(int i=0;i<=p.le;i++)
{
p.a[i]+=this->a[i]+tmp.a[i];
if(p.a[i]>=maxn*10)p.a[i+1]=p.a[i]/(maxn*10),p.a[i]-=p.a[i+1]*maxn*10;
else p.a[i+1]=0;
}
p.le+=(bool)p.a[p.le+1];
return p;
}
Int<> absminus(Int<> tmp)//|this| - |tmp|
{
Int<> p;p.sign=this->sign,p.le=this->le,p.a[0]=0;
for(int i=tmp.le+1;i<=this->le;i++)tmp.a[i]=0;
for(int i=0;i<=this->le;i++)
{
p.a[i]+=this->a[i]-tmp.a[i],p.a[i+1]=0;
if(p.a[i]<0)p.a[i+1]--,p.a[i]+=maxn*10;
}
while(~p.le&&!p.a[p.le])p.le--;
if(!~p.le)p.le=0,p.sign=0;
return p;
}
public:
Int(){init();}
void read()
{
init();
char ch=0;rt=0;
while(ch<'0'|ch>'9')sign|=(ch=='-'),ch=getchar();
if(ch=='0')while(ch=='0')ch=getchar();
if(ch>'0'&ch<='9')rd();
else ch='0';
buf[++rt]=ch-'0',le++;
a[le]=0;while(rt)a[le]=a[le]*10+buf[rt--];
}
void out()
{
if(sign)putchar('-');
cout<<a[le];
for(LL i=le-1,t=maxn;i>=0;i--)
{
if(t>a[i])
{
while(t>a[i]){t/=10;putchar('0');}
t=maxn;
}
if(a[i])cout<<a[i];
}
}
void operator=(string tmp)
{
init();
int end=(tmp[0]=='-'|tmp[0]=='+'),t=tmp.size()-1,cnt=len,p;
sign|=(tmp[0]=='-');
while(t>=end)
{
if(cnt==len)a[++le]=0,cnt=0,p=max(end,t-len+1);
a[le]=a[le]*10+tmp[p++]-'0',t--,cnt++;
}
}
void operator=(Int<> tmp)
{
le=tmp.le,sign=tmp.sign;
for(int i=0;i<=le;i++)a[i]=tmp.a[i];
}
Int(string tmp)
{
*this=tmp;
}
bool operator<(Int<> tmp)
{
if(this->sign^tmp.sign)return this->sign>tmp.sign;//1是负号
if(this->sign)return tmp.abscmp(*this,0);//|tmp|<|this|<=>this<tmp//负的,绝对值小的大
return this->abscmp(tmp,0);//|this|<|tmp|<=>this<tmp
}
bool operator==(Int<> tmp)
{
if(this->sign^tmp.sign||this->le^tmp.le)return 0;
for(int i=this->le;~i;i--)if(this->a[i]!=tmp.a[i])return 0;
return 1;
}
Int<> operator+(Int<> tmp)
{
if(!(this->sign^tmp.sign))return this->absadd(tmp);
if(this->abscmp(tmp,0))return tmp.absminus(*this);//|this|<|tmp|
return this->absminus(tmp);
}
Int<> operator-(Int tmp){tmp.sign^=1;return (*this)+tmp;}
Int<> operator*(Int<> tmp)
{
Int<> p;p.le=this->le+tmp.le,p.sign=this->sign^tmp.sign;
for(int i=0;i<=p.le+1;i++)p.a[i]=0;
for(int i=0;i<=this->le;i++)
{
for(int j=0;j<=tmp.le;j++)
{
p.a[i+j]+=this->a[i]*tmp.a[j];
if(p.a[i+j]>=maxn*10)p.a[i+j+1]+=p.a[i+j]/(maxn*10),p.a[i+j]%=maxn*10;
}
}
if(p.a[p.le+1])p.le++;
else
{
while(~p.le&&!p.a[p.le])p.le--;
if(!~p.le)p.le=0,p.sign=0;
}
return p;
}
Int<> operator*(int tmp)
{
if(!tmp)return Int<>("0");
Int<> p;p.le=this->le,p.sign=this->sign^(tmp<0);tmp=abs(tmp);
for(int i=0;i<=p.le+1;i++)p.a[i]=0;
for(int i=0;i<=p.le;i++)
{
p.a[i]+=this->a[i]*tmp;p.a[i]>=maxn*10?p.a[i+1]+=p.a[i]/(maxn*10),p.a[i]%=maxn*10:0;
}
p.le+=(bool)p.a[p.le+1];
return p;
}
Int<> operator/(Int<> tmp)
{
if(this->le-tmp.le<0)return Int<>("0");
Int<> p,q;p.le=this->le-tmp.le,p.sign=this->sign^tmp.sign;//p:商 q:余数
}
int operator[](int n)
{
LL cnt=a[n/len];int index=n%len;
while(index)
{
cnt/=10,index--;
}
return cnt%10;
}
void test()
{
Int<> a("123400000000"),b("234");
a.minus(b,1);
a.out();
}
};
int main()
{
Int<> tmp("123456789");(tmp*1000000).out();
// (Int<>("123456")).out();
// (Int<>("-")).test();
Int<> a,b;a.read(),b.read();
// (a+b).out();
// (a-b).out();
(a*b).out();
// for(int i=(a.le+1)*8;~i;i--)cout<<a[i];
return 0;
}