#include <bits/stdc++.h>
using namespace std;
map<int, int> ma;
int n;
const int maxn = 2222;
long long a, b;
int main() {
  cin >> a >> b;
  if (b - a >= 10) {
    cout << "0" << endl;
    return 0;
  } else {
    long long ans = 1;
    for (long long i = a + 1; i <= b; i++) {
      long long x = i % 10;
      ans *= x;
    }
    ans %= 10;
    cout << ans << endl;
  }
  return 0;
}
