#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int MAX = 500009;
const long long MOD = 1000000007;
long long pw(long long base, long long expo, long long c) {
  if (expo == 0) return 1;
  long long f = pw(base, expo / 2, c);
  if (expo & 1) return (((f * f) % c) * base) % c;
  return (f * f) % c;
}
long long a, b;
int main() {
  scanf("%lld%lld", &a, &b);
  if (b - a < 5) {
    long long ans = 1LL;
    for (long long i = a + 1; i <= b; i++) {
      long long y = i % 10;
      ans = (ans * y % 10 + 10) % 10;
    }
    printf("%lld\n", ans);
  } else {
    printf("0\n");
  }
  return 0;
}
