if d = 0 , then you need to add nothing to vector A
if ( d == 0 ) : NEW_LINE INDENT return a == 0 and b == 0 ; NEW_LINE DEDENT else : NEW_LINE INDENT return ( ( a * p + b * q ) % d == 0 and ( b * p - a * q ) % d == 0 ) ; NEW_LINE DEDENT def checks ( a , b , x , y , p , q ) : NEW_LINE