{"trustable":true,"sections":[{"title":"Description","value":{"format":"MD","content":"Chenchen is a talented child, and his dream is to become the greatest physician in the world. To achieve this, he wants to apprentice himself to the most prestigious physician nearby. In order to assess his qualifications, the physician gave him a difficult task. The physician took him to a cave full of herbs and said to him, \"Child, there are different herbs in this cave, and each one takes some time to pick, and each has its own value. I will give you a certain amount of time, during which you can pick some herbs. If you are a clever child, you should be able to maximize the total value of the herbs you pick.\"\n\nIf you were Chenchen, could you complete this task?"}},{"title":"Input","value":{"format":"MD","content":"The first line contains $2$ integers $T$ ($1 \\le T \\le 1000$) and $M$ ($1 \\le M \\le 100$), separated by a space, where $T$ represents the total time available for picking herbs, and $M$ represents the number of herbs in the cave.\n\nThe next $M$ lines each contain two integers between $1$ and $100$ (including $1$ and $100$), representing the time to pick a certain herb and its value."}},{"title":"Output","value":{"format":"MD","content":"Output the maximum total value of the herbs that can be picked within the specified time."}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e70 3\n71 100\n69 1\n1 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Hint","value":{"format":"MD","content":"**【Data Range】**\n\n- For $30\\%$ data, $M \\le 10$;\n- For all data, $M \\le 100$.\n\n**【Problem Source】**\n\nNOIP 2005 Preliminary Group, 3rd question"}}]}