adjust the equation can handle some overflow