def gcd(d, v, qs):
    """
    Compute GCD(d,v) and return it along with the list of quotients.
    where d is an arbitrary integer, v is a positive integer and qs is a list.
    """
    if v <= 0:
        raise ValueError("v must be strictly positive")
    q, r = divmod(d, v)
    if r == 0:
        return v, qs
    qs.append(q)
    return gcd(v, r, qs)