dp formula