def plus_one(digits):  
    n = len(digits)  
    for i in range(n - 1, -1, -1):  
        if digits[i] < 9:  
            digits[i] += 1  
            return digits  
        digits[i] = 0  
    return [1] + digits  

# Input from the user  
user_input = input("Enter the digits as a comma-separated list (e.g., 1,2,3): ")  

# Convert input to a list of integers  
digits = [int(num) for num in user_input.split(",")]  

# Call the function and print the result  
result = plus_one(digits)  
print(result)