replace mean with solve