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