{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"Description","value":{"format":"MD","content":"石学长和胡学长在玩一个游戏:\n他们每个人都有$n$张卡牌,每个卡牌上面代表了石头、剪刀、布。\n游戏有$n$轮,每一轮中,石学长会拿出一张卡牌,随后胡学长会拿出另一张卡牌,这一轮的得分如下\n 胡学长 石头 剪刀 布\n石学长\n石头 0 -1 1\n剪刀 1 0 -1\n 布 -1 1 0\n之后,这两张卡牌将被遗弃。\n石学长想要最小化分数,胡学长想要最大化分数,两人都会进行最佳策略,请问最后的比分是多少?"}},{"title":"Input","value":{"format":"MD","content":"有多个测试用例。输入的第一行包含一个整数$T(2 \\le T \\le 10^3)$,表示测试用例的数量。\n对于每个测试用例,第一行包含三个整数$br, bp, bs, (1 \\le br, bp, bs \u003c 10^9)$,表示石学长拥有的剪刀石头布的数量。第二行包含三个整数$dr, dp, ds, (1 \\le dr,dp, ds \\le 10^9)$,表示胡学长拥有的石头剪刀布卡片的数量。\n它保证了$br +bp+bs \u003ddr +dp+ds$。"}},{"title":"Output","value":{"format":"MD","content":"对于每个测试用例输出一行包含一个整数表示游戏的最终分数。"}},{"title":"Example","value":{"format":"MD","content":"input\n4\n4 4 2\n10 0 0\n0 10 0\n2 4 4\n1 2 3\n3 2 1\n10 10 10\n10 10 10\noutput\n-2\n2\n5\n30"}}]}