import sys

def main():
        M = sys.argv[1]
        w = sys.argv[2]

        # Read file M
        with open(M, "r") as f:
            content = f.read()
            
        # Replace literal occurrences of "sys.argv[1]"
        modified = content.replace(' "sys.argv[1]"', w)

        #Output filename is M + w
        output_filename = M+w

        # Write modified version
        with open(output_filename, "w") as f:
            f.write(modified)

        if __name__ == "__main__":
            main()
