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