(n, *tuples)
return combine(*pm_tuples)
tuples is a list of tuples (value, count). This method returns all
    permutations of [+-r, +-r, +-s, +-s, 0, ..., 0] of length n, with `count`
    times the number `value`.
tuples is a list of tuples (value, count). This method returns all
    permutations of [+-r, +-r, +-s, +-s, 0, ..., 0] of length n, with `count`
    times the number `value`.
tuples is a list of tuples ( value count ) . This method returns all permutations of [ + - r + - r + - s + - s 0 ... 0 ] of length n with count times the number value .
def fsd(n, *tuples):
    """tuples is a list of tuples (value, count). This method returns all
    permutations of [+-r, +-r, +-s, +-s, 0, ..., 0] of length n, with `count`
    times the number `value`.
    """
    pm_tuples = [((+val, -val), count) for val, count in tuples]
    total_count = sum(item[1] for item in tuples)
    assert total_count <= n
    pm_tuples += [((0,), n - total_count)]
    return combine(*pm_tuples)
def fsd ( n , * tuples ) : pm_tuples = [ ( ( + val , - val ) , count ) for val , count in tuples ] total_count = sum ( item [ 1 ] for item in tuples ) assert total_count <= n pm_tuples += [ ( ( 0 , ) , n - total_count ) ] return combine ( * pm_tuples )