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