Work out your average grade with the weight, credits or percentage of each mark.
In a weighted average each mark counts according to its weight: a 9-credit module counts three times as much as a 3-credit one. Multiply each mark by its weight, add everything up and divide by the total weight.
Leave the weights empty and every mark counts the same.
Average = Σ(mark × weight) / Σweight
Add the exam with its weight and try marks until you reach the average you want.