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