
    Design a function for a medication adherence tracking system that calculates a patient's compliance score based on missed doses. Starting with a total prescribed dose count, each consecutive missed dose reduces the patient's adherence score by twice the number of previous misses. The system should sum up these declining adherence values until the score reaches zero, helping healthcare providers assess the severity of medication non-compliance. For example, if a patient starts with 10 prescribed doses, their adherence pattern would be tracked as 10 + (10-2) + (10-4) + (10-6) + (10-8), stopping when the remaining value would become zero or negative. This calculation provides a weighted measure that emphasizes the compounding negative impact of consecutive missed doses on treatment effectiveness.
    

    
def sum_series(n):
    """
    Design a function for a medication adherence tracking system that calculates a patient's compliance score based on missed doses. Starting with a total prescribed dose count, each consecutive missed dose reduces the patient's adherence score by twice the number of previous misses. The system should sum up these declining adherence values until the score reaches zero, helping healthcare providers assess the severity of medication non-compliance. For example, if a patient starts with 10 prescribed doses, their adherence pattern would be tracked as 10 + (10-2) + (10-4) + (10-6) + (10-8), stopping when the remaining value would become zero or negative. This calculation provides a weighted measure that emphasizes the compounding negative impact of consecutive missed doses on treatment effectiveness.
    

    """
def sum_series(n):
    """
    Design a function for a medication adherence tracking system that calculates a patient's compliance score based on missed doses. Starting with a total prescribed dose count, each consecutive missed dose reduces the patient's adherence score by twice the number of previous misses. The system should sum up these declining adherence values until the score reaches zero, helping healthcare providers assess the severity of medication non-compliance. For example, if a patient starts with 10 prescribed doses, their adherence pattern would be tracked as 10 + (10-2) + (10-4) + (10-6) + (10-8), stopping when the remaining value would become zero or negative. This calculation provides a weighted measure that emphasizes the compounding negative impact of consecutive missed doses on treatment effectiveness.
    

    """
    if n < 1:
        return 0
    else:
        return n + sum_series(n - 2)