Arnez bought five shirts from a store and had $10 left. If he had only bought three shirts, he would have had $24 left. If each shirt costs the same, determine x, the cost of each shirt.