#include <bits/stdc++.h>
using namespace std;
long long p, q, s;
int main() {
  scanf("%I64d%I64d", &p, &q);
  if (q - p > 10)
    printf("0\n");
  else {
    s = 1;
    while (q != p) {
      s = s * (q % 10) % 10;
      q--;
    }
    printf("%I64d\n", s);
  }
  return 0;
}
