#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{

    int a, b;
    cin >> a >> b;

    if (a + b >= 15 && b >= 8)
    {
        cout << 1 << endl;
    }
    else if (a + b >= 10 && b >= 3)
    {
        cout << 2 << endl;
    }
    else if (a + b >= 3)
    {
        cout << 3 << endl;
    }
    else
    {
        cout << 4 << endl;
    }

    return 0;
}
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i = 0; i < (n); i++)

int s(int n) {
    int res = 0;
    while(n) {
        res += n%10;
        n /= 10;
    }
    return res;
}

int main() {
    int a, b;
    cin >> a >> b;
    int ans = max(s(a), s(b));
    cout << ans << endl;
    return 0;
}