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