记录编号 397792 评测结果 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
题目名称 加法问题 最终得分 100
用户昵称 Gravatar6666 是否通过 通过
代码语言 C++ 运行时间 15.248 s
提交时间 2017-04-20 21:15:00 内存使用 46.11 MiB
显示代码纯文本
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<map>
#include<bitset>
#include<queue>
#include<deque>
#include<vector>
#include<set>
#define mcp(x,y) make_pair((x),(y))
#define u32 unsigned
#define LL long long
using namespace std;
char cc;inline void R_int(int &x){
	while(cc=getchar(),cc<'!');x=cc-48;
	while(cc=getchar(),cc>'!')x=x*10+cc-48;
}
const int maxn=57,maxm=5002;
namespace Graph {
	const int INF=0x3f3f3f3f;
	namespace Dijkstra{
		struct Rabit_tree{int to,next,dis;}e[maxm];
		#define to e[i].to
		struct Rabit_q{
			int x,dis;
			bool operator < (const Rabit_q &a)const{
				return dis>a.dis;
			}	
		};priority_queue<Rabit_q>q;
		int dis[maxn],vis[maxn],tim=0,head[maxn];
		void Dijkstra(int S,int T){
			while(!q.empty())q.pop();q.push((Rabit_q){S,0});
			int i;memset(dis,0x3f,sizeof(dis));dis[S]=0;tim++;
			while(!q.empty()){
				Rabit_q rt=q.top();q.pop();
				if(vis[rt.x]==tim)continue;vis[rt.x]=tim;
				if(rt.x==T)break;
				for(i=head[rt.x];i;i=e[i].next)
					if(dis[to]>dis[rt.x]+e[i].dis)
						dis[to]=dis[rt.x]+e[i].dis,q.push((Rabit_q){to,dis[to]});
			}
			printf("%d\n",dis[T]);
		}
		#undef to
	}  
	namespace Tarjan{
		struct Rabit_tree{int to,next,dis;}e[maxm];
		#define to e[i].to		
		int head[maxn],fir[maxn],low[maxn],bel[maxn],cnt,scc=0,st[maxn],cot=0;
		void Tarjan(int rt){
			fir[rt]=low[rt]=++cnt,st[++cot]=rt;
			for(int i=head[rt];i;i=e[i].next)
				if(!fir[to])Tarjan(to),low[rt]=min(low[rt],low[to]);
				else if(!bel[to])low[rt]=min(low[rt],fir[to]);
			if(low[rt]==fir[rt]){
				int k;scc++;
				do k=st[cot--],bel[k]=scc;while(k^rt);	
			}
		}
		#undef to
	}
	//割:1存在儿子的low[son]>=fir[rt];2当为根时还必须拥有至少两个fir[son]==0的儿子
	//桥:在儿子的low[son]>fir[rt]的rt-->son的边 /*注意带不带等号*/ 
	namespace KM{
		int c[maxn][maxn],Up[maxn],tim,pre[maxn],q[maxn],N;
		int visx[maxn],visy[maxn],havx[maxn],havy[maxn],lx[maxn],ly[maxn];
		void Aug(int rt){
			if(!rt)return;
			havy[rt]=pre[rt];
			Aug(havx[havy[rt]]);
			havx[havy[rt]]=rt;
		}
		void Bfs(int S){
			int s,t,rt,i,tmp;q[s=t=1]=S;tim++;
			for(i=1;i<=N;i++)Up[i]=INF;
			while(true){
				while(s<=t){
					rt=q[s++];visx[rt]=tim;
					for(i=1;i<=N;i++)if(visy[i]^tim){
						tmp=lx[rt]+ly[i]-c[rt][i];
						if(!tmp){
							visy[i]=tim,pre[i]=rt;
							if(!havy[i]){Aug(i);return;}
							q[++t]=havy[i];
						}
						else if(tmp<Up[i])Up[i]=tmp,pre[i]=rt;/***/
					}	
				}
				tmp=INF;
				for(i=1;i<=N;i++)if(visy[i]^tim)tmp=min(Up[i],tmp);
				for(i=1;i<=N;i++){
					if(visx[i]==tim)lx[i]-=tmp;
					if(visy[i]==tim)ly[i]+=tmp;else Up[i]-=tmp;/***/
				}
				for(i=1;i<=N;i++)if(visy[i]^tim&&!Up[i]){
					visy[i]=tim;/***/
					if(!havy[i]){Aug(i);return;}
					q[++t]=havy[i];	
				}
			}
		}
		int KM(){
			int ans=0,i,j;
			for(i=1;i<=N;i++)
			for(j=1;j<=N;j++)lx[i]=max(lx[i],c[i][j]);
			for(i=1;i<=N;i++)Bfs(i);
			for(i=1;i<=N;i++)ans+=lx[i]+ly[i];
			return ans;
		}
	}
	namespace Dinic{
		struct Rabit_tree{int to,next,c,f;}e[maxm<<1];
		int len=1,head[maxn];
		void Rabit_Set(int prt,int son,int cap){
			e[++len].to=son,e[len].next=head[prt],head[prt]=len,
			e[len].c=cap,e[len].f=0;
		}
		void Rabit_set(int prt,int son,int cap){
			Rabit_Set(prt,son,cap),Rabit_Set(son,prt,0);
		}
		#define to e[i].to
		int q[maxn],vis[maxn],tim=0,Dp[maxn],cur[maxn],S,T;
		bool Bfs(){
			int s,t,rt,i;q[s=t=1]=S,Dp[S]=0,vis[S]=++tim;
			while(s<=t){
				rt=q[s++];
				for(i=head[rt];i;i=e[i].next)
					if(e[i].c>e[i].f&&vis[to]^tim)
						vis[to]=tim,Dp[to]=Dp[rt]+1,q[++t]=to;	
			}
			return vis[T]==tim;
		}
		int Dfs(int rt,int v){
			if(rt==T||!v)return v;
			int flow=0,tmp;
			for(int &i=cur[rt];i;i=e[i].next)
				if(Dp[to]==Dp[rt]+1){
					tmp=Dfs(to,min(v,e[i].c-e[i].f));
					if(tmp){
						e[i].f+=tmp,e[i^1].f-=tmp,v-=tmp,flow+=tmp;
						if(!v)break;
					}
				}
			return flow;
		}
		int Dinic(){
			int i,flow=0;
			while(Bfs()){
				for(i=1;i<=T;i++)cur[i]=head[i];
				flow+=Dfs(S,INF);
			}
			return flow;
		}
		#undef to
	}
	namespace Spfa{
		struct Rabit_tree{int to,next,c,f,dis,from;}e[maxn*5];
		int n,len=1,head[maxn],S,T;
		void Rabit_Set(int prt,int son,int cap,int cost){
			e[++len].to=son,e[len].next=head[prt],head[prt]=len,
			e[len].c=cap,e[len].f=0,e[len].dis=cost,e[len].from=prt;
		}
		void Rabit_set(int prt,int son,int cap,int cost){
			Rabit_Set(prt,son,cap,cost),Rabit_Set(son,prt,0,-cost);
		}
		#define to e[i].to
		int dis[maxn],p[maxn];bool bein[maxn];deque<int>q;
		bool Spfa(int &cost){
			int s,t,rt,i;bein[S]=true;q.push_back(S);
			for(i=1;i<=T;i++)dis[i]=INF;dis[S]=0;
			while(!q.empty()){
				rt=q.front(),q.pop_front(),bein[rt]=false;
				for(i=head[rt];i;i=e[i].next)
					if(e[i].c>e[i].f&&dis[to]>dis[rt]+e[i].dis){
						dis[to]=dis[rt]+e[i].dis,p[to]=i;
						if(!bein[to]){
							bein[to]=true;
							if(q.empty()||dis[q.front()]<=dis[to])q.push_back(to);
							else q.push_front(to);
						}
					}	
			}
			if(dis[T]==INF)return false;
			int v=INF;rt=T;
			while(rt^S)v=min(v,e[p[rt]].c-e[p[rt]].f),rt=e[p[rt]].from;
			rt=T;cost+=v*dis[T];
			while(rt^S)e[p[rt]].f+=v,e[p[rt]^1].f-=v,rt=e[p[rt]].from;
			return true;
		}
		int Spfa(){
			int cost=0;
			while(Spfa(cost));
			return cost;	
		}
		#undef to
	}
	namespace Zkw{
		struct Rabit_tree{int to,next,c,f,dis,from;}e[maxn*5];
		int n,len=1,head[maxn],S,T;
		void Rabit_Set(int prt,int son,int cap,int cost){
			e[++len].to=son,e[len].next=head[prt],head[prt]=len,
			e[len].c=cap,e[len].f=0,e[len].dis=cost,e[len].from=prt;
		}
		void Rabit_set(int prt,int son,int cap,int cost){
			Rabit_Set(prt,son,cap,cost),Rabit_Set(son,prt,0,-cost);
		}
		#define to e[i].to 
		int dis[maxn],q[maxn<<3],vis[maxn],tim=0;bool bein[maxn];
		bool Bfs(){
			int rt,i,s,t;q[s=t=1]=S,bein[S]=true;
			for(i=1;i<=T;i++)dis[i]=INF;dis[S]=0;
			while(s<=t){
				rt=q[s++],bein[rt]=false;
				for(i=head[rt];i;i=e[i].next)
					if(e[i].c>e[i].f&&dis[to]>dis[rt]+e[i].dis){
						dis[to]=dis[rt]+e[i].dis;
						if(!bein[to])bein[to]=true,q[++t]=to;
					}	
			}
			return dis[T]<INF;
		}
		int Dfs(int rt,int v){
			if(rt==T||!v)return v;
			int tmp,flow=0;vis[rt]=tim;
			for(int i=head[rt];i;i=e[i].next)
				if(vis[to]^tim&&dis[to]==dis[rt]+e[i].dis){
					tmp=Dfs(to,min(v,e[i].c-e[i].f));
					if(tmp){
						e[i].f+=tmp,e[i^1].f-=tmp,flow+=tmp,v-=tmp;
						if(!v)break;	
					}
				}
			return flow;
		}
		int Zkw(){
			int cost=0,tmp;
			while(Bfs())
				while(tim++,tmp=Dfs(S,INF))cost+=dis[T]*tmp;
			return cost;
		}
		#undef to
	}
	namespace Dfs{
		struct _tree{int to,next,dis;}e[maxn<<2];
		#define to e[i].to
		int clo[maxn],dis[maxn],head[maxn];bool ff=false;
		void Dfs(int rt){
			if(ff)return;
			clo[rt]=-rt;
			for(int i=head[rt];i;i=e[i].next)
				if(dis[to]>dis[rt]+e[i].dis){
					if(clo[to]<0){ff=true;return;}
					dis[to]=dis[rt]+e[i].dis,Dfs(to);	
				}
			clo[rt]=rt;
		}
		#undef to
	}//判负环 
	namespace TOW_SAT{
		struct Rabit_tree{int to,next;}e[maxm];
		#define to e[i].to
		int st[maxn],cot=0,vis[maxn<<1],tim=0,head[maxn];char ans[maxn];
		bool Dfs(int rt){
			if(vis[rt^1]==tim)return false;if(vis[rt]==tim)return true;
			vis[rt]=tim,st[++cot]=rt;
			for(int i=head[rt];i;i=e[i].next)
				if(!Dfs(to))return false;
			return true;
		}
		bool TOW_SAT(){//判断是否有一组合法解 
			tim++;int n;
			for(int i=0,N=n<<1;i<N;i+=2){
				cot=0;
				if(!Dfs(i)){
					while(cot)vis[st[cot--]]=false;
					if(!Dfs(i^1))return false;
				}
			}
			return true;
		}
		bool TOW_SAT(int N){//判断每一个的可行方案 
			for(int i=0;i<N;i+=2){
				tim++;if(Dfs(i))ans[i>>1]='Y';
				tim++;if(Dfs(i^1)){
					if(ans[i>>1]=='Y')ans[i>>1]='?';
					else ans[i>>1]='N';	
				}
				else if(ans[i>>1]^'Y')return false;
			}
			return true;
		}
		#undef to
	}
}
namespace Math {
	const int INF=1000*1000*1000+7;
	LL Gcd(LL a,LL b){return b?Gcd(b,a%b):a;}	
	void Gcd(LL a,LL b,LL &x,LL &y){
		if(!b){x=1,y=0;return;}
		Gcd(b,a%b,y,x),y-=x*(a/b);	
	}//ExGcd
	LL Mul(LL a,LL b,LL c){
		LL tmp=a*b-(LL)(a/(long double)c*b+1e-3)*c;
		return tmp<0?tmp+c:tmp;	
	}
	LL Rabit_pow(LL x,LL k,LL c){
		x%=c;LL res=1;	
		while(k){
			if(k&1)res=Mul(res,x,c);
			x=Mul(x,x,c),k>>=1;	
		}
		return res;
	}
	namespace Miller_Rho{
		const int N=7,P=233;LL mx;
		bool Miller(LL n){
			if(n==2)return true;
			if(n<2||!(n&1))return false;
			LL m=n-1,x,y;int k=0,i;
			while(!(m&1))k++,m>>=1;
			for(int tim=0;tim<N;tim++){
				x=Rabit_pow(rand()%(n-1)+1,m,n);
				for(i=0;i<k;i++){
					y=Mul(x,x,n);
					if(y==1&&x^1&&x^(n-1))return false;	
					x=y;
				}
				if(x^1)return false;
			}
			return true;
		}
		LL Rho(LL n,int c){
			LL x=rand()%(n-1)+1,y=x,g;
			for(int k=2,i=1;;i++){
				x=Mul(x,x,n)+c;if(x>=n)x-=n;
				g=x>y?x-y:y-x;g=Gcd(g,n);
				if(1<g&&g<n)return g;
				if(x==y)return n;
				if(i==k)k<<=1,y=x;	
			}
		}
		void Find(LL n){
			if(n==1)return;
			if(Miller(n)){mx=max(n,mx);return;}
			LL p=n;int k=P;
			do p=Rho(p,k--);while(p==n);
			Find(p),Find(n/p);	
		}
	}
	namespace Lucas{
		int F[maxn],inv[maxn];
		int GetC(int n,int m){
			if(n<m)return 0;
			return F[n]*1ll*inv[m]%INF*inv[n-m]%INF;
		}
		int Lucas(LL n,LL m){
			if(!m)return 1;
			return (Lucas(n/INF,m/INF)*1ll*GetC(n%INF,m%INF))%INF;	
		}
	}
	namespace CRT{
		LL a1,a2,b1,b2;
		bool Calc(){//x%a1=b1,x%a2=b2
			LL c=b2-b1,g=Gcd(a1,a2);
			if(c%g)return false;
			c/=g,a1/=g,a2/=g;
			LL k,tmp;Gcd(a1,a2,k,tmp);
			k=(k%a2+a2)%a2;
			k=Mul(k,(c%a2+a2)%a2,a2);
			LL x,lcm=a1*a2*g;
			x=(Mul(k,a1*g,lcm)+b1)%lcm;
			a1=lcm,b1=x;
			return true;
		}
	}
	namespace Phi{
		int prime[maxn/10],cnt=0,phi[maxn];
		void Phi_Table(int n){
			int N=n,i,j;phi[1]=1;
			for(i=2;i<=N;i++){
				if(!phi[i])prime[++cnt]=i,phi[i]=i-1;
				for(j=1;j<=cnt;j++){
					if(i*prime[j]>N)break;
					if(i%prime[j])phi[i*prime[j]]=phi[i]*(prime[j]-1);
					else{phi[i*prime[j]]=phi[i]*prime[j];break;}
				}	
			}
		}
	}
	namespace Dujiao{
		const int mod=8388607,N=mod+1;
		int miu[maxn];
		struct Rabit_tree{int next,v;LL to;};
		struct Rabit_HASH{
			int head[mod+10],len;Rabit_tree e[maxn];
			int Get(LL key){
				for(int rt=key&mod,i=head[rt];i;i=e[i].next)
					if(e[i].to==key)return e[i].v;
				return -1;	
			}
			void Set(LL key,int v){
				int rt=key&mod;e[++len].to=key,e[len].next=head[rt],head[rt]=len,e[len].v=v;	
			}
		}mp;
		int Get(LL n){
			if(n<N)return miu[n];
			int res=mp.Get(n);
			if(res^INF)return res;else res=1;
			for(LL i=2,last;i<=n;i=last+1)
				last=n/(n/i),res-=(last-i+1)*Get(n/i);
			mp.Set(n,res);return res;
		}
	}
	namespace Matrix_Tree{
		int fx[4]={0,0,1,-1},fy[4]={1,-1,0,0},a[maxn][maxn],N,n,m,s[maxn][maxn];
		void Rabit_set(){
			int i,j,k,x,y;
			for(i=1;i<=n;i++)
			for(j=1;j<=m;j++)if(s[i][j])
			for(k=0;k<4;k++){
				x=fx[k]+i,y=fy[k]+j;
				if(s[x][y])a[s[x][y]][s[i][j]]=INF-1;	
			}	
			for(i=1;i<=N;i++)
			for(j=1;j<=N;j++)if(a[i][j]&&i^j)a[i][i]++;
		}
		int Rabit_gs(){
			N--;int i,j,k;long long ans=1,tmp;
			for(j=1;j<=N;j++){
				for(i=j+1;i<=N;i++)
					while(a[i][j]){
						tmp=a[j][j]/a[i][j];
						for(k=j;k<=N;k++)
							a[j][k]-=tmp*a[i][k]%INF,a[j][k]=(a[j][k]+INF)%INF,
							swap(a[i][k],a[j][k]);
						ans=-ans;	
					}
				ans=(ans*a[j][j])%INF;if(ans<0)ans+=INF;
			}
			return ans;
		}
	}
	namespace Gauss{
		int N,m;
		namespace Gs{
			int a[maxn][maxn];
			int Gs(){
			    int i,j,k;long long tmp,inv;
			    for(i=1;i<=N;i++){
			        inv=Rabit_pow(a[i][i],INF-2,INF);
			        for(j=i+1;j<=N;j++)if(a[j][i]){
			            tmp=(inv*1ll*a[j][i])%INF;
			            for(k=i;k<=N+1;k++)a[j][k]+=INF-(tmp*1ll*a[i][k])%INF,a[j][k]%=INF;
			        }   
			    }   
			    return (a[N][N+1]*1ll*Rabit_pow(a[N][N],INF-2,INF))%INF;    
			}
		}//膜剩余系下高斯消元
		double a[maxn][maxn];const double EPS=1e-15;
		bool Cmp(double x){return x<0?x>-EPS:x<EPS;}
		void Gauss(){
			int i,j,k,now;long double tmp;
			for(i=now=1;i<=N;i++,now++){
				for(j=now;j<=N&&Cmp(a[j][i]);j++);
				if(j>N){now--;continue;}
				if(j^now)for(k=1;k<=N+1;k++)swap(a[now][k],a[j][k]);
				for(j=1;j<=N;j++)if(j^now){
					if(Cmp(a[j][i]))continue;
					tmp=a[j][i]/a[now][i];
					for(k=1;k<=N+1;k++)a[j][k]-=tmp*a[now][k];
				}
			}
			for(i=1;i<=N;i++)if(!Cmp(a[i][i]))a[i][N+1]/=a[i][i];
		}//高斯约当消元 
		double GS(){
			int i,j,k;long double tmp;
			for(i=1;i<=N;i++){
				for(j=i+1;j<=N&&j<=i+m;j++)if(!Cmp(a[j][i])){
					tmp=a[j][i]/a[i][i];
					for(k=i;k<=N&&k<=i+m;k++)a[j][k]-=tmp*a[i][k];
		            a[j][N+1]-=tmp*a[i][N+1];
				}
			}	
		}//网格图内高斯消元 
	}
}
namespace String{
	namespace ACautomata{
		int ch[maxn][26],cnt,fail[maxn],num[maxn],N,q[maxn];bool v[maxn];char o[maxn];
		int New(){
			cnt++;fail[cnt]=v[cnt]=0;memset(ch[cnt],0,sizeof(ch[cnt]));return cnt;	
		}
		void Set(char *s){
			int len=strlen(s+1),i,p=0,x;
			for(i=1;i<=len;i++){
				x=s[i]-'a';
				if(!ch[p][x])ch[p][x]=New();
				p=ch[p][x];	
			}
			v[p]=true;
		}
		void Build(){
		    int rt,i,j,s,t,u;s=1,t=0;
		    for(i=0;i<26;i++)if(ch[0][i])q[++t]=ch[0][i];
		    while(s<=t){
		        rt=q[s++];
		        for(i=0;i<26;i++){
		            u=ch[rt][i];
		            if(!u){ch[rt][i]=ch[fail[rt]][i];continue;}
		            q[++t]=u;fail[u]=ch[fail[rt]][i];
		        }   
		    }
		}
	}
	namespace MP{
		char s1[maxn],s2[maxn];int fail[maxn],len1,len2,cnt;
		int KMP(){
			len1=strlen(s1+1),len2=strlen(s2+1);
			fail[1]=cnt=0;int i,j;
			for(j=0,i=2;i<=len1;i++){
				while(j&&s1[j+1]^s1[i])j=fail[j];
				if(s1[j+1]==s1[i])j++,fail[i]=j;
				else fail[i]=fail[j];/***/	
			}
			for(j=0,i=1;i<=len2;i++){
				while(j&&s1[j+1]^s2[i])j=fail[j];
				if(s1[j+1]==s2[i])j++;
				if(j==len1)cnt++,j=fail[j];	
			}
			return cnt;
		}
		int MP(){
			len1=strlen(s1+1),len2=strlen(s2+1);
			fail[1]=cnt=0;int i,j;
			for(j=0,i=2;i<=len1;i++){
				while(j&&s1[j+1]^s1[i])j=fail[j];
				if(s1[j+1]==s1[i])j++;fail[i]=j;	
			}
			for(j=0,i=1;i<=len2;i++){
				while(j&&s1[j+1]^s2[i])j=fail[j];
				if(s1[j+1]==s2[i])j++;
				if(j==len1)cnt++,j=fail[j];	
			}
			return cnt;
		}
	}
	namespace SA{
		char s[maxn];int wa[maxn],wb[maxn],sa[maxn],cnt[maxn],Rank[maxn];
		int height[maxn],st[20][maxn],Log2[maxn];
		void Log2_init(){
			for(int i=0;1<<i<maxn;i++)Log2[1<<i]=i;
			for(int i=1;i<maxn;i++)if(!Log2[i])Log2[i]=Log2[i-1];	
		}
		void Rabit_sa(int n,int m){
			int *x=wa,*y=wb,*t;int i,j,p;
			for(i=0;i<m;i++)cnt[i]=0;
			for(i=0;i<n;i++)cnt[x[i]=s[i]]++;
			for(i=1;i<m;i++)cnt[i]+=cnt[i-1];
			for(i=n-1;~i;i--)sa[--cnt[x[i]]]=i;
			for(j=1,p=1;p<n;j<<=1,m=p){
				for(p=0,i=n-j;i<n;i++)y[p++]=i;
				for(i=0;i<n;i++)if(sa[i]>=j)y[p++]=sa[i]-j;
				for(i=0;i<m;i++)cnt[i]=0;
				for(i=0;i<n;i++)cnt[x[y[i]]]++;
				for(i=1;i<m;i++)cnt[i]+=cnt[i-1];
				for(i=n-1;~i;i--)sa[--cnt[x[y[i]]]]=y[i];
				for(t=x,x=y,y=t,x[sa[0]]=0,p=i=1;i<n;i++)
					x[sa[i]]=((y[sa[i]]==y[sa[i-1]])&&(y[sa[i]+j]==y[sa[i-1]+j]))?p-1:p++;	
			}
		}
		void Rabit_H(int n){
			int i,j,k=0;
			for(i=0;i<=n;i++)Rank[sa[i]]=i;
			for(i=0;i<n;height[Rank[i++]]=k)
			for(k?k--:k,j=sa[Rank[i]-1];s[i+k]==s[j+k];k++);
		}
		void Rabit_ST(int n){
			int i,j;
			for(i=0;i<=n;i++)st[0][i]=height[i+1];
			for(j=1;j<=Log2[n];j++)
			for(i=0;i<=n;i++){
				st[j][i]=st[j-1][i];
				if(i+(1<<(j-1))<=n)st[j][i]=min(st[j][i],st[j-1][i+(1<<(j-1))]);
			}
		}
		int Rabit_lcp(int x,int y){
			if(x>y)swap(x,y);y--;
			int k=Log2[y-x+1];return min(st[k][x],st[k][y-(1<<k)+1]);
		}
	}//带ST 
	namespace SAM{
		int RT=1,last=1,cnt=1,v[maxn<<1],fail[maxn<<1];map<int,int>ch[maxn<<1];
		void Add(int x){
			int rt=++cnt,p=last;v[rt]=v[p]+1;
			while(p&&!ch[p].count(x))ch[p][x]=rt,p=fail[p];
			if(!p)fail[rt]=RT;
			else{
				int q=ch[p][x];
				if(v[q]==v[p]+1)fail[rt]=q;
				else{
					int u=++cnt;v[u]=v[p]+1,fail[u]=fail[q];
					ch[u]=ch[q];fail[q]=fail[rt]=u;
					while(p&&ch[p][x]==q)ch[p][x]=u,p=fail[p];	
				}
			}
			last=rt;
		}
	}
	namespace PAM{
		int ch[maxn][26],fail[maxn],v[maxn],cnt,last,cct[maxn];char s[maxn];
		void Add(int n,int x){
			if(!cnt){//Init
				fail[last=0]=cnt=1,s[0]=v[1]=-1;
			}
			int p=last;s[n]=x;
			while(s[n]^s[n-v[p]-1])p=fail[p];
			if(!ch[p][x]){
				int rt=++cnt,Fa=p;v[rt]=v[p]+2;
				do p=fail[p];while(s[n]^s[n-v[p]-1]);
				fail[rt]=ch[p][x],last=ch[Fa][x]=rt;/***/
			}
			else last=ch[p][x];
		}
	}
	namespace Manacher{
		const int INF=1000*1000*1000+7;
		struct Rabit_tree{int to,next,ope;}e[maxn*3];
		int n,head[maxn],len=1,clo[maxn],us[26],cot,tim=0,d[maxn];char s[maxn];
		void Set(int prt,int son,int ope){
			if(prt&1)return;prt>>=1,son>>=1;/***/
			e[++len].to=son,e[len].next=head[prt],head[prt]=len,e[len].ope=ope;
		}
		void Manacher(){
			int i,mx=0,id=0;n=strlen(s+1)<<1|1;
			for(i=n;i;i--)if(i&1)s[i]='#';else s[i]=s[i>>1];s[0]='$';
			for(i=1;i<=n;i++){
				d[i]=i<mx?min(d[id+id-i],mx-i):1;
				while(s[i+d[i]]==s[i-d[i]])d[i]++;
				if(i+d[i]>mx)mx=i+d[i],id=i;
			} 
		}
		void Set(){	
			int i,j,mx;
			for(mx=1,i=2;i<=n;i++){
				if(i+d[i]>mx){
					for(j=mx;j<i+d[i];j++)Set(j,i+i-j,0),Set(i+i-j,j,0);
					mx=i+d[i];	
				}
				if(0<i-d[i]&&i+d[i]<=n)Set(i-d[i],i+d[i],1),Set(i+d[i],i-d[i],1);
			}
		}
		#define to e[i].to
		void Dfs(int rt){
			for(int i=head[rt];i;i=e[i].next)
				if(e[i].ope){
					if(clo[to]>=0&&us[clo[to]]^tim)us[clo[to]]=tim,cot--;
				}
				else if(to>rt)Dfs(to);
		}
		void Mark(int rt,int k){
			clo[rt]=k;
			for(int i=head[rt];i;i=e[i].next)
				if(!e[i].ope&&to>rt)Mark(to,k);
		}
		void Rabit_ans(){
			int i,j,ans=1;n>>=1;
			for(i=1;i<=n;i++)clo[i]=-1;
			for(i=1;i<=n;i++)if(clo[i]<0){
				cot=26,tim++;Dfs(i);
				for(j=0;j<26;j++)if(us[j]^tim)break;
				Mark(i,j);ans=(ans*1ll*cot)%INF;
			}
			printf("%d\n",ans);
		}
	}
}
namespace Geometry{
	const double EPS=1e-15;
	bool Cmp(double x){return x<0?x>-EPS:x<EPS;}
	int Dcmp(double x){return Cmp(x)?0:(x<0?-1:1);}
	struct Poi {
		#define Vec Poi
		double x,y;
		bool operator < (const Poi &a)const{
			return 	Cmp(x-a.x)?y<a.y:x<a.x;
		}	
		Vec operator - (const Poi &a)const{
			return (Vec){x-a.x,y-a.y};	
		}
		Poi operator + (const Vec &a)const{
			return (Poi){x+a.x,y+a.y};	
		}
		double operator * (const Vec &a)const{
			return x*a.y-y*a.x;	
		}
		double operator / (const Vec &a)const{
			return x*a.x+y*a.y;	
		}
		Vec operator ^ (const double &a)const{
			return (Vec){x*a,y*a};	
		}
		double len(){return sqrt(x*x+y*y);}
	}p[maxn],st[maxn];
	struct Line {
		Poi p;Vec v;double ang;
		void Init(Poi P,Vec V){
			p=P,v=V,ang=atan2(v.y,v.x);	
		}	
		bool operator < (const Line &a)const{
			return Cmp(ang-a.ang)?v.y<a.v.y:ang<a.ang;	
		}
		bool left(Poi a){
			return Dcmp((a-p)*v)<0;
		}
		Poi operator * (const Line &a)const{
			Vec u=p-a.p;
			double t=(a.v*u)/(v*a.v);
			return p+(v^t);	
		}
	}L[maxn],q[maxn];
	double Angle(Vec u,Vec v){
		return acos((u/v)/u.len()/v.len());
	}//向量的极角 
	bool InPSLG(Poi *p,int m,Poi x){
		double ang;
		for(int i=0;i<m;i++)
		for(int j=0;j<m;j++)if(i^j)
			ang=Angle(p[i],p[j])/*,Set(i,j,ang),Set(j,i,-ang)*/;
		/*if(Dfs())*/return true;//有负环 
		/*else*/return false;
	}//判点在平面区域内 
	int Andrew(int n){
		int i,k,m=0;sort(p,p+n);
		for(i=0;i<n;i++){
			while(m>1&&Dcmp((st[m-1]-st[m-2])*(p[i]-st[m-2]))<=0)m--;
			st[m++]=p[i];	
		}
		k=m;
		for(i=n-2;i>=0/***/;i--){
			while(m>k&&Dcmp((st[m-1]-st[m-2])*(p[i]-st[m-2]))<=0)m--;
			st[m++]=p[i];	
		}
		if(n>1)m--;return m;
	} 
	bool Inhull(Poi p,int m){
		if(m<=2)return Cmp((st[1]-st[0])*(p-st[0]))&&Dcmp((p-st[0])/(p-st[1]))<=0;
		Vec tmp=p-st[0];
		if(Dcmp((st[m-1]-st[0])*tmp)>0)return false;
		int l=1,r=m-1,mid;
		while(l^r){
			mid=(l+r)>>1;
			if(Dcmp((st[m-1]-st[0])*tmp)<=0)r=mid;else l=mid+1;	
		}
		return Dcmp((st[l]-st[l-1])*(p-st[l-1]))>=0;
	} 
	bool InPolygon(Poi x,int n){
		int cnt=0,d1,d2,k;p[n]=p[0];
		for(int i=1;i<=n;i++){
			k=Dcmp((p[i]-p[i-1])*(x-p[i-1]));
			if(!k){
				if(Dcmp((x-p[i])/(x-p[i-1]))<=0)return true;
				continue;
			}
			d1=Dcmp(p[i].y-x.y),d2=Dcmp(p[i-1].y-x.y);
			if(k>0&&d1>=0&&d2<0)cnt++;
			if(k<0&&d2>=0&&d1<0)cnt--;
		}
		return cnt!=0;
	}//判点在简单多边形内
	double TurnEgg(int n){
		st[n]=st[0];int i,now=1;double ans=0;
		for(i=0;i<n;i++){
			while(Dcmp((st[i+1]-st[i])*(st[now]-st[i])-(st[i+1]-st[i])*(st[now+1]-st[i]))<0)
				if(++now==n)now=0;
			ans=max(ans,(st[now]-st[i]).len());	
		}
		return ans;		
	}//凸包的直径 
	int HalfPlane(int n){
		int s,t,i;q[s=t=0]=L[0];
		for(i=1;i<n;i++){
			while(s<t&&!L[i].left(p[t-1]))t--;
			while(s<t&&!L[i].left(p[s]))s++;/***/
			q[++t]=L[i];
			if(Cmp(q[t-1].v*q[t].v)){
				t--;if(q[t].left(L[i].p))q[t]=L[i];	
			}
			if(s<t)p[t-1]=q[t]*q[t-1];
		}
		while(s<t&&!q[s].left(p[t-1]))t--;
		if(t-s<=1)return 0;p[t]=q[s]*q[t];
		int m=0;
		for(i=s;i<=t;i++)st[m++]=p[i];
		return m;
	}
}
namespace DP{
	namespace Decision{
		struct Rabit_q{int x,l,r;}q[maxn];LL f[maxn],sum[maxn];
		LL Rabit_get(int j,int i){
			int v=sum[i]-sum[j]+i-j-1;
			return f[j]+v;
		}
		int Rabit_find(int l,int r,int x,int sb){
			int mid;r++;/***/
			while(l^r){
				mid=(l+r)>>1;
				if(Rabit_get(x,mid)<Rabit_get(sb,mid))l=mid+1;
				else r=mid;	
			}	
		    return l;
		}
		LL Rabit_ans(int n){
			int s,t,i,v;f[0]=0,q[s=t=1]=(Rabit_q){0,0,n};
			for(i=1;i<=n;i++){
				q[s].l++;while(s<=t&&q[s].l>q[s].r)s++;
				while(s<=t&&q[s].r<i)s++;
				f[i]=Rabit_get(q[s].x,i);
				while(s<=t){
					if(Rabit_get(q[t].x,q[t].l)>=Rabit_get(i,q[t].l))t--;
					else {
						v=Rabit_find(q[t].l,q[t].r,q[t].x,i),
						q[t].r=v-1,q[++t]=(Rabit_q){i,v,n};
						if(q[t].l>q[t].r)t--;/***/
						break;
					}
				}	
				if(s>t)q[++t]=(Rabit_q){i,i,n};
			}
			return f[n];
		}
	}//决策单调性
	namespace K_CDQ{
		int n;double A[maxn],B[maxn],Rate[maxn],f[maxn],g[maxn],hav[maxn];
		int L[maxn],R[maxn],q[maxn];
		bool Cmpf(int a,int b){return f[a]<f[b];}
		bool Cmpab(int a,int b){return A[a]/B[a]<A[b]/B[b];}
		double Get(int i,int j){return (g[i]-g[j])/(f[i]-f[j]);}
		bool Dig(int a,int b,int c){
			if(f[a]==f[b])return g[b]<=g[a];/***/
			return Get(b,a)<=Get(c,a);
		}
		void Rabit_run(int l,int r){
			if(l==r){g[l]=f[l]/Rate[l];return;}
			int mid=(l+r)>>1,i,cnt1=0,cnt2=0,s=1,t=0;double x,tmp;
			Rabit_run(l,mid);
			for(i=l;i<=mid;i++)L[cnt1++]=i;sort(L,L+cnt1,Cmpf);
			for(i=mid+1;i<=r;i++)R[cnt2++]=i;sort(R,R+cnt2,Cmpab);
			for(i=0;i<cnt1;i++){
				while(s<t&&Dig(q[t-1],q[t],L[i]))t--;
				q[++t]=L[i];
			}
			for(i=0;i<cnt2;i++){
				x=-A[R[i]]/B[R[i]];
				while(s<t&&Get(q[s+1],q[s])>=x)s++;
				tmp=f[q[s]]*A[R[i]]+f[q[s]]*B[R[i]]/Rate[q[s]];
				hav[R[i]]=max(hav[R[i]],tmp);
			}
			for(i=mid+1;i<=r;i++)
				hav[i]=max(hav[i],hav[i-1]),f[i]=max(f[i],hav[i]/(A[i]+B[i]/Rate[i]));
			Rabit_run(mid+1,r);
		}
	}//斜率优化 
	namespace Bitset{
		char A[maxn],B[maxn];int len1,len2,cnt=0,st[maxn],la[26];
		bitset<maxn>s[26],check;
		void KMP(){//A为模板B为匹配 
			int i; 
			for(i=0;i<len1;i++)s[A[i]-'a'][i]=true;
			for(i=0;i+len2<=len1;i++)check[i]=true;
			for(i=0;i<len2;i++)//check[i]为以i为开头的子串 
				if(B[i]^'?')B[i]-='a',s[B[i]]>>=i-la[B[i]],check&=s[B[i]],la[B[i]]=i;
			for(i=0;i+len2<=len1;i++)if(check[i])st[++cnt]=i;
			printf("%d\n",cnt);
			for(i=1;i<=cnt;i++)printf("%d\n",st[i]);
		}
	}
}
int main(){
	freopen("aplusb.in","r",stdin);freopen("aplusb.out","w",stdout);
	for(int i=0;i<23333333;i++)delete new int;
	float a,b;scanf("%f%f",&a,&b);printf("%.0f\n",(a+b+1e-10));
	getchar(),getchar();
	fclose(stdin);fclose(stdout);return 0;
}