def increment_large_number(digits):
    n = len(digits)
    
    for i in range(n - 1, -1, -1):
        if digits[i] < 9:
            digits[i] += 1
            return digits
        digits[i] = 0  # Set current digit to 0 if it was 9
    
    return [1] + digits  # If all were 9

# Function to parse user input
def parse_input(user_input):
    # Strip 'digits =: ' and convert the remaining string to a list of integers
    digits_str = user_input.replace("digits=  ", "").strip()
    return eval(digits_str)  # Using eval to convert string to list

# Main program
user_input = input("Enter the digits in the format '[4, 3, 2, 1]': ")
try:
    digits = parse_input(user_input)
    result = increment_large_number(digits)
    
    # Constructing the explanation
    number_representation = ''.join(map(str, digits))
    incremented_representation = ''.join(map(str, result))
    
    explanation = (f"Explanation: The array represents the number {number_representation}. "
                   f"Adding one results in {incremented_representation}, so the output is {result}.")
    
    print("Output:", result)
    print(explanation)
except Exception as e:
    print("Error:", str(e))