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