A school principal ordered 1000 pencils he gave an equal number to each of seven teachers in till he had given out as many as possible how many pencils were left?