#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void chmin(T &x, const T &y) {
  if (x > y) x = y;
}
template <typename T>
inline void chmax(T &x, const T &y) {
  if (x < y) x = y;
}
int read() {
  char c;
  while ((c = getchar()) < '-')
    ;
  int x = c - '0';
  while ((c = getchar()) >= '0') x = x * 10 + c - '0';
  return x;
}
template <typename T>
struct vec {
  T *a;
  int n;
  void push_back(const T &x) {
    if ((n & -n) == n) {
      T *_a = new T[n * 2 + 1];
      memcpy(_a, a, n * sizeof(T));
      a = _a;
    }
    a[n++] = x;
  }
};
int main() {
  long long a, b;
  cin >> a >> b;
  if (b - a <= 5) {
    int ans = 1;
    while (++a <= b) ans *= a % 10;
    cout << ans % 10;
  } else
    puts("0");
}
