#include <bits/stdc++.h>

using namespace std;

int main() {

  /*very unique*/

  int A,B;

  cin>>A>>B;

  cout<<max(A/100+(A%100)/10+A%10,B/100+(B%100)/10+B%10)<<endl;

  

  

}
#include <bits/stdc++.h>
using namespace std;

int a, b;
//string s;
//vector<int> a;
//vector<int> b;

int main(){
    cin >> a >> b;
    if(a == b) cout << a << endl;
    else if((a == 0 && b == 1) || (a == 1 && b == 0)) cout << 2 << endl;
    else if((a == 1 && b == 2) || (a == 2 && b == 1)) cout << 0 << endl;
    else if((a == 2 && b == 0) || (a == 0 && b == 2)) cout << 1 << endl;
    return 0;
}