CHANGED: extended jacobi symbol to accept a negative first argument