Joe and Sam each invested $20,000 in the stock market. Joe's investment increased in value by 5% per year for 10 years. Sam's investment decreased in value by 5% for 5 years and then increased by 12.5% for the next 5 years. AT the end of 10 years, what was the value of each person's investment?