def luhn_sum(digits):
    """
    Helper function to compute the sum in the Luhn algorithm
    """

    s = 0
    for idx, digit in enumerate(map(int, digits)):
        mu = 1 if idx % 2 else 2
        n = mu * digit
        s += n - 9 if n > 9 else n

    return s