A factory produces widgets. For the first 2 hours of a shift, the factory produced an average of 30 widgets per hour. For the next 3 hours, the factory produced an average of 50 widgets per hour. What was the average number of widgets produced per hour over the entire 5-hour period?