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