#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
bool compare(T x, U y) {
  return (abs(x - y) <= 1e-9);
}
const int MOD = 1e9 + 7;
void solve() {
  long long a, b;
  cin >> a >> b;
  if (b == a) {
    cout << 1;
    return;
  }
  if ((b - a) >= 10)
    cout << 0;
  else {
    long long c = a + 1;
    long long prod = 1;
    while (c <= b) {
      prod = (prod * c) % 10;
      c++;
    }
    cout << prod;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
}
