A contractor needs to buy nails to build a house. The nails come in small boxes and large boxes. Each small box has 50 nails and each large box has 350 nails. The contractor bought a total of 13 boxes that have 3350 nails altogether. Determine the number of small boxes purchased and the number of large boxes purchased.