We had to do weighted averages in evolution and I'm confused. Please help!

We were given allele frequencies which we had to determine heterozygosity from with the equation 2p(1-p); p being allele freq. We had to do this for three different regions. The first region to get the average allele freq. we just did a regular average, but for the two following regions we did weighted averages.

For the first region the ave. allele freq. was 0.515 and heterzygosity 0.499
For the second region the sum of all the heterozygosity numbers is 0.51, and that is the sum of 20 allele freqs. The ave. allele freq. given was 0.0138, but I don't know how to get this. The third region has a heterozygosity sum of 1.05 for 4 allele freqs. The ave. allele freq. given is 0.1888, once again don't know how to get this. Finally, the ave allele freq. for all regions is 0.1374, how to get this?

Please help!

He also put this on the board, but I don't know how to use it, as I plugged in and didn't get the same numbers.

[avg(2)+avg(3)+avg(4)]total population