In less than 1000 natural numbers, by 3 integer division, the rest 2, by 7 integer division, the sum of the rest 3 natural numbers? Give me a program

In less than 1000 natural numbers, by 3 integer division, the rest 2, by 7 integer division, the sum of the rest 3 natural numbers? Give me a program

x≡2(mod3) 7x≡14(mod21)
x≡3(mod7) 3x≡9 (mod21) 6x≡18(mod21)
x≡-4≡17(mod21)
1000-17=983 46