#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  scanf("%I64d%I64d", &a, &b);
  if (a == b)
    printf("1\n");
  else if (b - a >= 10)
    printf("0\n");
  else {
    long long c = a % 10, d = b % 10;
    if (d <= c)
      printf("0\n");
    else {
      long long ans = 1;
      for (long long i = c + 1; i <= d; i++) ans = ans * i % 10;
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
