#include <bits/stdc++.h>
using namespace std;
const long long MOD = 10e9 + 7;
const long double PI = acos((long double)(-1.0));
const long double EPS = 1e-9;
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  long long a, b;
  cin >> a >> b;
  long long mul = 1;
  for (long long i = b; i > a && mul; i--) {
    mul = (mul * (i % 10)) % 10;
  }
  cout << mul;
  cerr << "\nTime elapsed " << 1.0 * clock() / CLOCKS_PER_SEC << " secs";
  return 0;
}
