CMIMC 2016 Finals Problem C.3

Let S be the set containing all positive integers whose decimal representations contain only 3 \mathrm{s} and 7 \mathrm{s}, have at most 1998 digits, and have at least one digit appear exactly 999 times. If N denotes the number of elements in S, find the remainder when N is divided by 1000.