Task: Program Execution
Input (English): M, u, 4119, 8225, 3621, 6645, M
Output (English): 22610