Two cars, A and B, start from places A and B at the same time, and drive back and forth between the two places. The two vehicles met head-on for the first time at a distance of 40 kilometers from A, and for the second time at a distance of 10 kilometers from A. Find the distance between A and B.
A、B两辆汽车分别从甲、乙两地同时出发，并在两地间不断往返行驶．两车在距离甲地40公里处第一次迎面相遇，在距离甲地10公里处第二次迎面相遇．求甲、乙两地之问的距离．
<gadget id="calculator">3 * 40</gadget>
<output>120</output>

<gadget id="calculator">120 - 10</gadget>
<output>110</output>

<result>110</result>