#include <bits/stdc++.h>
using namespace std;
void factorial(unsigned long long int n, unsigned long long int m) {
  unsigned long long int mod = 1;
  for (unsigned long long int a = n + 1; a <= m; a++) {
    mod = ((a % 10) * (mod % 10)) % 10;
    if (mod == 0) {
      cout << 0 << endl;
      return;
    }
  }
  cout << mod << endl;
}
int main() {
  unsigned long long int n, m;
  cin >> n >> m;
  factorial(n, m);
  return 0;
}
