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