#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  long long ans = 1;
  for (long long k = a + 1; k <= b && ans; k++) {
    ans = ans * k % 10;
  }
  cout << ans << endl;
}
