There are 13 teams participating in the basketball game. The game is divided into two groups. The first group has 7 teams and the second group has 6 teams. Then the top two teams in each group will be divided into two groups for knockout, and the final two teams will decide the champion and runner-up. How many games are needed in total?
有13个队参加篮球赛，比赛分为两个组，第一组7个队，第二组6个队，各组先进行单循环赛(即每队都要与其他各队比赛一场)，然后由各组的前两名共4队分成两组进行淘汰赛，最后两队决出冠亚军．问共需比赛多少场？
<gadget id="calculator">7 * 6</gadget>
<output>42</output>

<gadget id="calculator">2 * 1</gadget>
<output>2</output>

<gadget id="calculator">42 / 2</gadget>
<output>21</output>

<gadget id="calculator">6 * 5</gadget>
<output>30</output>

<gadget id="calculator">30 / 2</gadget>
<output>15</output>

<gadget id="calculator">21 + 15 + 3</gadget>
<output>39</output>

<result>39</result>