{"trustable":false,"prependHtml":"","sections":[{"title":"","value":{"format":"HTML","content":"\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\u003cp\u003eWe all know about Marvel Avengers. They come to Bangladesh and they get lost in Sundarban. They are very lucky and find a lot of treasures and a big treasure chest, but with angry robbers.\u003c/p\u003e\n\u003cp\u003eWe are tired of this chaos. So, we request our avengers to do something. The avengers are so brave that they decide to defeat the robbers and then bring all the treasures back. A brutal long-drawn-out battle lasts from morning to night and the avengers find the robbers are undead and invincible.\u003c/p\u003e\n\n\u003cp\u003eWe know our Sundarban has so many treasures and of course, the treasures should not be left here. Unfortunately, the avengers cannot carry all the treasures by the treasure chest due to the limitation of the capacity of the chest. Indeed, there are only two types of treasures: emerald and sapphire. All of the emeralds are equal in size and value, and with infinite quantities. So are sapphires.\u003c/p\u003e\n\n\u003cp\u003eOur avengers have some special skills. So we asked our avengers to use their skills with the magic artifact: computer, and given the size of the chest, the value and size of each types of gem, you should compute the maximum value of treasures our avengers could bring back.\u003c/p\u003e\n\n\u003ch4\u003eInput\u003c/h4\u003e\n\n\u003cp\u003eThe problem inputs are bit tricky. Hence there are multiple test cases. The number of test cases T (T ≤ 200) is given in the first line of the input file. For each test case, there is only one line containing five integers N, S1, V1, S2, V2, denoting the size of the treasure chest is N and the size and value of an emerald is S1 and V1, size and value of a sapphire is S2, V2. All integers are positive and fit in 32-bit signed integers.\u003c/p\u003e\n\n\u003ch4\u003eOutput\u003c/h4\u003e\n\n\u003cp\u003eNow, for each test case, output a single line containing the case number and the maximum total value of all items that the avengers can carry with the chest.\u003c/p\u003e\n\n\u003ch4\u003eSample Input\u003c/h4\u003e\n2\u003cbr\u003e\n100 1 1 2 2\u003cbr\u003e\n100 34 34 5 3\u003cbr\u003e\n\n\n\u003ch4\u003eSample Output\u003c/h4\u003e\nCase #1: 100\u003cbr\u003e\nCase #2: 86\u003cbr\u003e\n\n\u003c/body\u003e\n\u003c/html\u003e"}},{"title":"","value":{"format":"HTML","content":"\u003ch4\u003eNote\u003c/h4\u003e\nYou can submit your solution using C/C++/Java. If you want to submit your solution using JavaScript then ask volunteers."}}]}