A pencil cost 2/3 as much as an eraser. Tom bought a number of pencils and erasers. The total cost of all the pencils was 4 times as much as the total cost of all the erasers. Tom bought 35 pencils and erasers. How many pencils did Tom buy altogether?