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