#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k, fac = 1;
  cin >> n >> k;
  for (long long int i = n + 1; i <= k; i++) {
    fac = (fac * i) % 10;
    if (fac == 0) break;
  }
  cout << fac;
  return 0;
}
