#include<iostream>
using namespace std;
void main()
{ void addition(int *a,int *b ,int *c,int n);
int a[5]={0,1,1,1,0};
int b[5]={1,1,1,0,1};
int c[6];
addition(a,b,c,5);
for(int i=0;i<6;i++)
{
cout<<c[i]<<" ";
}
cout<<endl;
char f;
cin>>f;
}
void addition(int *a,int *b ,int *c,int n)
{
for(int i=n-1;i>=0;i--)
{
c[i+1]=a[i]+b[i];
}
c[0]=0;
for(int i=0;i<n+1;i++)
{
cout<<c[i]<<" ";
}
cout<<endl;
for(int j=n;j>=1;j--)
{
if(c[j]>=2)
{
c[j-1]+=1;
c[j]=c[j]%2;
}
}
}