#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
const int INF = 1e9;
const ll LINF = 1e18;
int hexDigitToVal(char hex_digit) {
if ('0' <= hex_digit && hex_digit <= '9') return (hex_digit - '0');
hex_digit = toupper(hex_digit);
return 10 + (hex_digit - 'A');
}
char valToHexDigit(int val) {
if (val <= 9) return '0' + val;
return 'A' + (val - 10);
}
struct BigInt {
static const int BASE = 16;
vector<int> a;
BigInt() {}
BigInt(ll x) {
for (; x > 0; x /= BASE) {
a.push_back(x % BASE);
}
}
BigInt(const string &s) {
for (int i = 0; i < s.size(); i++){
a.push_back(hexDigitToVal(s[i]));
}
reverse(a.begin(), a.end());
trim();
}
void trim() {
while (!a.empty() && a.back() == 0) {
a.pop_back();
}
}
bool isZero() {
return (a.empty());
}
BigInt operator+=(const BigInt &other) {
int n = a.size(), m = other.a.size();
int carry = 0;
for (int i = 0; i < max(n, m) || carry; i++) {
if (i == a.size()) {
a.push_back(0);
}
a[i] += (i < m ? other.a[i] : 0) + carry;
carry = (a[i] >= BASE);
if (carry) a[i] -= BASE;
}
return *this;
}
BigInt operator-=(const BigInt &other) {
int m = other.a.size();
int carry = 0;
for (int i = 0; i < m || carry; i++) {
a[i] -= (i < m ? other.a[i] : 0) + carry;
carry = (a[i] < 0);
if (carry) a[i] += BASE;
}
trim();
return *this;
}
BigInt operator+(const BigInt &other) const {
return BigInt(*this) += other;
}
BigInt operator-(const BigInt &other) const {
return BigInt(*this) -= other;
}
int operator%(int b) const {
int n = a.size();
int carry = 0;
for (int i = n - 1; i >= 0; i--) {
ll cur = a[i] + 1ll * carry * BASE;
carry = cur % b;
}
return carry;
}
bool operator<(const BigInt &other) const {
int n = a.size(), m = other.a.size();
if (n != m) {
return (n < m);
}
for (int i = n - 1; i >= 0; i--) {
if (a[i] != other.a[i]) {
return (a[i] < other.a[i]);
}
}
return false;
}
bool operator>(const BigInt &other) const {
return (other < *this);
}
bool operator<=(const BigInt &other) const {
return !(other < *this);
}
bool operator>=(const BigInt &other) const {
return !(*this < other);
}
friend istream& operator>>(istream &in, BigInt &num) {
string s;
in >> s;
num = BigInt(s);
return in;
}
friend ostream& operator<<(ostream &out, const BigInt &num) {
out << (num.a.empty() ? 0 : valToHexDigit(num.a.back()));
for (int i = (int)num.a.size() - 2; i >= 0; i--) {
out << valToHexDigit(num.a[i]);
}
return out;
}
};
// Tính chất cơ bản của đồng dư cần biết trong bài này:
// (a + b) % c = (a % c + b % c) % c
// (a * b) % c = ((a % c) * (b % c)) % c
// Bài toán digital root:
// Xét BASE bất kì và một số nguyên dương n được biểu diễn ở hệ cơ số BASE
// thực hiện gán n = s(n) cho đến khi n < BASE
// Ta chứng minh được n = s(n) (mod (BASE - 1))
// Và từ đây ta suy ra được n = s(n) = s(s(n)) = ... = s(s(s(...))) (mod (BASE - 1))
// Nên đáp án của bài toán chính là r = n % (BASE - 1), trường hợp r = 0 thì kết quả là BASE
// Áp dụng vào bài này (với BASE = 16) thì ta cần đi tính r = n % 15 = [x * (x + 1) * ... * (y - 1) * y] % 15
// = [x % 15 * (x + 1) % 15 * ... * (y - 1) % 15 * y % 15] % 15
// Nhận xét:
// - Nếu y - x + 1 >= 15 thì chắc chắn tồn tại một số chia hết cho 15, do đó r = 0
// Như vậy chỉ còn trường hợp y - x + 1 < 15:
// - Đến đây có thể code thêm operator% một số BigInt với một số nhỏ.
// - Hoặc dùng tính chất x = s(x) (mod 15), tức tính tổng các chữ số của x trước (để lưu được trong biến int), rồi mới % 15.
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
BigInt x, y;
cin >> x;
cin >> y;
if (y - x >= 14) {
cout << 'F' << '\n';
return 0;
}
int r = 1;
for (BigInt i = x; i <= y; i = i + 1) {
r = r * (i % 15) % 15;
}
cout << (r == 0 ? 'F' : valToHexDigit(r)) << '\n';
}