#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  cin >> a >> b;
  if (a == 0 && b != 0) {
    a = 1;
  }
  long long p = 1;
  if (b == a)
    p = 1;
  else {
    for (long long i = a + 1; i <= b; i++) {
      p *= (i % 10);
      p %= 10;
      if (p == 0) break;
    }
  }
  cout << p % 10 << endl;
  return 0;
}
