Notice that
2010 ≡ 1 mod 2009
2011 ≡ 2 mod 2009
2012 ≡ 3 mod 2009
...
4017 ≡ 2008 mod 2009
4018 ≡ 0 mod 2009
So really, S is just the sum of the first 2008 positive integers:
where we invoke the formula
and so S ≡ 0 mod 2009.
5.2m questions
6.7m answers