#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main() {
    string a,b;
    cin>>a>>b;

    int sa=0,sb=0;
    rep(i,a.size()) sa+=a[i]-'0';
    rep(i,b.size()) sb+=b[i]-'0';

    cout<<max(sa,sb)<<endl;
}
#include <bits/stdc++.h>
using namespace std;

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