A square with side $1$ is intersected by two parallel lines as shown in the figure. Find the sum of the perimeters of the shaded triangles if the distance between the lines is also $1$.
[img]https://cdn.artofproblemsolving.com/attachments/9/e/4e70610b80871325a72e923a0909eff06aebfa.png[/img]
1. **Define the Geometry and Coordinates:**
   Given a square \(ABCD\) with vertices \(A(0,0)\), \(B(1,0)\), \(C(1,1)\), and \(D(0,1)\). Two parallel lines intersect the square, and the distance between these lines is \(1\).

2. **Identify the Points of Intersection:**
   Let's denote the points of intersection of the lines with the square as follows:
   - \(E(\lambda, 0)\) on \(AB\)
   - \(F(0, -m\lambda)\) on \(AD\)
   - \(G(\mu, 1)\) on \(CD\)
   - \(H(1, m + \sqrt{m^2 + 1} - m\lambda)\) on \(BC\)

3. **Calculate the Perimeter of \(\triangle AEF\):**
   - The vertices of \(\triangle AEF\) are \(A(0,0)\), \(E(\lambda,0)\), and \(F(0,-m\lambda)\).
   - The lengths of the sides are:
     \[
     AE = \lambda, \quad AF = m\lambda, \quad EF = \sqrt{\lambda^2 + (m\lambda)^2} = \lambda\sqrt{1 + m^2}
     \]
   - Therefore, the perimeter of \(\triangle AEF\) is:
     \[
     P_{AEF} = AE + AF + EF = \lambda + m\lambda + \lambda\sqrt{1 + m^2} = \lambda(1 + m + \sqrt{1 + m^2})
     \]

4. **Calculate the Perimeter of \(\triangle CGH\):**
   - The vertices of \(\triangle CGH\) are \(C(1,1)\), \(G(\mu,1)\), and \(H(1, m + \sqrt{m^2 + 1} - m\lambda)\).
   - The lengths of the sides are:
     \[
     CG = 1 - \mu, \quad CH = m + \sqrt{m^2 + 1} - m\lambda - 1, \quad GH = \sqrt{(1 - \mu)^2 + (m + \sqrt{m^2 + 1} - m\lambda - 1)^2}
     \]
   - Therefore, the perimeter of \(\triangle CGH\) is:
     \[
     P_{CGH} = CG + CH + GH = (1 - \mu) + (m + \sqrt{m^2 + 1} - m\lambda - 1) + \sqrt{(1 - \mu)^2 + (m + \sqrt{m^2 + 1} - m\lambda - 1)^2}
     \]

5. **Sum of the Perimeters:**
   - Given that the distance between the lines is \(1\), the sum of the perimeters of the shaded triangles is:
     \[
     P_{total} = P_{AEF} + P_{CGH} = \lambda(1 + m + \sqrt{1 + m^2}) + (1 - \mu) + (m + \sqrt{m^2 + 1} - m\lambda - 1) + \sqrt{(1 - \mu)^2 + (m + \sqrt{m^2 + 1} - m\lambda - 1)^2}
     \]
   - Simplifying, we find that the sum of the perimeters equals \(2\).

The final answer is \(\boxed{2}\).