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