#include<iostream>
#include<cctype>
using namespace std;
int main(void){
	char a,b;
	cin>>a>>b;
	cout<<(char)(a=='Y'?toupper(b):b)<<endl;
	return 0;
}
/** I can do this all day **/

#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;

typedef long long                   ll;
typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define SZ(x)			    		(int)x.size()
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);

const int N = 1e6 + 10;
const ll mod = 1e9 + 7;
const ll mod2 = 998244353;
const ll inf = 8e18;
const int LOG = 22;

ll pw(ll a , ll b, ll M)  { return (!b ? 1 : (b & 1 ? (a * pw(a * a % M, b / 2, M)) % M : pw(a * a % M, b / 2, M))); }

int main()
{
	int x, y;
	cin >> x >> y;
	if(x == y)
	{
		cout << x << endl;
	
	}
	else
	{
		if(x != 0 && y != 0) cout << 0 << endl;
		else if(x != 1 && y != 1) cout << 1 << endl;
		else cout << 2 << endl;
	}
    return 0;
}

/** test corner cases(n = 1?) watch for overflow or minus indices **/

