#include <bits/stdc++.h>
using namespace std;
long long a, b;
int main() {
  ios_base::sync_with_stdio();
  cin >> a >> b;
  long long hieu = b - a;
  if (hieu >= 5) {
    cout << 0;
    return 0;
  }
  long long res = 1;
  for (long i = 1; i <= hieu; ++i) {
    res = res * (a % 10 + i);
  }
  cout << res % 10;
  return 0;
}
