#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pi = pair<int, int>;
void setIO(string name = "") {
  freopen((name + ".in").c_str(), "r", stdin);
  freopen((name + ".out").c_str(), "w", stdout);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll a, b;
  cin >> a >> b;
  if (b - 1 == a) {
    cout << b % 10 << "\n";
    return 0;
  }
  ll lastdigit = 1;
  for (ll i{a + 1}; i <= b; i++) {
    if (i % 5 == 0) {
      cout << "0"
           << "\n";
      return 0;
    }
    lastdigit *= (i % 10);
  }
  cout << (lastdigit % 10) << "\n";
}
