#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <stdio.h>
#include <unistd.h>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define itrep(itr, base) for (auto itr = base.begin(); itr != base.end(); itr++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl
#define PI 3.14159265359

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  string a, b;
  cin >> a >> b;
  int ans = 0;
  rep (i, a.size()) {
    ans += a[i] - '0';
  }
  int tmp = 0;
  rep (i, b.size()) {
    tmp += b[i] - '0';
  }
  if (ans > tmp) P(ans);
  else P(tmp);
  return 0;
}

#include <iostream>
using namespace std;
int main() {
    int a,b;
    cin>>a>>b;
    int m,sum=0,n,summ=0;
    while(a!=0)
    {
        m=a%10;
        sum=sum+m;
        a=a/10;
    }
     while(b!=0)
    {
        n=b%10;
        summ=summ+n;
        b=b/10;
    }
    if(sum>summ)
    cout<<sum;
    else 
    cout<<summ;
    return 0;
}
