Optimal estimate in L^2 extension theorem and applications