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())
ret = a-b
if k%2 == 1:
    ret = b-a
if abs(ret) > pow(10,18):
    print("unfair")
else:
    print(ret)

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

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

if abs(ans)>1e18:
    print('Unfair')
else:
    print(ans)

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

limit = 10**18

if abs(a - b) > limit:
    print('Unfair')
else:
    print((a - b) if k % 2 == 0 else (b - a))

Solution (Python):

A, B, C, K = map(int,input().split())
for i in range(K % 2):
    a = A
    b = B
    c = C

    A = b + c
    B = a + c
    C = a + b

    if abs(A - B) >= 10**18:
        print('Unfair')
        exit()

print(A-B)

Solution (Python):
a, b, c, k = [int(x) for x in input().split()]
amari = k % 2

if amari == 0:
    X = a-b
    if abs(X) > 10**18:
        print('Unfair')
    else:
        print(X)

else:
    X = b-a
    if abs(X) > 10**18:
        print('Unfair')
    else:
        print(X)

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())
s = b-a
if (k%2 == 0):
    s *= -1
print(s)

Solution (Python):
import sys,collections,random,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

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

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

ans = a - b

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

Solution (Python):
li = list(map(int,input().split()))	
 
if li[3]%2 == 1:
    print(li[1]-li[0])
else:
    print(li[0]-li[1])

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

Solution (Python):


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

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

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

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

main()

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

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 = list(map(int, input().split(" ")))

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

Solution (Python):
A, B, C, K = [int(i) for i in input().split()]

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

Solution (Python):
a, b, c, k = list(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-2*(k%2))*(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,raw_input().split())
print (-1)**k*(a-b)

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

Solution (Python):
N = [int(i) for i in input().split()]
A = N[0]
B = N[1]
C = N[2]
K = N[3]

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())

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

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

print(ans)

Solution (Python):
def matmul(p, q):
    r = len(p)
    c = len(q[0])
    ret = []
    for i in range(r):
        row = []
        for j in range(c):
            v = 0
            for k in range(len(q)):
                v += p[i][k] * q[k][j]
            row.append(v)
        ret.append(row)
    return ret

def matpow(p, n):
    if n == 1:
        return p
    rsq = matpow(p, n // 2)
    rr = matmul(rsq, rsq)
    if n % 2 == 0:
        return rr
    else:
        return matmul(rr, p)


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


if __name__ == '__main__':
    main()

Solution (Python):
A, B, C, K = 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((1-2*(k%2))*(a-b))

Solution (Python):
import sys
A,B,C,K = map(int,input().split())
if K%2 == 0:
    if abs(A-B) >10**18:
        print("Unfair")
    else: 
        print(A-B)
elif K % 2 == 1:
    if abs(B-A) > 10**18:
        print("Unfair")
    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):


import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq





def solve(f):
    a, b, c, k = f.read_int_list()

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


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case 
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)

Solution (Python):


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

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

Solution (Python):
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))



def slv(A, B, C, K):
    ans = A - B if K % 2 == 0 else B - A
    if abs(ans) > 1e+18:
        return 'Unfair'
    return ans


def main():
    A, B, C, K = read_int_n()

    print(slv(A, B, C, K))


if __name__ == '__main__':
    main()

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

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

inf=10**18

diff=a-b
if k%2:
    diff=-diff
print diff

Solution (Python):


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

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

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

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 == 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):
  print(a-b)
else:
  print(b-a)

Solution (Python):
line = input().split()

A = int( line[0] )
B = int( line[1] )
C = int( line[2] )
K = int( line[3] )

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

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

print ((-1)**(k%2)*(a-b))

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

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

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

Solution (Python):
from sys import stdin


def main():
    A, B, C, K = [int(x) for x in stdin.readline().rstrip().split()]
    a = B + C
    b = C + A
    c = A + B

    ans = a - b if K % 2 else A - B 
    print('Unfair' if ans > 10 ** 18 else ans)


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):
A, B, C, K = list(map(int, input().split()))

def solve():
    ans = int((A-B)*(-1)**(K))
    if ans <= 1000000000000000000:
        print(ans)
    else:
        print('Unfair')


if __name__ == '__main__':
    solve()

Solution (Python):
A, B, C, K = [int(i) for i in input().split()]
sup = 10 ** 18

ans = A - B
if not (K == 0 or K % 2 == 0):
    ans *= -1

if abs(ans) >= sup:
    ans = 'Unfair'

print(ans)

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

sign = 1
if K%2 == 1:
    sign = -1

print(sign*(A-B))

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

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

if abs(U) > 1000000000000000000:
	print('Unfair')
else:
	print(U)

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

Solution (Python):
A,B,C,K = map(int, raw_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(A-B)

Solution (Python):
list=input().rstrip().split() 
A=int(list[0])
B=int(list[1])
C=int(list[2])
K=int(list[3])
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")
else:
    if k % 2==1:
        print(b-a)
    else:
        print(a-b)

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

    print(dif*(-1)**(k%2))


if __name__ == '__main__':
    main()

Solution (Python):


import os
import sys
import math
import numpy as np


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

    ans = a - b

    if k % 2 == 1:
        ans *= -1

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

    

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
def main():
    A,B,C,K = map(int, input().split())
    if K%2==0:
        if abs(A-B)>10e18:
            return "Unfair"
        else:
            return A-B
    else:
        if abs(A-B)>10e18:
            return "Unfair"
        else:
            return -A+B

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

Solution (Python):
a = list(map(int, input().split()))
if a[3] % 2 == 1:
    gap = a[1] - a[0]
else:
    gap = a[0] - a[1]
if gap > 10 ** 18:
    print("Unfair")
else:
    print(gap)

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 = [int(i) for i in 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())

print((-1)**(k % 2) * (a - b))

Solution (Python):
a,b,c,k=map(int, input().split())
j=0
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:
    value = A - B
    if abs(value) >= 10**18:
        print("Unfair")
    else:
        print(value)
    
else:
    value = B - A
    if abs(value) >= 10**18:
        print("Unfair")
    else:
        print(value)

Solution (Python):
A,B,C,K = map(int, raw_input().split())
  
if abs(A-B) >= 1e18:
    print('Unfair')
if K%2 == 0:
    print(A-B)
else:
    print(B-A)

Solution (Python):



def main():
	a, b, c, k = list(map(int, input().split()))
	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())

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

Solution (Python):


import math
import sys
import itertools
import numpy as np


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

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

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

Solution (Python):
def solve0(A, B, C, K):
    for i in range(K):
        A, B, C = B + C, A + C, A + B
    return A - B

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

A, B, C, K = [int(_) for _ in input().split()]

print(solve(A, B, C, 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 k % 2:
  print(b - a)
else:
  print(a - b)

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

Solution (Python):
(a, b, c, k) = list(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())

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

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

ans = (A - B) * ((-1) ** K)

if -(10 ** 18) < ans < 10 ** 18:
    print((A - B) * ((-1) ** K))
else:
    print('Unfair')

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

ans = a - b
if k & 1:
 ans *= -1

print(ans)

Solution (Python):
import math
a,b,c,k=raw_input('').split()
a=int(a)
b=int(b)
c=int(c)
k=int(k)
mx=int(1e18)

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

if abs(ans)>mx:
    print 'Unfair'
else:
    print ans

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

Solution (Python):

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

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

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

Solution (Python):
exec("def nWord(): nWord.cache = raw_input() if not hasattr(nWord, 'cache') or nWord.cache=='' else nWord.cache ; pos = nWord.cache.find(nWord.sep) ; ret, nWord.cache = (nWord.cache, '') if pos==-1 else (nWord.cache[:pos], nWord.cache[pos+1:].lstrip(nWord.sep)) ; return ret") ; exec("nWord.sep = ' '") ; exec("def ___nLine2(): ret, nWord.cache = (raw_input(), nWord.cache if hasattr(nWord, 'cache') else '') if not hasattr(nWord, 'cache') or nWord.cache=='' else (nWord.cache, '') ; return ret") ; exec('def nInt(): return int(nWord())') ; exec('def nFloat(): return float(nWord())') ; exec("def ___nAuto2():\n ret = nWord()\n try: return int(ret)\n except: pass\n try: return float(ret)\n except: return ret") ; exec("def nAuto(n=None): return ___nAuto2() if n is None else [___nAuto2() for i in range(n)]") ; exec("def nLine(n=None): return ___nLine2() if n is None else [___nLine2() for i in range(n)]")

import itertools

A, B, C, K = nAuto(4)

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(A-B)

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 = list(map(int, input().split()))
if abs(a - b) > 1e18:
    print('Unfair')
elif k % 2:
    print(b - a)
else:
    print(a - b)

Solution (Python):
a,b,c,k=[int(x) for x in raw_input().split()]
ans=(a-b)*((-1)**k)
if abs(ans)>10**18:
    print "Unfair"
else:
    print ans

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

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

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

Solution (Python):


def main():
    a, b, _, k = map(int, input().split())
    ans = (a - b) * (-1) ** k
    if abs(ans) > 10**18:
        print('Unfair')
    else:
        print(ans)


if __name__ == '__main__':
    main()

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())
p = a - b
if k % 2 == 1:
    print(-p)
else:
    print(p)

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 = [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):
A, B, C, K = [int(a) for a in input().split()]
ans = (A-B) * ((-1) **(K % 2))

print(str(ans))

Solution (Python):
















import sys

input=sys.stdin.readline

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

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

Solution (Python):

import numpy as np

a,b,c,k = map(int,raw_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):


x,y,z,k = map(int,input().split())

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

Solution (Python):
from copy import deepcopy
import itertools


def read():
    return int(input())


def readmap():
    return map(int, input().split())


def readlist():
    return list(map(int, input().split()))


a, b, c, k = readmap()

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

Solution (Python):
a,b,c,k=map(int,input().split())
a2=b+c
b2=a+c
c2=a+b
if(k%2==0):
    if(a-b<10**18):
        print(a-b)
    else:
        print("Unfair")
else:
    if(a2-b2<10**18):
        print(a2-b2)
    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())
M=K%2
print((A-B)*(-1)**(M))

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:
    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):
from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

(A, B, C, K) = reads()

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