The total cost of company 16 machines transported to the two places is s = 500x+600 (10-x)+700 (1-x)+1000 (x-5) = 20.
(2) When X=5, transport 5 machines from Beijing to Wuhan, 5 machines from Beijing to Xi 'an, 16 machines from Shanghai to Wuhan, and 0 machines from Shanghai to Xi 'an, making the total freight cost of the company at least 9700 yuan.