Let $a_1, a_2, \dots, a_{1000}$ be positive integers whose sum is $S$. If $a_n!$ divides $n$ for each $n = 1, 2, \dots, 1000$, compute the maximum possible value of $S$.

Let's think step by step and output the final answer within \boxed{}.
user