#include<iostream>
using namespace std;
int main() {
	string s, c;
	cin >> s >> c;
	int a = 0, b = 0;
	for (int i = 0; i < s.length(); i++) {
		a += s[i] - '0';
	}
	for (int i = 0; i < c.length(); i++) {
		b += c[i] - '0';
	}
	if (a > b) {
		cout << a;
	}
	else {
		cout << b;
	}
}
#include <bits/stdc++.h>
using namespace std;

int sum(int n){
  int a = n/100;
  int b = (n-a*100)/10;
  int c = (n-a*100-b*10);
  return a+b+c;
}
int main() {
  int a, b;
  cin >> a >> b;
  int asum = sum(a);
  int bsum = sum(b);
  cout << max(asum, bsum) << endl;
}