def compute_Last_Digit(A, B):
    # We need the last digit of B! / A!
    # B! / A! = (A+1) * (A+2) * ... * B
    # If there are 5 or more terms, the product contains both 2 and 5, so last digit is 0
    if B - A >= 10:
        return 0
    
    result = 1
    for i in range(A + 1, B + 1):
        result *= i
    
    return result % 10