Two cable ferries start moving towards each other from shores A and B. When the pass each other for the first time the distance to shore B is 100 meters. Once they reach their destinations and start traveling back at the same time. When they meet for the second time, the distance to shore A is 50 meters. What is the distance between the shores Aand B?