#include <bits/stdc++.h>
using namespace std;
int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
const double eps = 1e-6;
const double Pi = acos(-1.0);
const int INF = 0x3f3f3f3f;
int main() {
  long long a, b;
  while (~scanf("%lld%lld", &a, &b)) {
    if (b - a >= 10) {
      puts("0");
    } else {
      int ans = 1;
      for (long long i = a + 1; i <= b; i++) {
        ans = (ans * i % 10) % 10;
      }
      printf("%d\n", ans);
    }
  }
  return 0;
}
