#include <bits/stdc++.h>
using namespace std;
ofstream outfile;
ifstream infile;
int main() {
  infile.open("input.txt");
  outfile.open("output.txt");
  long long int a, b;
  cin >> a >> b;
  if (a > b) {
    cout << "0\n";
    return 0;
  } else if (b - a <= 20) {
    long long int digit = 1;
    for (long long int i = a + 1; i <= b; ++i) {
      digit = (digit * i) % 10;
    }
    cout << digit << "\n";
    return 0;
  }
  cout << "0\n";
}
