#include <bits/stdc++.h>
using namespace std;
void swap(long long int arr[], long long int x, long long int y) {
  long long int temp = arr[x];
  arr[x] = arr[y];
  arr[y] = temp;
}
void print_arr(long long int arr[], long long int n) {
  cout << '\n';
  for (long long int i = 0; i < n; i++) {
    cout << arr[i] << ' ';
  }
  cout << '\n';
}
void input_arr(long long int arr[], long long int n) {
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
  }
}
bool primes[1000001];
void seive() {
  memset(primes, true, sizeof(primes));
  primes[0] = false;
  primes[1] = false;
  for (long long int i = 2; i * i <= 1000001; i++) {
    if (primes[i]) {
      for (long long int j = 2 * i; j < 1000001; j += i) {
        primes[j] = false;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  t = 1;
  while (t--) {
    long long int n, m;
    cin >> n >> m;
    if (n > m) {
      cout << 0;
    } else {
      long long int ans = 1;
      for (long long int i = m; i > max(n, m - 5); i--) {
        ans *= i;
        ans = ans % 10;
      }
      cout << ans % 10;
    }
  }
  return 0;
}
