
    Given a hospital's hierarchical bed allocation system where each level incorporates all beds from previous levels plus an expanding number of new beds per department, calculate the total bed capacity needed when planning for n interconnected departments. Each new level adds beds in a triangular pattern to accommodate cross-department patient flow, where level 1 has 1 bed, level 2 adds a triangle of 3 beds, and each subsequent level continues this cumulative triangular expansion pattern.
    

    
def tetrahedral_number(n):
    """
    Given a hospital's hierarchical bed allocation system where each level incorporates all beds from previous levels plus an expanding number of new beds per department, calculate the total bed capacity needed when planning for n interconnected departments. Each new level adds beds in a triangular pattern to accommodate cross-department patient flow, where level 1 has 1 bed, level 2 adds a triangle of 3 beds, and each subsequent level continues this cumulative triangular expansion pattern.
    

    """
def tetrahedral_number(n):
    """
    Given a hospital's hierarchical bed allocation system where each level incorporates all beds from previous levels plus an expanding number of new beds per department, calculate the total bed capacity needed when planning for n interconnected departments. Each new level adds beds in a triangular pattern to accommodate cross-department patient flow, where level 1 has 1 bed, level 2 adds a triangle of 3 beds, and each subsequent level continues this cumulative triangular expansion pattern.
    

    """
    return n * (n + 1) * (n + 2) / 6