#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    int suma = a/100 + (a%100)/10 + a%10;
    int sumb = b/100 + (b%100)/10 + b%10;

    if(suma > sumb) cout << suma << endl;
    else cout << sumb << endl;

    return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll LINF = 1e18;
const int INF = 1e9;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
template <class T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return 1;
  }
  return 0;
}
// Union-Find
struct UnionFind
{
  vector<int> par, siz;

  UnionFind(int n) : par(n, -1), siz(n, 1) {}

  // �������
  int root(int x)
  {
    if (par[x] == -1)
      return x;
    else
      return par[x] = root(par[x]);
  }

  // x �� y ��Ʊ�����롼�פ�°���뤫�ɤ��� (�������פ��뤫�ɤ���)
  bool issame(int x, int y)
  {
    return root(x) == root(y);
  }

  // x ��ޤ॰�롼�פ� y ��ޤ॰�롼�פȤ�ʻ�礹��
  bool unite(int x, int y)
  {
    x = root(x), y = root(y);
    if (x == y)
      return false;
    if (siz[x] < siz[y])
      swap(x, y);
    par[y] = x;
    siz[x] += siz[y];
    return true;
  }

  // x ��ޤ॰�롼�פΥ�����
  int size(int x)
  {
    return siz[root(x)];
  }
};

int main()
{
  string N1, N2;
  cin >> N1 >> N2;
  int res1 = 0, res2 = 0;
  for (int i = 0; i < (int)N1.size(); i++)
  {
    res1+=N1[i]-'0';
  }
  for (int i = 0; i < (int)N2.size();i++){
    res2 += N2[i]-'0';
  }
  chmax(res1, res2);
  cout << res1 << endl;
}