#include <bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mem(a,b) memset(a, b, sizeof(a))
#define f first
#define s second
#define S size()
#define pb(x) push_back(x)
typedef double D;
typedef long long ll;
typedef long double ld;
const int MOD=(int)1e9+7,MAX=(int)1e5+10;
 int a,b,sa,sb;
int main()
{
    cin>>a>>b;
    while (a) {
        sa+=a%10;
        a/=10;
    }
    while (b) {
        sb+=b%10;
        b/=10;
    }
    cout<<max(sa,sb);

}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;


const int maxn = 1e6 + 5;




int S(int x) {
    if (x==0) return 0;
    return x%10 + S(x/10);
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

    int a,b;
    cin>>a>>b;
    out(max(S(a),S(b)));
    
    
    return 0;
}
