#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b;
  cin >> a >> b;
  long long int s = 1;
  if (abs(b - a) >= 10)
    cout << 0 << endl;
  else {
    for (long long int i = b; i > a; i--) {
      s *= (i % 10);
    }
    cout << s % 10 << endl;
  }
  return 0;
}
