Store values according to the mentioned approach
for i in range ( N ) : NEW_LINE INDENT if ( v [ i ] [ 0 ] >= 0 ) : NEW_LINE INDENT pos . append ( [ - v [ i ] [ 1 ] , v [ i ] [ 0 ] ] ) NEW_LINE DEDENT else : NEW_LINE INDENT neg . append ( [ v [ i ] [ 0 ] - v [ i ] [ 1 ] , - v [ i ] [ 0 ] ] ) NEW_LINE DEDENT DEDENT