#include<iostream>
using namespace std;
typedef long long ll;
long long int gcd(long long a,long long b){
  if(b==0){
    return a;
  }
  else{
    return gcd(b,a%b);
  }
}
long long int lcm(long long a,long long b){
  return a/gcd(a,b)*b;
}
int main(){
int a,b;
  cin >> a >> b;
  int as,bs;
  as=a%100%10+a/10%10+a/100;
  bs=b%100%10+b/10%10+b/100;
  cout << max(as,bs) << endl;
}
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fastio			ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int             long long
#define double 			long double
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define gcd(x,y)		__gcd(x,y)
#define MOD             (int)(1e9 + 7)
#define INF             (int)9e18
#define ps(x,y)         fixed<<setprecision(y)<<x
int fastpow				(int a, int b, int m = MOD) { int res = 1; a %= m;
						while (b > 0) { if (b & 1) res = (res * a) % m; a = (a * a) % m; b >>= 1; } return res;}
#define inv(a) 			fastpow(a, MOD - 2)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree            <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

 
int32_t main()
{
    fastio;
    int a,b;
    cin>>a>>b;
    int sum1=0,sum2=0;
    while(a)
    {
    	sum1+=a%10;
    	a=a/10;
    }
    while(b)
    {
    	sum2+=b%10;
    	b=b/10;
    }
    if(sum2>sum1)
    	cout<<sum2<<"\n";
   	else
   		cout<<sum1<<"\n";
    return 0;
}