#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long a, b;
  cin >> a >> b;
  if (b - a > 5) {
    cout << 0 << "\n";
  } else {
    long long val = 1;
    for (long long j = a + 1; j <= b; j++) {
      val *= (j % 10);
      val %= 10;
    }
    cout << val << "\n";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
}
