#include <bits/stdc++.h>
int main() {
  long long a, b;
  while (scanf("%lld%lld", &a, &b) != EOF) {
    int cnt = 0;
    if (a == b) {
      printf("1\n");
      continue;
    }
    long long ans = 1;
    for (long long i = a + 1; i <= b; i++) {
      cnt++;
      if (cnt == 10) {
        printf("0\n");
        break;
      }
      ans = (ans * i) % 10;
      if (i == b) {
        printf("%lld\n", ans);
      }
    }
  }
}
