import math


def factoradic_to_index(factoradic):
    """ Convert a factoradic to the index."""
    value = 0
    for idx in range(len(factoradic)):
        value += factoradic[idx] * math.factorial(idx)
    return value