Solution: The points of tangency of the inscribed circle and the vertices divide the perimeter of the hexagon into 12 segments. The segments through the vertices of the right angles of the hexagon are equal to $R$ (for example, by drawing the radii $O D$ and $O E$ to the points of tangency, we get a square $C D O E$, from which $C D=C E=R$.

If we denote the tangents from the other three vertices by $x, y, z$, the perimeter of the hexagon is equal to

![](https://cdn.mathpix.com/cropped/2024_06_03_b026f4fc43cab007846ag-3.jpg?height=414&width=351&top_left_y=781&top_left_x=1298)

$$
Q=6 R+2 x+2 y+2 z .
$$

The diameter of the inscribed circle in a right triangle is equal to the sum of the legs minus the hypotenuse. For $\triangle A B C$, the diameter of the inscribed circle is

$A C+B C-A B=(A D-R)+(R+x)-(A F-x)=2 x+(A D-A F)=2 x$, since the tangents $A D$ and $A F$ are equal. Similarly, the other two diameters are equal to $2 y$ and $2 z$, from which we find that the sum of the three diameters is equal to $2 x+2 y+2 z=Q-6 R$.
Problem 4. In an acute-angled triangle, a circle with radius $R$ is inscribed. Three tangents to the circle divide the triangle into three right-angled triangles and a hexagon. The perimeter of the hexagon is equal to $Q$. Find the sum of the diameters of the circles inscribed in the three right-angled triangles.