A circle with area $40$ is tangent to a circle with area $10$. Let R be the smallest rectangle containing both circles. The area of $R$ is $\frac{n}{\pi}$. Find $n$.

[asy]
defaultpen(linewidth(0.7)); size(120);
real R = sqrt(40/pi), r = sqrt(10/pi);
draw(circle((0,0), R)); draw(circle((R+r,0), r));
draw((-R,-R)--(-R,R)--(R+2*r,R)--(R+2*r,-R)--cycle);[/asy]
1. **Calculate the radii of the circles:**
   - The area of a circle is given by \( A = \pi r^2 \).
   - For the larger circle with area \( 40 \):
     \[
     \pi R^2 = 40 \implies R^2 = \frac{40}{\pi} \implies R = \sqrt{\frac{40}{\pi}}
     \]
   - For the smaller circle with area \( 10 \):
     \[
     \pi r^2 = 10 \implies r^2 = \frac{10}{\pi} \implies r = \sqrt{\frac{10}{\pi}}
     \]

2. **Determine the dimensions of the rectangle:**
   - The height of the rectangle is the diameter of the larger circle:
     \[
     \text{Height} = 2R = 2 \sqrt{\frac{40}{\pi}} = \frac{4\sqrt{10}}{\sqrt{\pi}}
     \]
   - The length of the rectangle is the sum of the diameters of both circles:
     \[
     \text{Length} = 2R + 2r = 2 \sqrt{\frac{40}{\pi}} + 2 \sqrt{\frac{10}{\pi}} = \frac{4\sqrt{10}}{\sqrt{\pi}} + \frac{2\sqrt{10}}{\sqrt{\pi}} = \frac{6\sqrt{10}}{\sqrt{\pi}}
     \]

3. **Calculate the area of the rectangle:**
   - The area \( A \) of the rectangle is given by:
     \[
     A = \text{Height} \times \text{Length} = \left(\frac{4\sqrt{10}}{\sqrt{\pi}}\right) \left(\frac{6\sqrt{10}}{\sqrt{\pi}}\right)
     \]
   - Simplify the expression:
     \[
     A = \frac{4\sqrt{10} \cdot 6\sqrt{10}}{\pi} = \frac{24 \cdot 10}{\pi} = \frac{240}{\pi}
     \]

Thus, the area of the rectangle \( R \) is \( \frac{240}{\pi} \).

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