public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		StringBuilder out = new StringBuilder();
		while ((line = in.readLine()) != null && line.length() != 0) {
			int[] ab = readInts(line);
			long n = 1;
			ab[1] = ab[0] - ab[1] + 1;
			for (int i = ab[0]; i >= ab[1]; i--) {
				n = productLastNonDigitZero(n, i) % 1000000000;
			}
			n = productLastNonDigitZero(n, 1) % 10;
			out.append(n + "\n");
		}
		System.out.print(out);
	}