Lydia bought a shirt at 20% off its retail price of $40. She paid a 5% tax on the price after the discount. How much did Lydia pay for the shirt?