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