//#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }

template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << "[" << H << "]";
    debug_out(T...);
}

#ifdef dddxxz
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SZ(s) ((int)s.size())

clock_t startTime;

double getCurrentTime() {
    return (double) (clock() - startTime) / CLOCKS_PER_SEC;
}

typedef long long ll;
//mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
const double eps = 0.00001;
const int MOD = 1e9 + 7;
const int INF = 1000000101;
const long long LLINF = 1223372000000000555;
const int N = 1e6 + 4e4;
const int M = 1234;
const int LOG = 18;

int sum(int x){
    return x / 100 + x / 10 % 10 + x % 10;
}

void solve(int TC) {
    int a, b;
    cin >> a >> b;

    cout << max(sum(a), sum(b));


}

int main() {
    startTime = clock();
    ios_base::sync_with_stdio(false);

    bool llololcal = false;
#ifdef dddxxz
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    llololcal = true;
#endif

    int TC = 1;
    //cin >> TC;

    for (int test = 1; test <= TC; test++) {
        debug(test);
        solve(test);
    }

    if (llololcal) cerr << endl << "Time: " << getCurrentTime() * 1000 << " ms" << endl;

    return 0;
}

//#include <atcoder/all>
//using namespace atcoder;


#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
#include <limits>
#include <iomanip>
#include <cmath>


using namespace std;


using ll = long long;
using ull = unsigned long long;
template <typename T = ll>
using Coord = pair<T, T>;
template <typename T = ll>
using Mat = vector<vector<T>>;


template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p)
{
	os << '(' << p.first << ", " << p.second << ')';
	return os;
}
template <class T>
Mat<T> MakeMat(size_t w, size_t h)
{
	return Mat<T>(h, vector<T>(w));
}
template <class ...Args>
void Input(Args &...args)
{
	(cin >> ... >> args);
}
template <class T>
void InputArray(size_t size, T& t)
{
	t.resize(size);
	for (auto& e : t) {
		cin >> e;
	}
}
template <class ...Args>
void InputArray(size_t size, Args &...args)
{
	(InputArray(size, args), ...);
}
template <class ...Args>
void InputVerticalArray(size_t size, Args &...args)
{
	(args.resize(size), ...);
	for (int i = 0; i < size; i++) {
		((cin >> args[i]), ...);
	}
}
template <class T>
void InputMatrix(size_t width, size_t height, T& t)
{
	t.assign(height, typename T::value_type(width));
	for (auto& a : t) {
		for (auto& e : a) {
			cin >> e;
		}
	}
}
template <class ...Args>
void InputMatrix(size_t width, size_t height, Args &...args)
{
	(InputMatrix(width, height, args), ...);
}
template <class ...Args>
void Output(const Args &...args)
{
	((cout << args << ' '), ...) << endl;
}
template <class ...Args>
void OutputVertical(const Args &...args)
{
	((cout << args << endl), ...);
}
template <class T>
void OutputArray(const T& t)
{
	for (const auto& e : t) {
		cout << e << ' ';
	}
	cout << endl;
}
template <class ...Args>
void OutputArray(const Args &...args)
{
	(OutputArray(args), ...);
}
template <class ...Args>
void OutputVerticalArray(const Args &...args)
{
	for (int i = 0; i < min({ args.size()... }); i++) {
		((cout << args[i] << ' '), ...) << endl;
	}
}
template <class T>
void OutputMatrix(const T& t)
{
	for (const auto& a : t) {
		for (const auto& e : a) {
			cout << e << ' ';
		}
		cout << '\n';
	}
	cout << flush;
}
template <class ...Args>
void OutputMatrix(const Args &...args)
{
	(OutputMatrix(args), ...);
}


#define X first
#define Y second

#define inp(type, ...) type __VA_ARGS__; Input(__VA_ARGS__)
#define inpa(type, size, ...) type __VA_ARGS__; InputArray((size), __VA_ARGS__)
#define inpva(type, size, ...) type __VA_ARGS__; InputVerticalArray((size), __VA_ARGS__)
#define inpm(type, width, height, ...) type __VA_ARGS__; InputMatrix((width), (height), __VA_ARGS__)
#define otp(...) Output(__VA_ARGS__)
#define otpv(...) OutputVertical(__VA_ARGS__)
#define otpa(...) OutputArray(__VA_ARGS__)
#define otpva(...) OutputVerticalArray(__VA_ARGS__)
#define otpm(...) OutputMatrix(__VA_ARGS__)
#define rep(counter, range) for (ll (counter) = 0; (counter) < (range); (counter)++)
#define rep2(counter, start, end) for (ll (counter) = (start); (counter) < (end); (counter)++)
#define rep3(counter, start, end, step) for (ll (counter) = (start); (counter) < (end); (counter) += (step))
#define repi(range) rep(i, range)
#define repi2(start, end) rep2(i, start, end)
#define repi3(start, end, step) rep3(i, start, end, step)
#define rrep(counter, range) for (ll (counter) = (range) - 1; (counter) >= 0; (counter)--)
#define rrepi(range) rrep(i, range)
#define repc(element, container) for (auto &(element) : (container))
#define repe(container) repc(e, container)
#define all(container) (begin(container)), (end(container))

#ifdef DBG
#	define dbg(x) x
#else
#	define dbg(x)
#endif


int main()
{
	inp(string, a, b);

	int sa = a[0] + a[1] + a[2] - '0' * 3;
	int sb = b[0] + b[1] + b[2] - '0' * 3;

	otp(sa >= sb ? sa : sb);

	return 0;
}
