#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define int                 long long
#define double              long double
#define endl                "\n"
#define pb                  push_back
#define PI                  3.1415926535897932384626433832795l
#define F                   first
#define S                   second
#define mp                  make_pair
#define f(i,n)              for(int i=0;i<n;++i)
#define loop(i,a,b)         for (int i=a ; i<b ;++i)
#define fastio              ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)              (v).begin(),(v).end()
#define rall(v)             (v).rbegin(),(v).rend()
#define gcd(a,b)            __gcd((a),(b))
#define fill(a,value)       memset(a,value,sizeof(a));
#define minn(v)             *min_element(v.begin(), v.end());
#define maxx(v)             *max_element(v.begin(), v.end());
#define print(x)            cout<<(x)<<endl;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int mod = 1e9 + 7;
const int MOD = 998244353;

int sol(int x)
{
	int c = 0;
	while (x > 0)
	{
		c += x % 10;
		x /= 10;
	}
	return c;
}
signed main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio;
	cout << fixed << setprecision(12);
	int a, b;
	cin >> a >> b;
	int s1 = sol(a);
	int s2 = sol(b);
	print(max(s1, s2))


	return 0;
}
#include <bits/stdc++.h>

using namespace std;

int main(){
    int A, B;
    cin >> A >> B;

    vector<int> n(6);
    int s1, s2;
    n[0] = A / 100;
    n[1] = (A - n[0] * 100) / 10;
    n[2] = A - n[0] * 100 - n[1] * 10;
    n[3] = B / 100;
    n[4] = (B - n[3] * 100) / 10;
    n[5] = B - n[3] * 100 - n[4] * 10;

    s1 = n[0] + n[1] + n[2];
    s2 = n[3] + n[4] + n[5];

    if(s1 >= s2) cout << s1 << endl;
    else cout << s2 << endl;
    return 0;
}
