Find S Algorithm Using Python For Automation