Two ships, A and B, set off from ports A and B at the same time and travel towards each other. When ship A is 700 kilometers away from port A, it encounters ship B. After the encounter, the two ships continue to move forward and return immediately after arriving at the starting point of the other party. When ship A is 400 kilometers away from port B, it encounters ship B for the second time. How many kilometers is the distance between ports A and B?
甲、乙两艘轮船分别从A、B两港同时出发相向而行，当甲船距离A港700千米时，与乙船相遇，相遇后两船继续前进，到达对方出发点后立即返回，当甲船距离B港400千米时，与乙船第二次相遇，A、B两港相距多少千米？
<gadget id="calculator">700 * 3</gadget>
<output>2_100</output>

<gadget id="calculator">2_100 - 400</gadget>
<output>1_700</output>

<result>1_700</result>