Leonardo spent the last three years of his life at Clos LucÃ , with his faithful friend and apprentice , Count Melzi . The king gave Leonardo a pension of 10,000 scudi . It was here that he spent the last three years of his life , accompanied by his friend and apprentice , Count Francesco Melzi , supported by a pension totalling 10,000 scudi .