{"trustable":true,"sections":[{"title":"Description","value":{"format":"MD","content":"Perket is a popular delicacy. To make a good Perket, the chef must carefully select ingredients to achieve the most comprehensive flavor while maintaining the traditional taste. You have $n$ types of available ingredients. For each ingredient, we know their respective acidity $s$ and bitterness $b$. When we add ingredients, the total acidity is the product of the acidity of each ingredient; the total bitterness is the sum of the bitterness of each ingredient.\n\nAs is well known, delicacies should have a moderate taste, so we hope to select ingredients to minimize the absolute difference between acidity and bitterness.\n\nIn addition, we must add at least one type of ingredient, as no food is made with water as the only ingredient."}},{"title":"Input","value":{"format":"MD","content":"The first line contains an integer $n$, representing the number of available ingredient types.\n\nNext $n$ lines, each line contains $2$ integers $s_i$ and $b_i$, representing the acidity and bitterness of the $i$th ingredient."}},{"title":"Output","value":{"format":"MD","content":"One line containing an integer, representing the minimum absolute difference between the total acidity and total bitterness."}},{"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\u003e1\n3 10\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e7\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Sample 2","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\u003e2\n3 8\n5 8\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Sample 3","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\u003e4\n1 7\n2 6\n3 8\n4 9\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Hint","value":{"format":"MD","content":"#### Constraints\nFor $100\\%$ data, there are $1 \\leq n \\leq 10$ and using all available ingredients results in a total acidity and bitterness less than $1 \\times 10^9$, acidity and bitterness are not both $1$ and $0$.\n#### Note\n- The full score of this problem is $70$ points.\n- The problem is translated from \u003ca href\u003d\u0027https://hsin.hr/coci/archive/2008_2009/\u0027 target\u003d\u0027_blank\u0027\u003eCOCI2008-2009\u003c/a\u003e \u003ca href\u003d\u0027https://hsin.hr/coci/archive/2008_2009/contest2_tasks.pdf\u0027 target\u003d\u0027_blank\u0027\u003eCONTEST #2\u003c/a\u003e PERKET, translated by @\u003ca href\u003d\u0027https://www.luogu.com.cn/user/115711\u0027 target\u003d\u0027_blank\u0027\u003emnesia\u003c/a\u003e."}}]}