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