How long did Avicenna teach philosophy?