Weighted counting of integer points in a subspace