CFA LEVEL 1 study materials

Why do they use end value and amount invested to calculate HPR in this question?