#include <bits/stdc++.h>
using namespace std;
int debug = 1;
const int mod = 1e9 + 7;
unsigned long long int fact(unsigned long long int b,
                            unsigned long long int a) {
  unsigned long long int ans = 1;
  for (unsigned long long int i = b; i > a; i--) {
    ans = (ans * i) % 10;
  }
  return ans % 10;
}
void solve() {
  unsigned long long int a, b;
  cin >> a >> b;
  if (a == 0 and b == 0) {
    cout << "1" << endl;
    return;
  }
  if (b == 1) {
    cout << "1" << endl;
    return;
  }
  if (a == 0) {
    if (b > 5) {
      cout << "0" << endl;
      return;
    } else {
      cout << fact(b, a) << endl;
      return;
    }
  }
  if (b - a > 5) {
    cout << "0" << endl;
    return;
  } else {
    cout << fact(b, a) << endl;
    return;
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  while (t--) solve();
}
