System operators rely on system flexibility to handle unexpected reliability and resilience events, ranging from excessive resource forecast errors to extreme events like heatwaves, earthquakes, and cyberattacks. This paper provides a production cost modeling (PCM) methodology to quantify contributions to system flexibility and economic benefits by controllable HVdc and multi-terminal HVdc (MTdc) transmission systems. First, the PCM model of a general MTdc grid is developed to be seamlessly added to existing scalable PCM model of an ac power system. Second, a method for modeling extreme operating conditions, including heatwave and wildfire, in PCM is presented. Finally, the planning 2030 Western Electricity Coordinating Council (WECC) system is used as an example to demonstrate the benefits of existing and future dc lines in point-to-point, radial, and meshed configurations. Under extreme system conditions including heatwave and wildfire, it is identified from the PCM simulation results that HVdc and MTdc transmission flexibility can provide substantial economic, reliability, and environmental benefits. These benefits include reductions up to 6.4% total generation cost, 8.6% unserved load, 50.3% renewable curtailment, 75% locational marginal price, and 4.0% CO2 emission amount.