#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, t, tt, i;
  long long t1, t2, t3, t4;
  while (~scanf("%lld %lld", &a, &b)) {
    t = b - a;
    t1 = a % 10;
    t2 = b % 10;
    t3 = (a / 10) % 10;
    t4 = (b / 10) % 10;
    if (t >= 10 || (t4 != t3)) {
      printf("0\n");
    } else {
      if (t1 <= 2 && t2 >= 5)
        printf("0\n");
      else {
        tt = 1;
        for (i = t1 + 1; i <= t2; i++) {
          tt *= i;
        }
        printf("%lld\n", tt % 10);
      }
    }
  }
  return 0;
}
