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