Xiao Ming, Xiao Qiang and Xiao Gang go to the financial office to pay at the same time. Xiao Ming needs 7 minutes, Xiao Qiang needs 5 minutes, and Xiao Gang needs 4 minutes. How to arrange their payment sequence to minimize the total time spent by these three people on payment and waiting? How many minutes?
小明、小强和小刚三人同时去财务室交费，小明需要7分钟，小强需要5分钟，小刚需要4分钟．怎样安排他们的交费顺序才能使这三个人交费和等候所用的总时间最短？需要几分钟？
<gadget id="calculator">4 + 4 + 4 + 5 + 5 + 7</gadget>
<output>29</output>

<result>29</result>