#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
ll pw(ll a, ll b, ll mod) {
    if (b == 0) return 1 % mod;
    if (b & 1) {
        return (a * pw(a, b - 1, mod)) % mod;
    }
    ll res = pw(a, b / 2, mod);
    return (res * res) % mod;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    ll n;
    ll m;
    cin >> n >> m;
    ll p = m * m;
    cout << (pw(10 % p, n, p) / m) % m;
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
    char s,t;
    cin>>s>>t;

    if(s=='Y')
    {
        char p=(t-'a'+'A');
        cout<<p;
    }
    else
    {
        cout<<t;
    }
}