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