#include <bits/stdc++.h>
using namespace std;
void vecin(vector<int> &v, int n = -1, int start = 0) {
  if (n < 0) n = v.size();
  for (int i = 0; i < n; i++) cin >> v[i + start];
}
void vecdisp(const vector<int> &v, char sepr = ' ') {
  for (int i = 0; i < v.size(); i++) cout << v[i] << sepr;
  cout << endl;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  unsigned long long int a, b, ans = 1;
  cin >> a >> b;
  if (a / 10ULL == b / 10ULL) {
    for (int i = (a % 10ULL + 1); i <= b % 10ULL; i++) {
      ans *= i;
      ans %= 10;
    }
  } else
    ans = 0;
  cout << ans;
  return 0;
}
