#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
typedef pair<ll,ll> P;
#define mod 1000000007

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    int a,b;
    cin >> a >> b;
    int aa=0,bb=0;
    while(a){
        aa+=a%10;
        a/=10;
    }
    while(b){
        bb+=b%10;
        b/=10;
    }
    if(aa<bb) aa=bb;
    
    cout << aa << endl;
    

    return 0;
}










#include <iostream>
#include <vector>

int main() {
    int N, M;
    std::cin >> N >> M;
    std::vector<std::pair<int, int>> conditions(M);
    for (auto& [A, B] : conditions) {
        std::cin >> A >> B;
        A--;
        B--;
    }
    int K;
    std::cin >> K;
    std::vector<std::pair<int, int>> choices(K);
    for (auto& [C, D] : choices) {
        std::cin >> C >> D;
        C--;
        D--;
    }

    int ans = 0;
    for (int i = 0; i < 1 << K; i++) {
        std::vector<bool> dishes(N);
        for (int j = 0; j < K; j++) {
            const auto& [C, D] = choices[j];
            if (i & (1 << j)) {
                dishes[C] = 1;
            }
            else {
                dishes[D] = 1;
            }
        }
        int cnt = 0;
        for (auto& [A, B] : conditions) 
            if (dishes[A] && dishes[B]) cnt++;

        if (ans < cnt) ans = cnt;
    }
    std::cout << ans << std::endl;
}