#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, v = 1;
  cin >> a >> b;
  for (long long i = a + 1; i <= b && i <= a + 11; ++i) {
    v = (v * i) % 10;
  }
  cout << v;
}
