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