Let $r$ and $s$ be positive integers. Derive a formula for the number of ordered quadruples $(a,b,c,d)$ of positive integers such that
$$3^r \cdot 7^s = \text{lcm}(a,b,c)= \text{lcm}(a,b,d)=\text{lcm}(a,c,d)=\text{lcm}(b,c,d),$$
depending only on $r$ and $s.$
1. **Understanding the problem**: We need to find the number of ordered quadruples \((a, b, c, d)\) of positive integers such that the least common multiple (LCM) of any three of them is \(3^r \cdot 7^s\). This implies that the LCM of any three of these numbers must have the same prime factorization.

2. **Prime factorization constraints**: Since the LCM of any three numbers must be \(3^r \cdot 7^s\), each number \(a, b, c, d\) can be written in the form \(3^{x_i} \cdot 7^{y_i}\) where \(0 \leq x_i \leq r\) and \(0 \leq y_i \leq s\).

3. **3-adic valuation**: For the LCM of any three numbers to be \(3^r\), at least two of the numbers must have a 3-adic valuation of \(r\). The third number can have a 3-adic valuation less than or equal to \(r\).

4. **Counting 3-adic valuations**:
    - We need to count the number of ways to assign 3-adic valuations to \(a, b, c, d\) such that the LCM of any three of them is \(3^r\).
    - Let \(v_3(a) = x_1\), \(v_3(b) = x_2\), \(v_3(c) = x_3\), and \(v_3(d) = x_4\).
    - We need at least two of \(x_1, x_2, x_3, x_4\) to be equal to \(r\), and the rest to be less than or equal to \(r\).

5. **Casework for 3-adic valuations**:
    - **Case 1**: Three numbers have 3-adic valuation \(r\) and one number has a 3-adic valuation less than \(r\). There are \(\binom{4}{3} = 4\) ways to choose which three numbers have valuation \(r\), and \(r\) choices for the remaining number. This gives \(4r\) combinations.
    - **Case 2**: Two numbers have 3-adic valuation \(r\) and the other two have valuations less than \(r\). There are \(\binom{4}{2} = 6\) ways to choose which two numbers have valuation \(r\), and \(r^2\) choices for the remaining two numbers. This gives \(6r^2\) combinations.
    - **Case 3**: All four numbers have 3-adic valuation less than \(r\). There is only 1 way to choose this, and \(r^3\) choices for the numbers. This gives \(r^3\) combinations.

6. **Summing up the cases**:
    - Total combinations for 3-adic valuations: \(6r^2 + 4r + 1\).

7. **7-adic valuation**: The same argument applies for the 7-adic valuation. Thus, the number of ways to assign 7-adic valuations is also \(6s^2 + 4s + 1\).

8. **Combining both valuations**: Since the 3-adic and 7-adic valuations are independent, the total number of ordered quadruples \((a, b, c, d)\) is the product of the two counts:
    \[
    (6r^2 + 4r + 1)(6s^2 + 4s + 1)
    \]

The final answer is \(\boxed{(6r^2 + 4r + 1)(6s^2 + 4s + 1)}\)