#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
  LL a, b;
  cin >> a >> b;
  LL ans = 1;
  for (LL i = a + 1; i <= min(a + 20, b); i++) ans = ans * (i % 10) % 10;
  printf("%lld\n", ans);
  return 0;
}
