#include <bits/stdc++.h>
using namespace std;
long long power(long long x, unsigned long long y) {
  long long res = 1;
  x = x;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  long long a, b;
  cin >> a >> b;
  if (a == b) {
    cout << 1;
    return 0;
  }
  long long ldig = 1;
  for (long long i = a + 1; i <= b; i++) {
    ldig = (ldig * i) % 10;
    if (ldig == 0) {
      cout << 0;
      return 0;
    }
  }
  cout << ldig;
  return 0;
}
