Optimal Green Shift, R&D-Generated Growth, and the Risk of Environmental Disaster