#include <bits/stdc++.h>
using namespace std;
long long a, b, ok1 = 1, ok = 0, s = 1, i;
int main() {
  cin >> a >> b;
  a++;
  for (i = a; i <= b; i++) {
    s = (s * i) % 10;
    if (i % 10 == 0) {
      cout << "0";
      ok1 = 0;
      break;
    }
    if (i % 2 == 0) {
      ok = 1;
    }
    if (i % 5 == 0 && ok == 1) {
      cout << "0";
      ok1 = 0;
      break;
    }
  }
  if (ok1 == 1) cout << s;
  return 0;
}
