Sensex opens at 40,204 with a gain of 325 points in the early trade