In a row of 2009 weights, the weight of each weight is an integer number of grams and does not exceed 1 kg. The weights of each pair of neighboring weights differ by exactly 1 gram, and the total weight of all the weights in grams is an even number. Prove that the weights can be divided into two piles such that the sums of the weights in both piles are equal.