CPC is calculated by taking the total cost of all campaigns divided by the sum of all clicks.

sum(cost) / sum(clicks) x 100