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