Let f(p) denote the number of ordered tuples \left(x_{1}, x_{2}, \ldots, x_{p}\right) of nonnegative integers satisfying \sum_{i=1}^{p} x_{i}=2022, where x_{i} \equiv i(\bmod p) for all 1 \leq i \leq p. Find the remainder when \sum_{p \in \mathcal{S}} f(p) is divided by 1000, where \mathcal{S} denotes the set of all primes less than 2022.