Mark had cookies and Reggie had scones. Both gave half of what they had to each other. Mark sold 13 cookies and Reggie sold 29 scones. In the end, the ratios of cookies to scones for Mark and Reggie were 1 : 7 and 1 : 5 respectively. How many cookies did Mark have at first?