#include <bits/stdc++.h>
using namespace std;
long long fact(long long x) {
  long long temp = 1, res = 1;
  while (temp <= x) {
    res = res * temp;
    temp++;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long a, b;
  cin >> a;
  cin >> b;
  if (a == 0) {
    if (b <= 4) {
      long long x = fact(b);
      cout << x % 10;
    } else {
      cout << 0;
    }
    return 0;
  } else if (a == b) {
    cout << 1;
    return 0;
  }
  a++;
  long long x, res = 1, c = 0;
  while (a <= b) {
    x = a % 10;
    res = res * x;
    a++;
    c++;
    if (x == 0) {
      break;
    }
    if (c == 10) {
      break;
    }
  }
  cout << res % 10;
  return 0;
}
