#include <bits/stdc++.h>
using namespace std;
long long int fac(long long int a, long long int m) {
  long long int res = 1;
  for (int i = 1; i <= a; i++) {
    res = (1ll * res * (i % m)) % m;
  }
  return res;
}
int main() {
  long long int n, k;
  cin >> n >> k;
  long long int p = (k - n);
  if (p >= 10)
    cout << "0\n";
  else {
    long long int f = 1;
    for (long long int i = n + 1; i <= k; i++) {
      f = (1ll * f * (i % 10)) % 10;
    }
    cout << f << endl;
  }
}
