#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b) { return a > b; }
int main() {
  long long n, m, i, j, k, t, a, b;
  cin >> a >> b;
  m = b - a;
  if (m == 0) {
    cout << 1 << endl;
  } else {
    if (m > 4) {
      cout << 0 << endl;
    } else {
      n = 1;
      for (i = a + 1; i <= b; i++) {
        n = (n % 10 * i % 10) % 10;
      }
      cout << n << endl;
    }
  }
  return 0;
}
