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