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