Problem A

Statement
Copy Copied
A. Sublime Sequencetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFarmer John has an integer $$$x$$$. He creates a sequence of length $$$n$$$ by alternating integers $$$x$$$ and $$$-x$$$, starting with $$$x$$$. For example, if $$$n = 5$$$, the sequence looks like: $$$x, -x, x, -x, x$$$.He asks you to find the sum of all integers in the sequence.InputThe first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$)  — the number of test cases.The only line of input for each test case is two integers $$$x$$$ and $$$n$$$ ($$$1 \leq x, n \leq 10$$$).OutputFor each test case, output the sum of all integers in the sequence.ExampleInput41 42 53 64 7Output0
2
0
4