import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
while(s.hasNext()){
//String s1 = "";//s.nextLine();
//String s2 = "";//s.nextLine();9876543210
//630222
//6450
//623192091
//14426202982932
String s1 = s.nextLine(); String s2 = s.nextLine(); s1 = s1.replace(" ",""); s2 = s2.replace(" ",""); //1234567890 //s1="623192091";s2="14426202982932"; //s1="630222";s2="6450"; s1=reverse(s1); s2=reverse(s2); if(s1.length()>s2.length()){ System.out.println(fun(s1,s2)); }else if(s1.length()<s2.length()){ System.out.println(fun(s2,s1)); }else { System.out.println(fundeng(s2,s1)); } } } public static String reverse(String s1){ String s = ""; for(int i = s1.length()-1;i>=0;i--){ s=s+s1.charAt(i); } //s = s.replace(" ",""); return s; } public static String fun(String s1,String s2){//s1比s2长,放进来的是翻转过的,0位是尾 int len1 = s1.length(); int len2 = s2.length();//取得长度 int num,count=0; String ss = "";//中间用的字符串 String swei = s1.substring(0,len2+1);//和s2长度一样的先切出来 String stou = s1.substring(len2,len1);//剩下的就是头 for(int i = 0;i<len2;i++){//先把长度相同的算一下 num = swei.charAt(i)-'0'+s2.charAt(i)-'0'+count;//看看有无进位 if(num>9){//看看是否需要进位 num = num%10;//取个位 count=1;//进位加一 }else{ count = 0; } ss = ss + num;//把算出来的各位连起来,顺序是反的 } if(count==1){//有进位的话需要计算后面的部分 for(int i = 0;i < len1-len2;i++){// num = stou.charAt(i)-'0'+count; if(num>9){//看看是否需要进位 num = num%10;//取个位 count=1;//进位加一 }else{ count = 0; } ss = ss + num;//把算出来的各位连起来,顺序是反的 } }else{ ss = ss + stou; } return reverse(ss); } public static String fundeng(String s1,String s2){//s1比s2长,放进来的是翻转过的,0位是尾 int len1 = s1.length(); int len2 = s2.length();//取得长度 int num,count=0; String ss = "";//中间用的字符串 //String swei = s1.substring(1,len2+1);//和s2长度一样的先切出来 //String stou = s1.substring(len2+1,len1);//剩下的就是头 for(int i = 0;i<len2;i++){//先把长度相同的算一下 num = s1.charAt(i)-'0'+s2.charAt(i)-'0'+count;//看看有无进位 if(num>9){//看看是否需要进位 num = num%10;//取个位 count=1;//进位加一 }else{ count = 0; } ss = ss + num;//把算出来的各位连起来,顺序是反的 } if(count==1){ ss = ss + 1; } return reverse(ss); }
}