Task: Program Execution
Input (English): a, m, 3205, 1869, 1117, K, 5785
Output (English): 11976