The formula
Multiply each grade by its coefficient. Add the results. Divide by the sum of the coefficients. That is all there is to it.
A complete example
A 15/20 with a coefficient of 2 and a 10/20 with a coefficient of 1 give (30 + 10) divided by 3, which is 13.33 / 20. The 15 counts twice as much as the 10, because its coefficient is twice as large.
If all coefficients are equal
Put 1 everywhere. The weighted average then becomes the simple average: add the grades and divide by their number.
Common mistakes
Forgetting to divide by the sum of the coefficients, not by the number of subjects. And mixing grades that are not on the same scale: here, all grades are out of 20.