#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  unsigned long long a, b, i, ans;
  cin >> a >> b;
  ans = 1;
  for (i = a + 1; i <= b; i++) {
    ans = ans * (i % 10);
    if (ans == 0) break;
  }
  cout << (ans % 10) << "\n";
  return 0;
}
