So I need to calculate an estimated variance, the info given to me is:

A sample of 140 bags of flour. The masses of x grams of the contents are summarized by $\displaystyle \sum (x - 500) = -266$ and $\displaystyle \sum (x-500)^2=1178$ I need to find the mean and estimated variance. The mean is simple 140(x - 500) = -266; mean = 498.3 But how the heck do I figure out $\displaystyle \sum x^2$

Someone suggested :

$\displaystyle

\sum_{i = 1}^{140}(x_i - 500)^2 = 1178

$

$\displaystyle

\Rightarrow \sum_{i = 1}^{140}x_i^2 -2\sum_{i = 1}^{140} 500*x_i + \sum_{i = 1}^{140}500^2 = 1178

$

But unfortunately I dont even know how to solve the above equations, I did google and read this :

A-level Mathematics/FP1/Summation of Series - Wikibooks, collection of open-content textbooks
But It doesnt apply here since we're dealing with a random variable xi? Right? How do I simplify the second and third summations on the left

I dont need the answer, I just a hint or maybe how to solve summations like this? Could someone point me in the right direction?

(Im studying for my A levels on my own =S)