The question seems to be perfectly on-topic since there is a tag asymptotic_complexity...
According to CLRS, p. 49,
"The number of anonymous functions in an expression is understood to be equal to the number of times the asymptotic notation appears. For example, in the expression
sum(O(i), i=1..n)
there is only a single anonymous function (a function of i). This expression is thus not the same as O(1) + O(2) + ... + O(n), which doesn't really have a clean interpretation"
Actually, in your formula, the constants behind the "O" notation may be all different, and their growth may change the asymptotic behaviour of the whole sum. Don't write this!
To answer your question more completely, in sum(O(i), i=1..n), you can use the fact that (see GKP p. 450 for the following)
O(f(n)g(n)) = f(n) O(g(n))
Thus, O(i) = i O(1), this time with the same O(1) in your formula. Therefore,
sum(O(i), i=1..n) = sum(i, i=1, n) O(1)
=n(n+1)/2 O(1) = O(n^2)
This way you can eliminate your sum without trouble.