#include <bits/stdc++.h>
using namespace std;
template <class X, class Y>
void amin(X& x, const Y& y) {
  if (x > y) {
    x = y;
  }
}
template <class X, class Y>
void amax(X& x, const Y& y) {
  if (x < y) {
    x = y;
  }
}
const int INF = 0x3f3f3f3f;
const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
void process() {
  long long a, b;
  cin >> a >> b;
  if (b - a >= 10)
    cout << 0;
  else {
    long long res = 1;
    for (long long i = a + 1; i <= b; i++) {
      res = (res * (i % 10)) % 10;
    }
    cout << res;
  }
}
void init() {}
int main() {
  ios_base::sync_with_stdio(false);
  init();
  process();
}
