AtCoder Grand Contest 024
翻译中…
Problem Statement
翻译中…
Takahashi, Nakahashi and Hikuhashi have integers $A$, $B$ and $C$, respectively. After repeating the following operation $K$ times, find the integer Takahashi will get minus the integer Nakahashi will get:
翻译中…
- Each of them simultaneously calculate the sum of the integers that the other two people have, then replace his own integer with the result.
翻译中…
However, if the absolute value of the answer exceeds $10^{18}$, print Unfair instead.
翻译中…
Constraints
翻译中…
$1 \leq A,B,C \leq 10^9$$0 \leq K \leq 10^{18}$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
A B C K
翻译中…
Output
翻译中…
Print the integer Takahashi will get minus the integer Nakahashi will get, after repeating the following operation $K$ times. If the absolute value of the answer exceeds $10^{18}$, print Unfair instead.
翻译中…
样例
Input #1
1 2 3 1
Output #1
1
After one operation, Takahashi, Nakahashi and Hikuhashi have $5$, $4$ and $3$, respectively. We should print $5-4=1$.
Input #2
2 3 2 0
Output #2
-1
Input #3
1000000000 1000000000 1000000000 1000000000000000000
Output #3
0
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。