Given a rectangle $ABCD$, which is located on the line $\ell$ They want it "turn over" by first turning around the vertex $D$, and then as point $C$ appears on the line $\ell$ - by making a turn around the vertex $C$ (see figure). What is the length of the curve along which the vertex $A$ is moving , at such movement, if $AB = 30$ cm, $BC = 40$ cm?

(Alexey Panasenko)
[img]https://cdn.artofproblemsolving.com/attachments/d/9/3cca36b08771b1897e385d43399022049bbcde.png[/img]
1. **Understanding the Problem:**
   We are given a rectangle \(ABCD\) with \(AB = 30 \, \text{cm}\) and \(BC = 40 \, \text{cm}\). The rectangle is initially positioned such that side \(BC\) lies on the line \(\ell\). We need to determine the length of the curve along which vertex \(A\) moves when the rectangle is first rotated around vertex \(D\) and then around vertex \(C\).

2. **First Rotation Around Vertex \(D\):**
   - When the rectangle is rotated around vertex \(D\), vertex \(A\) will trace a quarter-circle with radius equal to the length of diagonal \(AD\).
   - The length of diagonal \(AD\) can be calculated using the Pythagorean theorem:
     \[
     AD = \sqrt{AB^2 + BD^2} = \sqrt{30^2 + 40^2} = \sqrt{900 + 1600} = \sqrt{2500} = 50 \, \text{cm}
     \]
   - The length of the quarter-circle traced by \(A\) is:
     \[
     \text{Length of quarter-circle} = \frac{1}{4} \times 2\pi \times 50 = \frac{1}{2} \pi \times 50 = 25\pi \, \text{cm}
     \]

3. **Second Rotation Around Vertex \(C\):**
   - After the first rotation, point \(C\) is on the line \(\ell\). Now, the rectangle is rotated around vertex \(C\), and vertex \(A\) will trace another quarter-circle with radius equal to the length of diagonal \(AC\).
   - The length of diagonal \(AC\) is the same as \(AD\) because \(ABCD\) is a rectangle:
     \[
     AC = AD = 50 \, \text{cm}
     \]
   - The length of the quarter-circle traced by \(A\) is:
     \[
     \text{Length of quarter-circle} = \frac{1}{4} \times 2\pi \times 50 = \frac{1}{2} \pi \times 50 = 25\pi \, \text{cm}
     \]

4. **Total Length of the Curve:**
   - The total length of the curve along which vertex \(A\) moves is the sum of the lengths of the two quarter-circles:
     \[
     \text{Total length} = 25\pi + 25\pi = 50\pi \, \text{cm}
     \]

The final answer is \(\boxed{50\pi \, \text{cm}}\)