two equations if the next height is greater