The overall totals outside of the collections will be the easiest. All you need to do is click the Advanced tab for the field and use the SUM function on the target variable.
For example, =SUM(My_Variable)
The totals within the collections require a little bit more because you'll need to use the INDEX function to ensure you are only grabbing the value for the current row.
For example, =INDEX(My_Variable,ROW())
In this example, the INDEX function tells the calculation to target a specific index item, and the ROW() function tells it to use the index of the current row.
If you want to multiply two fields in the collection, it would be something like
=PRODUCT(INDEX(Quantity,ROW()),INDEX(Cost,ROW()))
OR
=MULT(INDEX(Quantity,ROW()),INDEX(Cost,ROW()))
Off the top of my head I can never remember which one works best, but the important thing is that you want all of the fields involved to be numeric (number, currency, etc.).
Just pay close attention to your parentheses because it is very easy to put them in the wrong place or miss a closing one, which will cause it not to work.