Optimal Szegö-Weinberger type inequalities