Task: Program Execution
Input (English): m, g, 7251, 5873, 59, 7345
Output (English): 20528