#include <bits/stdc++.h>
using namespace std;

int solve(int x){
    int sum = 0;
    while(x > 0){
        sum += x%10;
        x = x/10;
    }
    return sum;
} 

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a,b;
    cin>>a>>b;
    int k = solve(a);
    int c = solve(b);
    cout<<max(k,c)<<"\n";
    return 0;
}
#include <bits/stdc++.h>
#include <fstream>
#include <bitset>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF=2147483647;
// 9,223,372,036,854,775,807
const ll INFL = 9223372036854775807;

int s(string x){
    int l,m,n;
    l = x[2] - '0';
    m = x[1] - '0';
    n = x[0] - '0';
    return l+m+n;
}

int main(){

    string a,b;
    cin >> a>>b;
    int asum,bsum;
    asum = s(a);
    bsum = s(b);
    if(asum>=bsum){
        cout << asum << endl;
    }
    else{
        cout << bsum << endl;
    }
    return 0;
}