//#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;

int main() {
	int ans, x, y;
	cin >> x >> y;
	vector<int> input(3);
	input[x]++;
	input[y]++;

	for (int i = 0; i < 3; i++) {
		if (input[i] == 0)ans = i;
	}

	if (x == y) {
		ans = x;
	}
	
	cout << ans << endl;
	return 0;
}
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define wzh(x) cerr<<#x<<'='<<x<<endl;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string a,b;
  cin>>a>>b;
  int c=0,d=0;
  for(auto k:a){
    c+=k-'0';
  }
  for(auto k:b){
    d+=k-'0';
  }
  cout<<max(c,d);
  return 0;
}