add sap algorithm