#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
class BigNumPlus
{
public:
BigNumPlus(string t_strplused,string t_strplus):m_plused(t_strplused),m_plus(t_strplus),m_carryflag(false){}
string& Add();
void BitPlus(char a, char b);
private:
string m_plused;
string m_plus;
string m_result;
bool m_carryflag;
};
string& BigNumPlus::Add()
{
int t_iplusedlen = m_plused.length()-1;
int t_ipluslen = m_plus.length()-1;
for(;(t_iplusedlen >= 0)&&(t_ipluslen >= 0); t_iplusedlen--, t_ipluslen--)
{
BitPlus(m_plused[t_iplusedlen], m_plus[t_ipluslen]);
}
if(t_iplusedlen<0 && t_ipluslen>=0)
{
m_result.insert(0,m_plus.c_str(),t_ipluslen+1);
}
else if(t_ipluslen<0 && t_iplusedlen>=0)
{
m_result.insert(0,m_plused.c_str(),t_iplusedlen+1);
}
return m_result;
}
void BigNumPlus::BitPlus(char a, char b)
{
int ia = a - '0';
int ib = b - '0';
int ic;
if(m_carryflag == true)
{
ic = ia+ib+1;
m_result.insert(0,1,(ia+ib+1)%10+'0');
}
else
{
ic = ia+ib;
m_result.insert(0,1,(ia+ib)%10+'0');
}
if( ic >= 10)
{
m_carryflag = true;
}
else
{
m_carryflag = false;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
string t_strplused, t_strplus;
cin>>t_strplused>>t_strplus;
BigNumPlus bignumplus(t_strplused, t_strplus);
cout<<bignumplus.Add()<<endl;
return 0;
}