{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n有n种珍珠,给出每种要买的数量和价格。按价格升序输入;现在有两种购买的方法,第一,如果单买一种,需要多买10个。第二 ,如果买连续的珍珠,也只需要多出10个,但是全部要按最高价格。 假设: 假设有二个等级的珍珠:价值10的要买5个,价值20的要买100个,你可以分开买要花费(5+10)*10+(100+10)*20\u003d2350 一次买(5+100+10)*20\u003d2300"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input contains the number of test cases. Each test case starts with a line containing the number of categories c (1\u0026lt;\u003dc\u0026lt;\u003d100). Then, c lines follow, each with two numbers ai and pi. The first of these numbers is the number of pearls ai needed in a class (1 \u0026lt;\u003d ai \u0026lt;\u003d 1000).\n\u003cbr\u003eThe second number is the price per pearl pi in that class (1 \u0026lt;\u003d pi \u0026lt;\u003d 1000). The qualities of the classes (and so the prices) are given in ascending order. All numbers in the input are integers.\n\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test case a single line containing a single number: the lowest possible price needed to buy everything on the list.\n\u003cbr\u003e"}},{"title":"Sample","value":{"format":"HTML","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\u003e2\n2\n100 1\n100 2\n3\n1 10\n1 11\n100 12\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e330\n1344\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}