def n_ary2decimal(array, n):
    """
    Transform n-ary number into decimal number

    Args:
        array ([list]): [n-ary numbers. The element is a digit. The larger digit is smaller index.]
        n ([int]): [description]

    Returns:
        [int]: [decimal]
    """
    value = 0
    for i, i_v in enumerate(array):
        value += i_v * n**i
    return value