#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long a, b;
  cin >> a >> b;
  if (b - a >= 5)
    cout << 0;
  else {
    int an = 1;
    while (b > a) {
      an = an * (b % 10);
      b--;
    }
    cout << an % 10;
  }
  return 0;
}
