Problem:
 Score : 300 points    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.        Sample Input 1 1 2 3 1      Sample Output 1 1  After one operation, Takahashi, Nakahashi and Hikuhashi have 5 , 4 and 3 , respectively. We should print 5-4=1 .       Sample Input 2 2 3 2 0      Sample Output 2 -1       Sample Input 3 1000000000 1000000000 1000000000 1000000000000000000      Sample Output 3 0

Solution (Python):
a,b,c,k=map(int,input().split())
if k%2==1:
    print(b-a)
else:
    print(a-b)

Solution (Python):
A, B, C, K = list(map(int, input().split()))

if K % 2 != 0:
    r = B - A
else:
    r = A - B

if abs(r) > 10 ** 18:
    print('Unfair')
else:
    print(r)

Solution (Python):
A, B, C, K = map(int, input().split()) 
if K%2 == 0:
    print(A-B) if abs(A-B)<=10**18 else print("Unfair")
else:
    print(B-A) if abs(B-A)<=10**18 else print("Unfair")

Solution (Python):
A,B,C,K=map(int, input().split())
print(B-A if K&1 else A-B)

Solution (Python):
a, b,c, k = map(int, input().split())
x = b - a
if k % 2 == 0:
    print(-x)
else:
    print(+x)

Solution (Python):
A,B,C,K=map(int,input().split())
if K%2==0:
    print(A-B)
else:
    print(B-A)

Solution (Python):
A,B,C,K = map(int,input().split())
if K%2:
    print(B-A)
else:
    print(A-B)

Solution (Python):
a, b, c, k = map(int, input().split())

if k % 2:
    print(-1 * (a-b))
else:
    print(a-b)

Solution (Python):
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A, B, C, K = lr()
if K%2 == 0:
    answer = A - B
else:
    answer = B - A

if answer > 10 ** 18:
    answer = 'Unfair'

print(answer)

Solution (Python):
a, b, c, k = map(int, input().split())
if k % 2 == 0:
    print(a - b)
else:
    print(-(a - b))

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]





a,b,c,k=mii()

p=b-a

if k%2==1:
    print(p)
else:
    print(-1*p)

Solution (Python):
A, B, C, K = map(int, input().split())
print(A - B if K % 2 == 0 else B - A)

Solution (Python):
A,B,C,K = map(int,input().split())
ans = (A-B) * pow(-1,K&1)
print(ans)

Solution (Python):
a, b, c, k=map(int, input().split())
if k%2==0:
  print(a-b)
else:
  print(b-a)

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = int(1e09) + 7
INF = int(1e15)


def calc(N):
    return sum(int(x) for x in str(N))


def main():
    
    A, B, C, K = Scanner.map_int()
    if K % 2 == 0:
        print(A-B)
    else:
        print(B-A)
    return


if __name__ == "__main__":
    main()

Solution (Python):
A ,B , C , K = map(int,input().split())
if K % 2 == 0:
	print(A - B)
else:
	print(B - A)

Solution (Python):
a, b, c, k = map(int, input().split())

if abs(a - b) > 10 ** 18:
	print("Unfair")
else:
	if k % 2 == 0:
		print(a - b)
	else:
		print(b - a)

Solution (Python):
A,B,C,K=map(int,input().split())
if K%2==0:
    print(A-B)
else:
    print(B-A)

Solution (Python):
a, b, c, k = map(int, input().split())

if k % 2 == 1:
    print(b - a)
elif k % 2 == 0:
    print(a - b)

Solution (Python):
A,B,C,K = map(int,input().split())
if K%2==0:
    print(A-B)
else:
    print(B-A)

Solution (Python):
a,b,c,k=map(int,input().split())
print((a-b)*(-1)**k)

Solution (Python):
a,b,c,k= map(int,input().split())
ans = a-b
if k % 2 == 0:
	print(ans)
else:
	print(ans * (-1))

Solution (Python):
A, B, C, K = map(int, input().split())
for _ in range(K%2):
    A, B, C = B+C, C+A, A+B
print(A-B)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    a, b, c, k = LI()
    ans = a * (-1) ** k - b * (-1) ** k
    if abs(ans) > 10 ** 18:
        print("Unfair")
    else:
        print(ans)
    return



if __name__ == '__main__':
    solve()

Solution (Python):
A,B,C,K=map(int,input().split())

if K%2==0:
    ans=A-B
    if abs(ans)>10**18:
        print('Unfair')
    else:
        print(ans)
else:
    ans=B-A
    if abs(ans)>10**18:
        print('Unfair')
    else:
        print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

def main():
	A, B, C, K = MAP()
	dif = A-B
	if dif > 10**18:
		print('Unfair')
	elif K%2:
		print(-dif)
	else:
		print(dif)

if __name__ == '__main__':
	main()

Solution (Python):
a,b,c,k=map(int,input().split())
sm=a+b+c
if k%2==1:
  print(b-a)
else:
  print(a-b)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A,B,C,K = map(int,read().split())

x = A - B
if K&1:
    x *= (-1)
print(x)

Solution (Python):

a,b,c,k = map(int,input().split())
if (abs(a-b)>1e+18):
    print ("Unfair")  
elif (k%2==0):
    print (a-b)
else:
    print (b-a)

Solution (Python):
A,B,C,K = map(int,input().split())
if abs(A-B) > 10**18:
    print("Unfair")
else:
    print((A-B)*(-1)**(K))

Solution (Python):
a,b,c,k=map(int,input().split())
if k%2==0:
    print(a-b)
else:
    print(b-a)

Solution (Python):
a,b,c,k = map(int,input().split())

if abs(a-b)>=10**18:
    print("unfair")
elif k%2 == 1:
    print(b-a)
elif k%2 == 0:
    print(a-b)

Solution (Python):
a,b,c,k=map(int,input().split())
if k%2==0:
    print(a-b)
else:
    print(b-a)

Solution (Python):

A, B, C, K =  map(int, input().split(' '))

if K % 2 == 0:
    print(A - B)
else:
    print(B - A)

Solution (Python):
A, B, C, K = map(int, input().split())

if K % 2 == 0 :
  ret = A - B
else :
  ret = B - A

if ret > 10 ** 18 :
  print('Unfair')
else :
  print(ret)

Solution (Python):

import sys
import itertools
import math

A, B, C, K=input().split()
A=int(A)
B=int(B)
C=int(C)
K=int(K)
i=0
ID_list=[]
ID_sublist=[]
gate_possible_list=[]
A_dummy=0
B_dummy=0
C_dummy=0


























i=0
if A==B==C:
    print(0)
    sys.exit()








if abs(A-B)>10**18:
    print("Unfair")
    sys.exit()

if K%2==0:
    print(A-B)
    sys.exit()

if K%2==1:
    print(-(A-B))
    sys.exit()

Solution (Python):
from sys import stdin

a,b,c,k = [int(x) for x in stdin.readline().rstrip().split()]

if k % 2 == 1:
    print(b-a)
else:
    print(a-b)

Solution (Python):
a,b,c,k = map(int,input().split())
print((a-b)*(-1)**(k%2))

Solution (Python):
a,b,c,k=map(int,input().split())
print(b-a if k%2 else a-b)

Solution (Python):
A, B, C, K = map(int, input().split())
X0 = A + B + C
if abs(A - B) > 10 ** 18:
  print('Unfair')
else:
  print((A - B) * ((-1) ** K))

Solution (Python):
def examA():
    A, B, C, K = LI()
    if K%2==0:
        ans = A-B
    else:
        ans = B-A
    print(ans)


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()

Solution (Python):
import sys
a, b, c, k = [int(i) for i in sys.stdin.readline().split()]
print((a - b) * (-1) ** k)

Solution (Python):
a, b, c, k = map(int, input().split())
if k % 2 == 0:
    print(a - b)
else:
    print(b - a)

Solution (Python):
A,B,C,K=map(int,input().split())
import numpy as np
X = np.array([A,B,C])
Y = np.array([1,-1,0])
M = np.matrix('0 1 1; 1 0 1; 1 1 0')

def pow_V(Z,n):
  bin_n = format(n, 'b')
  ans = np.matrix('1 0 0; 0 1 0; 0 0 1')
  for i in range(0,len(bin_n)):
    if i == 0:
      XX = Z
    else:
      XX = XX * XX
    if bin_n[-(i+1)]=='1':
      ans = ans * XX
  return ans
MK = pow_V(M,K)
R = np.inner(Y, (X * MK))[0,0]
print(R)

Solution (Python):
a,b,c,k=map(int,input().split())
ans=a-b
if k%2==1:
  ans*=-1
print(ans)

Solution (Python):
a, b, c, k = map(int, input().split())
print((a - b)*(-1)**(k%2))

Solution (Python):
a, b, c, k = map(int, input().split())
if k%2:
  print(-(a - b))
else:
  print(a - b)

Solution (Python):
a, b, c, k = map(int, input().split())
print((a-b)*(-1)**k)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a,b,c,k = inpl()
if k%2:
    print(b-a)
else:
    print(a-b)

Solution (Python):
a,b,c,k=map(int,input().split())
print(a-b if k%2==0 else b-a)

Solution (Python):
A,B,C,K = map(int,input().split())
print(A-B if K%2==0 else B-A)

Solution (Python):
A, B, C, K = map(int, input().split())
if K % 2 == 0:
    print(A - B)
else:
    print(B - A)

Solution (Python):
a,b,c,k=map(int,input().split())
print((-1)**k*(a-b))

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7



A, B, C, K = list(map(int, sys.stdin.buffer.readline().split()))

if K %2 == 1:
    print(B - A)
else:
    print(A - B)

Solution (Python):
A, B, C, K = map(int, input().split())

if K % 2 == 1:
    print(B-A)
else:
    print(-(B-A))

Solution (Python):
a,b,c,k=map(int,input().split())
if k%2==0:
    print(a-b)
else:
    print(b-a)

Solution (Python):

over = 10 ** 18
A, B, C, K = map(int, input().split())
if K % 2 == 0:
    print(A - B)
else:
    print(B - A)

Solution (Python):
a,b,c,k = map(int,input().split())

ans = a-b

if abs(ans) > 10**18:
    print("Unfair")
    exit()

if k%2 == 0:
    print(ans)
else:
    print(-ans)

Solution (Python):
A, B, C, K = map(int, input().split())
if K % 2 == 0:
    print(A - B)
else:
    print(B - A)

Solution (Python):
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

a, b, c, k = ril()
if abs(a - b) > 10**18:
    print('Unfair')
elif k % 2 == 0:
    print(a - b)
else:
    print(b - a)

Solution (Python):
def main():
    a, b, c, K = (int(i) for i in input().split())
    if K & 1:
        print(b-a)
    else:
        print(a-b)


if __name__ == '__main__':
    main()

Solution (Python):
a,b,c,k=map(int,input().split())
print(a-b if k%2==0 else b-a)

Solution (Python):
def main():
    a, b, c, k = map(int, input().split())

    ans = (-1) ** (k % 2) * (a - b)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
a,b,c,n = [int(i) for i in input().split()]

if n%2 == 1:
    print(b-a if abs(b-a) < 10**18 else 'Unfair')
else:
    print(a-b if abs(a-b) < 10**18 else 'Unfair')

Solution (Python):
a, b, c, k = map(int, input().split())













if a-b >= 10**18 or b-a >= 10**18:
    print("Unfair")
    exit()

if k%2 == 0:
    print(a-b)
else:
    print(b-a)

Solution (Python):
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    a, b, c, k = list(map(int, input().rstrip('\n').split()))
    print(a - b if k % 2 == 0 else b - a)


if __name__ == '__main__':
    solve()

Solution (Python):
a, b, c, k = map(int, input().split())

if k % 2 == 0:
    print(a-b)
else:
    print(b-a)

Solution (Python):
A, B, C, K = map(int, input().split())

if K % 2 == 0:
    if A - B > 10 ** 18:
        print('Unfair')
    else:
        print(A - B)
else:
    if B - A > 10 ** 18:
        print('Unfair')
    else:
        print(B - A)

Solution (Python):
def resolve():
    a, b, c, k = map(int, input().split())
    ans = b - a if k % 2 else a - b
    if abs(ans) > 10 ** 18:
        print("Unfair")
    else:
        print(ans)


if __name__ == "__main__":
    resolve()

Solution (Python):


A,B,C,K=map(int,input().split())

all=A+B+C
"""
if K>=2:
    A+=all*4**(K//2-1)
    B+=all*4**(K//2-1)
    C+=all*4**(K//2-1)
"""
if K%2==1:
    A,B,C=B+C,C+A,A+B

ans=A-B
if abs(ans)>10**18:
    print("Unfair")
else:
    print(ans)

Solution (Python):
A,B,C,K = map(int,input().split())

for i in range(K%2):
    tmp1 = A+B
    tmp2 = A+C
    tmp3 = B+C

    A = tmp3
    B = tmp2
    C = tmp1
if abs(A-B)>=10**18:
    print("Unfair")
else:
    print(A-B)

Solution (Python):
A,B,C,K=map(int,input().split())
print(A-B if K%2==0 else B-A)

Solution (Python):
a, b, c, k = map(int,input().split())
if k % 2 == 0:
    print(a-b)
else:
    print(b-a)

Solution (Python):
def f(a,b,c):
    return b+c,a+c,a+b
a,b,c,k = map(int,input().split())
if k%2 ==0:
    print(a-b)
else:
    print(b-a)

Solution (Python):
a, b, c, k = map(int, input().split())
print(a - b if k % 2 == 0 else b - a)

Solution (Python):
a, b, c, k = map(int, input().split())
print(b - a if k % 2 else a - b)

Solution (Python):
a,b,c,d=map(int,input().split())
if abs(a-b)>100000000000000000:
	print("Unfair")
elif d%2==0 and abs(a-b)<=1000000000000000000:
    print(a-b)
else:
    print(b-a)

Solution (Python):
A,B,C,K = map(int,input().split())


if K % 2 == 1:

    print (B-A)

else:

    print (A-B)

Solution (Python):
a,b,c,k=map(int,input().split())
print(a-b if k%2==0 else b-a)

Solution (Python):
A,B,C,K=map(int,input().split());print((A-B)*(-1)**K)

Solution (Python):
A, B, C, K = map(int, input().split())
num = 10**18

if K % 2 == 0:
    ans = A - B
else:
    ans = B - A

if ans > num:
    print('Unfair')
else:
    print(ans)

Solution (Python):
A,B,C,K=map(int,input().split())

if K%2:
  ans=B-A
else:
  ans=A-B
print(ans if abs(ans)<=10**18 else "Unfair")

Solution (Python):
a, b, c, k = map(int, input().split())

ans = a-b if k%2 == 0 else b-a
print("Unfair" if abs(ans) >= 10**18 else ans)

Solution (Python):
A, B, C, K = map(int, input().split())
if K%2 == 0:
  r = A-B
else:
  r = B-A
print(r)

Solution (Python):
A, B, C, K = list(map(int, input().split()))
if abs(A - B) > 10**18:
    print("Unfair")
else:
    if K % 2 == 0:
        print(A - B)
    else:
        print(B - A)

Solution (Python):
A, B, C, K = map(int, input().split())

ans = (-1)**(K % 2) * (A - B)
print(ans)

Solution (Python):
A,B,C,K=map(int,input().split())

if K%2==0:
    print(A-B)
else:
    print(B-A)

Solution (Python):
a,b,c,k=map(int,input().split())

if k%2==1:
  print(b-a)
else:
  print(-(b-a))

Solution (Python):
A, B, C, K = map(int, input().split())

if K % 2:
    print(B-A)
else:
    print(A-B)

Solution (Python):
A,B,C,K=list(map(int,input().split()))
print(A-B if K%2==0 else B-A)

Solution (Python):
a, b, c, k = map(int, input().split())
if abs(a - b) > 10**18:
  print("Unfair")
else:
  if k % 2 == 0:
    print(a - b)
  else:
    print(b - a)

Solution (Python):
a,b,c,k=map(int,input().split())
if k%2==0:
    ans=a-b
else:
    ans=b-a
if abs(ans)>=10**18:
    ans="Unfair"
print(ans)

Solution (Python):
a,b,c,k = map(int,input().split())
if k % 2 == 0:
         print(a-b)
else:
         print(b-a)

Solution (Python):
def main():
    A, B, C, K = map(int, input().split())
    if K % 2 == 0:
        print(A-B)
    else:
        print(B-A)


if __name__ == "__main__":
    main()

Solution (Python):



import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a,b,c,k = LI()
if k % 2:
    print(b-a)
else:
    print(a-b)

Solution (Python):
A, B, C, K = map(int, input().split())
if K % 2 == 0:
    print(A-B)
else:
    print(B-A)

Solution (Python):
A, B, C, K = map(int, input().split())
print(A - B if K % 2 == 0 else B - A)

Solution (Python):
A,B,C,K=map(int,input().split())
if K%2==0:
  ans=A-B
else:
  ans=B-A
if abs(ans)>=1000000000000000000:
  print("Unfair")
else:
  print(ans)

Solution (Python):


import sys




tmp = input().split()
a,b,c,k = list(map(lambda a: int(a), tmp))

if(k%2==1):
	print(b-a)
else:
	print(a-b)

Solution (Python):
inputs = [int(c) for c in input().split()]
ans = inputs[0] - inputs[1] if inputs[3] % 2 == 0 else inputs[1] - inputs[0]
if ans > 10**18:
  print("Unfair")
else:
  print(ans)

Solution (Python):
a,b,c,k=map(int,input().split())
if k%2==0:
  print(a-b)
else:
  print(b-a)

Solution (Python):
def main():
    A, B, C, K = map(int, input().split())
    if K % 2 == 0:
        return A - B
    else:
        return B - A

if __name__ == '__main__':
    print(main())

Solution (Python):
A, B, C, K = map(int,input().split())

if K % 2 == 1:
    ans = B - A
else:
    ans = A - B

if abs(ans) > 10 ** 18:
    print("Unfair")
else:
    print(ans)

Solution (Python):
a,b,c,k=map(int,input().split())
if k%2==0:
    print(a-b)
else:
    print(b-a)

Solution (Python):

import sys, math, fractions, itertools, collections, copy, heapq


def solve(A: int, B: int, C: int, K: int):
    if K % 2 == 0:
        print(A - B)
    else:
        print(B-A)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    K = int(next(tokens))  
    solve(A, B, C, K)

if __name__ == '__main__':
    main()

Solution (Python):
a,b,c,k=map(int,input().split())
if k%2==0:
	print(a-b)
else:
	print(b-a)

Solution (Python):



import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a,b,c,k = LI()
s,t,u = b+c,a+c,a+b
x,y,z = t+u,s+u,s+t
if k % 2:
    print(s-t)
else:
    print(x-y)

Solution (Python):
A, B, C, K = map(int, input().split())

if K % 2 == 0:
    ans = A - B
else:
    ans = B - A

print (ans)

Solution (Python):
def main():
    A, B, C, K = map(int, input().split())
    if K&1 == 0:
        print(A-B)
    else:
        print(B-A)

if __name__ == "__main__":
    main()

Solution (Python):
a,b,c,k= map(int,input().split())
if k%2 == 0:
    print(a-b)
else:
    print(b-a)

Solution (Python):
A,B,C,K = map(int,input().split())

if K%2 == 0:
    ans = A-B
    print(ans) if abs(ans)<10**18 else print("Unfair")
else:
    ans = B-A
    print(ans) if abs(ans)<10**18 else print("Unfair")

Solution (Python):
A, B, C, K = [int(s) for s in input().split(' ')]
n = K % 2
ANS = (A-B) * (-1) ** n
print(ANS)

Solution (Python):


a, b, c, k = map(int, input().split())
if k % 2 == 0:
    print(a - b)
else:
    print(b - a)

Solution (Python):
a, b, c, k = map(int, input().split())
if abs(a-b) > 10**18:
    print('Unfair')
    exit()
if k % 2 == 0:
    print(a-b)
else:
    print((a-b)*(-1))

Solution (Python):
A, B, C, K = map(int, input().split())

if K % 2 == 0:
    print(A - B)
else:
    print(B - A)

Solution (Python):
import sys
input = sys.stdin.readline

L = [int(v) for v in input().split()]

if L[3] % 2 == 0:
    print(L[0] - L[1])
else:
    print(L[1] - L[0])

Solution (Python):
A,B,C,K = [int(x) for x in input().split()]
if(K%2==0):
    print(A-B)
else:
    print(B-A)

Solution (Python):
import sys
input=sys.stdin.readline

a,b,c,k = map(int, input().split())

if k % 2 == 0:
    ans = a-b
else:
    ans = b-a

if abs(ans) > 10**18:
    print("Unfair")
else:
    print(ans)

Solution (Python):
A, B, C, K = map(int, input().split())

if K % 2 == 0:
  ans = A - B
else:
  ans = B - A
  
if abs(ans) <= 10 ** 18:
  print(ans)
else:
  print("Unfair")

Solution (Python):
A, B, C, K = map(int, input().split())

if K % 2 == 0:
    print(A - B)
else:
    print(B - A)

Solution (Python):
A, B, C, K = map(int, input().split())
print(B-A if K%2 else A-B)

Solution (Python):
A, B, C, K = map(int, input().split())
if K%2 == 1:
    a = B - A
else:
    a = A - B
if abs(a) > 10**18:
    print('Unfair')
else:
    print(a)

Solution (Python):
A,B,C,K=map(int,input().split())
print(A-B if K%2==0 else B-A)

Solution (Python):
a,b,c,k=map(int,input().split())
print(((-1)**k)*(a-b))

Solution (Python):
A,B,C,K=map(int,input().split())
if abs(A-B)>10**18:print("Unfair")
else:
    if K%2==0:
        print(A-B)
    else:
        print(B-A)

Solution (Python):
a, b, c, k = map(int, input().split())
if k % 2 == 0:
    ans = a -b 
else:
    ans = b - a

if abs(ans) >= 10**18:
    ans = 'Unfair'
else:
    ans = ans 

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

"""
a,b,c -> b+c,a+c,a+b
a-b,b-c,c-a -> b-a,c-b,a-c
"""

A,B,C,K = map(int,input().split())
x = A - B
if K&1:
    x = -x
print(x)

Solution (Python):
a, b, c, k = map(int, input().split())
if k % 2 == 0:
  t = a - b
else:
  t = b -a
if t > 10 ** 18:
  print('Unfair')
else:
  print(t)

Solution (Python):
a,b,_,k=map(int,input().split());print((a-b,b-a)[k%2])

Solution (Python):
A,B,C,K=map(int,input().split())
ans=(A-B)*(-1)**K
print(ans)

Solution (Python):
a, b, c, k = map(int, input().split())

if k % 2 == 0:
  print(a-b)
else:
  print(-(a-b))

Solution (Python):
a,b,c,k=map(int,input().split())
t=-1
if k%2==0:t=1
print(t*(a-b))

Solution (Python):
A, B, C, K = map(int, input().split())
if abs(A-B) > 10**18:
    print('Unfair')
elif K % 2:
    print(B-A)
else:
    print(A-B)

Solution (Python):



a, b, c, k = input().split()
a, b, c = map(int, [a, b, c])
if int(k[-1])%2==0:
  print(a-b)
else:
  print(b-a)

Solution (Python):
a,b,c,k = map(int,input().split())
s = 1 if k % 2 == 0 else -1
print((a-b)*s)

Solution (Python):

def main():
    
    a, b, c, k = tuple(map(int, input().rstrip().split()))
    ans = a - b if k % 2 == 0 else -a + b
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    
    a, b, c, k = tuple(map(int, input().rstrip().split()))
    ans = a - b if k % 2 == 0 else -a + b
    flg = ans <= 10 ** 18
    print(ans if flg else "Unfair")


if __name__ == "__main__":
    main()

Solution (Python):
import copy
import sys
import math

def main():
	a,b,c,k = map(int,input().split())
	if(abs(a-b)>=10**18):
		print('Unfair')
		sys.exit()
	if(k%2==0):
		print(a-b)
	else:
		print(b-a)


def listtodict(a):
	b = {}
	for i in a:
		try:
			b[i] += 1
		except:
			b[i] = 1
	return b

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

main()

Solution (Python):

if __name__ == "__main__":
    a,b,c,k = map(int,input().split())
    if k%2 == 0:
        if abs(a-b)>10**18:
            print("Unfair")
        else:
            print(a-b)
    else:
        if abs(a-b)>10**18:
            print("Unfair")
        else:
            print(b-a)

Solution (Python):
A,B,C,K=map(int,input().split())
if K%2==0:
    print(A-B)
else:
    print(B-A)

Solution (Python):
a,b,c,k=map(int,input().split())
if k%2==0:
  print(a-b)
else:
  print(b-a)

Solution (Python):
A,B,C,K=map(int,input().split())
if abs(A-B)>10**18:
    print('Unfair')
    exit()
print((A-B)*(-1)**K)

Solution (Python):

a,b,c,k=map(int,input().split())
if k%2==0:ans=a-b
else:ans=b-a

if abs(ans)>10**18:ans='Unfair'
print(ans)

Solution (Python):
A,B,C,K = map(int, input().split())

if K % 2 == 0:
    print(A-B)
else:
    print(B-A)

Solution (Python):
a,b,c,k=[int(i) for i in input().split()]
if k%2==0:
    print(a-b)
else:
    print(b-a)

Solution (Python):
a,b,c,k = map(int, input().split())
if k % 2:
  print(b - a)
else:
  print(a - b)

Solution (Python):

from collections import defaultdict, deque
import math
from math import factorial
import fractions
import re

BIGNUM = 10 ** 9 + 7

def main():
    A, B, C, K = map(int, input().split())

    if abs(K) > 10 ** 18:
        print("Unfair")
        return

    if K % 2 == 0:
        print(A - B)
    else:
        print(B - A)


if __name__ == '__main__':
    main()

Solution (Python):
a, b, c, k = map(int, input().split())
"""
for i in range(k):
  a2 = b + c
  b2 = c + a
  c2 = a + b
  a = a2
  b = b2
  c = c2
if pow((a-b)**2,1/2) >= 10**18:
  print("Unfair")
else:
  print(a-b)
"""
if abs(a-b) >= 10**18:
  print("Unfair")
else:
  if k%2==1:
    print(b-a)
  else:
    print(a-b)

Solution (Python):
a,b,c,k=map(int,input().split())
print((a-b)*((-1)**(k%2)))

Solution (Python):
import numpy as np

A ,B ,C, K = map(int, input().split())

q0 = np.matrix([A, B, C]).T
mat = np.matrix([[0, 1, 1], [1, 0, 1], [1, 1, 0]])

q1 = mat**K * q0
ans = q1[0, 0] - q1[1, 0]
if ans > 1E18:
    print('Unfair')
else:
    print(ans)

Solution (Python):
a, b, c, k = [ int(v) for v in input().split() ]

if k % 2 == 0:
  ans = a - b
else:
  ans = b - a
print(ans)

Solution (Python):
a,b,c,k=map(int,input().split())
if k%2==0:n=a-b
else:n=b-a
if n>10**18:print("Unfair")
else:print(n)

Solution (Python):
A,B,C,K = map(int,input().split())
print((A-B)*((-1)**(K%2)))

Solution (Python):
a,b,c,k=map(int,input().split())
if k%2==0:
    ans=a-b
else:
    ans=b-a
print(ans)

Solution (Python):
a,b,c,k = map(int,input().split())
if k%2==0:
    print(a-b)
else:
    print(b-a)

Solution (Python):
A,B,C,K = list(map(int,input().split(" ")))

if abs(A-B) > 10 ** 18:
    print("Unfair")
elif K % 2 == 0:
    print(A-B)
else:
    print(B-A)

Solution (Python):
a, b, c, k = map(int, input().split())
print((a-b)*(-1)**k)

Solution (Python):
A, B, C, K = map(int, input().split())
print((A - B) * ( -1) ** K)

Solution (Python):


a, b, c, k = map(int, input().split())


if k % 2 == 0:
    print(a-b)
else:
    print(b-a)

Solution (Python):
from sys import stdin
A, B, C, K = [int(x) for x in stdin.readline().rstrip().split()]

ans = 0

if K % 2 == 0:
    ans = A - B
else:
    ans = B - A

if ans > 10**18:
    print("Unfair")
else:
    print(ans)

Solution (Python):

import sys


def solve(A: int, B: int, C: int, K: int):
    if(K%2 == 0):
        print(A-B)
    else:
        print(B-A)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    K = int(next(tokens))  
    solve(A, B, C, K)

if __name__ == '__main__':
    main()

Solution (Python):
a,b,c,k=map(int,input().split());print((-1)**(k%2==0)*(b-a))

Solution (Python):
a,b,c,k=map(int,input().split())
print((-1)**(k%2==0)*(b-a))