#include <bits/stdc++.h>
using namespace std;
bool comp(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.first - a.second > b.first - b.second) return true;
  return false;
}
void solve() {
  long long a, b;
  cin >> a >> b;
  if (a == b) {
    cout << 1 << endl;
    return;
  }
  if (b - a >= 10) {
    cout << 0 << endl;
  } else {
    int ans = 1;
    int x = (int)(b % 10), y = (int)(a % 10);
    if (x < y + 1)
      cout << 0 << endl;
    else {
      for (int i = y + 1; i <= x; i++) ans = (ans * i) % 10;
      cout << ans << endl;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
