A school principal ordered 1,000 pencils .He gave equal number to each of 7 teachers until he had given out as many as possible . How many pencils were left?