Optimal Gaussian metrology for generic multimode interferometric circuit