Calculate Average Cost