Two friends A and B started from X and Y for Y and X respectively. They turned back after reaching their destinations and returned back to their starting points. When they met for the first time they were 15 km away from X and when they met for the second time travelling towards each other they were 10 km away from Y. Calculate the distance between X and Y (in km).