#include <bits/stdc++.h>
using namespace std;
char a[30], b[30];
int main() {
  scanf("%s%s", a, b);
  int len = strlen(a);
  if (len != strlen(b)) {
    printf("0");
    return 0;
  }
  for (int i = 0; i < len - 1; i++)
    if (a[i] != b[i]) {
      printf("0");
      return 0;
    }
  int p = a[len - 1] - '0' + 1;
  int q = b[len - 1] - '0';
  int ans = 1;
  for (int i = p; i <= q; i++) ans *= i;
  printf("%d", ans % 10);
  return 0;
}
