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