#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int a, b, c = 0, d = 0; 
  cin >> a >> b;
  while(a) {
    c += a % 10;
    a /= 10;
  }
  while(b) {
    d += b % 10;
    b /= 10;
  }
  cout << max(c,d) << endl;
  
  return 0;
}
/*
* Author      : Arman Sykot 
* Date & time : 02.01.2021 18:00:36 +06
*/

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define I_am_the_one_who_KNOCKS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

const double EPS = 1e-9;

int main() {
#ifndef ONLINE_JUDGE
	freopen ("in.txt", "r", stdin);
	freopen ("out.txt", "w", stdout);
#endif
	I_am_the_one_who_KNOCKS;

	int a, b;
	cin >> a >> b;
	
	int suma = 0, sumb = 0;
	while (a) {
		int rem = a % 10;
		a /= 10;
		suma += rem;
	}
	
	while (b) {
		int rem = b % 10;
		b /= 10;
		sumb += rem;
	}
	
	if (suma > sumb)
		cout << suma << "\n";
	else
		cout << sumb << "\n";
	return 0;
}
