public static void calSumUtil(int a[], int b[], int n, int m) {
int[] sum = new int[n];
int i = n - 1, j = m - 1, k = n-1;
int carry = 0, s = 0;
while (j >= 0) {
s = a[i] + b[j] + carry;
sum[k] = (s % 10);
carry = s / 10;
k–;
i–;
j–;
}
while (i >= 0) {
s = a[i] + carry;
sum[k] = (s % 10);
carry = s / 10;
i--;
k--;
}
if (carry == 1) {
int [] sumc= new int [n+1];
sumc[0]=1;
for(int kk=0;kk<sum.length;kk++) {
sumc[kk+1]=sum[kk];
}
for (int z = 0; z < sumc.length; z++) {
System.out.print(sumc[z] + ", ");
}
}
else {
for (int z = 0; z < sum.length; z++) {
System.out.print(sum[z] + ", ");
}
}
System.out.print("END");
}
static int calSum(int a[], int b[], int n, int m) {
if (n >= m)
calSumUtil(a, b, n, m);
else
calSumUtil(b, a, m, n);
return 0;
}
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int m = s.nextInt();
int n = s.nextInt();
int[] a = new int[m];
int[] b = new int[n];
for (int i = 0; i < m; i++) {
a[i] = s.nextInt();
}
for (int i = 0; i < n; i++) {
b[i] = s.nextInt();
}
calSum(a, b, m, n);
s.close();
}
}