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