Task: Program Execution
Input (English): D, 1831, 1129, 2855, h, J, B, 1373, m, 7225, T, 3063, 5011, q, d, 2525, J, 8525, 5975
Output (English): 39512