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

typedef long long          ll;
typedef long double        ld;
typedef unsigned long long ull;
typedef vector<ll>         vl;
typedef vector<vl>         vvl;
typedef pair<ll,ll>        pll;
typedef vector<pll>        vpll;

#define ff          first
#define ss          second
#define pb          push_back
#define eb          emplace_back
#define fr(i,n)     for(ll i = 0; i < n; ++i)
#define frs(i,s,n)  for(ll i = s; i < n; ++i)
#define frb(i,s,e)  for(ll i = s; i <= e; ++i)
#define rfr(i,n)    for(ll i = n-1; i >= 0; i--)
#define frbr(i,e,s) for(ll i = e; i >= s; i--)
#define all(x)      (x).begin(), (x).end()
#define sz(x)       ((ll)(x).size())

#ifdef LOCAL
#include <debugger.h>
#else
#define dbg(x...)      {}
#define dbg_arr(a,n)   {}
#define dbg_mat(m,r,c) {}
#define dbg_time()     {}
#endif

const ll MOD  = 1e9+7; // 998244353;
const ll INF  = 1e18;
const ll MAX  = 100100;




void pre()
{
  // factorizer::sieve();
  // prepare_factorials();
}




void solve()
{
  ll a, b; cin >> a >> b; 
  ll s1 = 0, s2 = 0;
  while(a > 0)
  {
    s1 += (a % 10);
    a /= 10;
  }
  while(b > 0)
  {
    s2 += (b % 10);
    b /= 10;
  }
  cout << max(s1, s2) << "\n";
}




signed main()
{  
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);

#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  // cout << fixed << setprecision(15);
  
  pre();

  ll _t = 1;
  // cin >> _t;
  frb(CASE, 1, _t)
  {
    // cout << "Case #" << CASE << ": ";
    // dbg(CASE);
    solve();
  }

  dbg_time();
  
  return 0;
}     
     

#include <bits/stdc++.h>

using ll = long long;

using namespace std;

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

void solve()
{
    int a, b;
    cin >> a >> b;

    cout << max(sum(a), sum(b)) << endl;
}

int main()
{
    int t = 1;
    //cin >> t;

    while (t--)
    {
        solve();
    }

    return 0;
}
