#include <bits/stdc++.h>
using namespace std;
void sol();
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  bool isT = 0;
  if (isT) {
    long long t;
    cin >> t;
    while (t--) sol();
  } else
    sol();
  return 0;
}
void sol() {
  long long a, b;
  cin >> a >> b;
  if (b - a >= 10)
    cout << 0;
  else {
    long long fact = 1;
    for (long long i = a + 1; i <= b; i++) {
      fact *= i;
      fact %= 10;
    }
    cout << fact;
  }
}
