#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <climits>
using namespace std;
typedef long long unsigned int unsigned_myint;
typedef long long int myint;
  
int main(){
 int A,B,S[3],T[3],a,b;
 cin >> A;
 cin >> B;

S[0]=A/100;
S[1]=(A-S[0]*100)/10;
S[2]=(A-S[0]*100-S[1]*10);
T[0]=B/100;
T[1]=(B-T[0]*100)/10;
T[2]=(B-T[0]*100-T[1]*10);

a=S[0]+S[1]+S[2];
b=T[0]+T[1]+T[2];

if(a<b){
    cout << b<< endl;
}else{
    cout << a <<endl;
}

 
}

#include <bits/stdc++.h>
#define ll long long
#define pii pair<ll,ll>
#define x first
#define y second
using namespace std;

int main(){
string a,b;
cin>>a>>b;
int a1=a[0]+a[1]+a[2]-'0'-'0'-'0';
int b1=b[0]+b[1]+b[2]-'0'-'0'-'0';
cout<<max(a1,b1);
return 0;
}
