{"trustable":true,"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":"","value":{"format":"HTML","content":"\u003cp\u003e一只青蛙目前位于坐标轴上的点 $$$0$$$。它按照以下算法跳跃:第一次跳跃向右 $$$a$$$ 单位,第二次跳跃向左 $$$b$$$ 单位,第三次跳跃向右 $$$a$$$ 单位,第四次跳跃向左 $$$b$$$ 单位,依此类推。\u003c/p\u003e\u003cp\u003e形式化地说:\u003c/p\u003e\u003cul\u003e \u003cli\u003e 如果青蛙已经跳了偶数次(在当前跳跃之前),它从当前位置 $$$x$$$ 跳到位置 $$$x+a$$$; \u003c/li\u003e\u003cli\u003e 否则它从当前位置 $$$x$$$ 跳到位置 $$$x-b$$$。 \u003c/li\u003e\u003c/ul\u003e\u003cp\u003e你的任务是计算青蛙在 $$$k$$$ 次跳跃后的位置。\u003c/p\u003e\u003cp\u003e但是... 还有一件事。你正在观察 $$$t$$$ 只不同的青蛙,因此你需要回答 $$$t$$$ 个独立的查询。\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e输入的第一行包含一个整数 $$$t$$$($$$1 \\le t \\le 1000$$$) — 查询的数量。\u003c/p\u003e\u003cp\u003e接下来的 $$$t$$$ 行中每行包含一个查询。\u003c/p\u003e\u003cp\u003e查询由三个用空格分隔的整数 $$$a, b, k$$$($$$1 \\le a, b, k \\le 10^9$$$)描述 — 两种跳跃的长度和跳跃的次数。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e输出 $$$t$$$ 个整数。第 $$$i$$$ 个整数应该是第 $$$i$$$ 个查询的答案。\u003c/p\u003e"}},{"title":"示例 1","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\u003e6\n5 2 3\n100 1 4\n1 10 5\n1000000000 1 6\n1 1 1000000000\n1 1 999999999\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e8\n198\n-17\n2999999997\n0\n1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"注意","value":{"format":"HTML","content":"\u003cp\u003e在第一个查询中,青蛙向右跳 $$$5$$$,向左跳 $$$2$$$,再向右跳 $$$5$$$,因此答案是 $$$5 - 2 + 5 \u003d 8$$$。\u003c/p\u003e\u003cp\u003e在第二个查询中,青蛙向右跳 $$$100$$$,向左跳 $$$1$$$,再向右跳 $$$100$$$,最后向左跳 $$$1$$$,因此答案是 $$$100 - 1 + 100 - 1 \u003d 198$$$。\u003c/p\u003e\u003cp\u003e在第三个查询中,答案是 $$$1 - 10 + 1 - 10 + 1 \u003d -17$$$。\u003c/p\u003e\u003cp\u003e在第四个查询中,答案是 $$$10^9 - 1 + 10^9 - 1 + 10^9 - 1 \u003d 2999999997$$$。\u003c/p\u003e\u003cp\u003e在第五个查询中,所有青蛙的跳跃互相抵消,因此答案是 $$$0$$$。\u003c/p\u003e\u003cp\u003e第六个查询与第五个相同,但去掉了最后一次跳跃,因此答案是 $$$1$$$。\u003c/p\u003e"}}]}