#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, sum = 1;
  cin >> a >> b;
  if (a == b)
    cout << "1";
  else if (b - a >= 10 || (b - a) % 10 == 0)
    cout << "0";
  else {
    int j = b - a;
    for (int i = 0; i < j; i++) {
      sum *= b % 10;
      b--;
    }
    cout << sum % 10;
  }
  return 0;
}
