#include <bits/stdc++.h>
using namespace std;
#define fori(i , a ,b) for (int  q = i ; q < a; q +=b )
#define vi vector<int>
typedef long long ll;
const int maxc = 1e9;
void solve() {
    //ifstream fin("breedflip.in");
    //ofstream fout("breedflip.out");
    int a=0, b=0;
    cin >> a >> b;
    int aa =0, bb=0;
    while (a>=10) {aa+=a%10;a/=10;}
    while (b>=10) {bb+=b%10;b/=10;}
    cout << max(aa+a,bb+b) << "\n";
}
int main() {
   ios_base::sync_with_stdio(false); 
    cin.tie(NULL);   
 
    solve();
  
  
  

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

using namespace std;

inline int S(string n) {
  return (n[0] - '0') + (n[1] - '0') + (n[2] - '0');
}

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

  cout << max(S(A), S(B)) << '\n';

  return 0;
}
