#include
using namespace std;
int main()
{
int N=0, M=0;
int arr1[1000]={}, arr2[1000]={}, sum_digit[1001]={};
cin>>N;
cin>>M;
//inputing the first digit beforehand so as to determine the sign of the number
int flag=0;
cin>>arr1[0];
if(arr1[0]<0)
{
flag++;
}
if(flag==0)
{
for(int i=1; i<N; i++)
{
cin>>arr1[i];
}
}
else
{
for(int i=1; i<N; i++)
{
cin>>arr1[i];
arr1[i]*=(-1);
}
}
//Repeating the same process for the next number
flag=0;
cin>>arr2[0];
if(arr2[0]<0)
{
flag++;
}
if(flag==0)
{
for(int j=1; j<M; j++)
{
cin>>arr2[j];
}
}
else
{
for(int j=1; j<M; j++)
{
cin>>arr2[j];
arr2[j]=-arr2[j];
}
}
//------------------------main algo for the addition----------------
if(N>=M)
{
int i=N-1, j=M-1, itr=0, carry=0;
while((i>=0)&&(j>=0))
{
carry=(arr1[i]+arr2[j])/10;
sum_digit[itr]+=(arr1[i]+arr2[j])%10;
sum_digit[itr+1]=carry;
--i;
--j;
itr++;
}
while(i>=0)
{
carry=(sum_digit[itr]+arr1[itr])/10;
sum_digit[itr]=(sum_digit[itr]+arr1[itr])%10;
sum_digit[itr+1]=carry;
--i;
++itr;
}
for(int ind=itr; ind>=0; ind--)
{
if(ind==itr && sum_digit[ind]==0)
{
continue;
}
cout<<sum_digit[ind]<<", ";
}
cout<<"END";
}
else
{
int i=M-1, j=N-1, itr=0, carry=0;
while((i>=0)&&(j>=0))
{
carry=(arr2[i]+arr1[j])/10;
sum_digit[itr]+=(arr2[i]+arr1[j])%10;
sum_digit[itr+1]=carry;
--i;
--j;
itr++;
}
while(i>=0)
{
carry=(sum_digit[itr]+arr2[itr])/10;
sum_digit[itr]=(sum_digit[itr]+arr2[itr])%10;
sum_digit[itr+1]=carry;
--i;
++itr;
}
for(int ind=itr; ind>=0; ind--)
{
if(ind==itr && sum_digit[ind]==0)
{
continue;
}
cout<<sum_digit[ind]<<", ";
}
cout<<"END";
}
}