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 = [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())
a,b,c
b+c,a+c,a+b
if k%2!=0:
    print(b-a)
else:
    print(a-b)

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

if abs(a-b) > 10**18:
    ans='Unfair'
else:
    if k%2==1:
        ans=b-a
    else:
        ans=a-b
print(ans)

Solution (Python):
import numpy as np

def main():
    A, B, C, K = map(int, input().split())
    if K == 0:
        print(A-B)
        return
    base = np.matrix([[0, 1, 1], [1, 0, 1], [1 ,1 ,0]])
    X = base ** K
    result = np.matrix([[A, B, C]]) \
        .dot(X) \
        .dot(np.matrix([[1], [-1], [0]]))
    ans = result[0, 0]
    if 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())
print(A - B if K % 2 == 0 else B - A)

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

Solution (Python):
a, b, c, k = map(int, input().split())
print(a-b if k % 2 == 0 else 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 ans >= 10**18:
    ans = 'Unfair'
print(ans)

Solution (Python):

"""
A - Fairness
https://atcoder.jp/contests/agc024/tasks/agc024_a

"""
import sys


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


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


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
a,b,c,K=map(int,input().split())
m=a+b+c
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:
    ans = a-b
else:
    ans = b-a

if 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('Unfair')
else:
     print(ans)

Solution (Python):
A,B,C,K=map(int,input().split())
if abs(A-B)>1e18:
    print('Unfair')
    quit()
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 ans > 10 ** 18:
    ans = 'Unfair'

print(ans)

Solution (Python):




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

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

if ans > 10 ** 18:
    ans = "Unfair"


print(ans)

Solution (Python):
num_1 , num_2 , num_3, loops = input().split()
num_1 = int(num_1)
num_2 = int(num_2)
num_3 = int(num_3)
loops = int(loops)

if abs(num_1 - num_2) > (10**18):
    print('Unfair')

elif (loops % 2) == 0:
    print(num_1 - num_2)

elif (loops % 2) == 1:
    print(num_2 - num_1)

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

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 = [int(item) for item in 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())
ans = A-B
if abs(ans) > 10**18:
    print('Unfair')
elif K%2 == 0:
    print(ans)
else:
    print(-ans)

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

Solution (Python):
A, B, C, K = map(int, input().split())
  
ans = [A - B, B - A][K%2]
if ans > 1e18:
  print("Unfair")
else:
  print(ans)

Solution (Python):
a, b, c, k = map(int, input().split())
if abs((a-b)*(-1)**k) > 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())
print(B-A if K % 2 else A-B)

Solution (Python):
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy

def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)



a,b,c,k= (int(i) for i in input().split())       








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

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

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

Solution (Python):
A, B, C, K = [int(i) for i in 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())

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:
    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:
    
    ans = a - b
else:
    ans = b - a
if ans < 10 ** 18:
    print(ans)
else:
    print("Unfair")

Solution (Python):
A,B,_,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()))

print((b - a) * (-1) ** (k + 1))

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

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

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 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 = map(int,input().split())
if abs(a-b) < 10**18:
    if k%2==1:
        print(b-a)
    else:
        print(a-b)
else:
    print("unfair")

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

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

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

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

res = A - B

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

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())
if k%2 == 0:
    ans = a-b
else:
    ans = b-a
if ans > 10**18:
    print("Unfair")
else:
    print(ans)

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 = (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())
maxans = pow(10, 18)

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

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):
import sys
input = sys.stdin.readline

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

print(ans if abs(ans) <= 10**18 else 'Unfair')

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):
a,b,c,k = map(int,input().split())
if k%2==1:
    print(b-a)
else:
    print(a-b)

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

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

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())
print(B-A if K%2 else A-B)

Solution (Python):


import sys

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    a, b, c, k = LI()

    return b - a if k % 2 else a - b


print(main())

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

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

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

res = 'Unfair'
if K % 2 == 0:
    if abs(a - b) <= 10 ** 18:
        res = a - b
else:
    if abs(a - b) <= 10 ** 18:
        res = b - a
print(res)

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

if abs(a-b)>1000000000000000000:
    print("Unfair")
elif 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:
  A,B,C = B+C, A+C, A+B
  ans =  (A-B)

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

Solution (Python):
a,b,c,k=(int(i) for i in input().split())
def ans(x):
  if abs(x)>=10e18:
    return 'Unfair'
  else:
    return x
if k%2==0:
  print(ans(a-b))
else:
  print(ans(b-a))

Solution (Python):
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [A, B, C, K] = [long(input_raw[0]), long(input_raw[1]), long(input_raw[2]), long(input_raw[3])]
    print ((-1) ** (K%2)) *  (A - B)

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, _, k = map(int, input().split())
if k%2:
  print(b-a)
else:
  print(a-b)

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

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

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

print(a-b if k % 2 == 0 else 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())
print(A-B if K%2==0 else B-A)

Solution (Python):
a,b,c,k = (int(i) for i in 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())

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

print(ans)

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

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

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

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:
    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=list(map(int,input().split()))
    if(k%2==0):
        ans=a-b
    else:
        ans=b-a
    if(ans>10**18):
        print("Infinity")
        return;
    print(ans)

if __name__=="__main__":
    main()

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(-(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(B - A if K % 2 else A - B)

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())
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 K%2==0 else B-A

print(ans)

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

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

ans = a - b
if k % 2 == 1:
    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')
else:
  print((A -B)*(-1)**K)

Solution (Python):
import itertools
import numpy as np
import sys
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

A,B,C,K = IL()

if K%2==0:
    if abs(A-B) <= int(10e10):
        print(A-B)
    else:
        print("Unfair")
else:
    if abs(B-A) <= int(10e10):
        print(B-A)
    else:
        print("Unfair")

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

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

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

for i in range(1):
    tmp1 = A
    tmp2 = B
    tmp3 = C
    A = tmp2 + tmp3
    B = tmp1 + tmp3
    C = tmp1 + tmp2
 
if A - B > 10 ** 18:
    print('Unfair')
else:
    if K%2 == 0:
        print((-1)*(A - B))
    else:
        print(A - B)

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

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

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

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

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

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

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

if __name__ == "__main__":
    A, B, C, K = tuple(map(int, 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):
abck = list(map(int,input().split()))
a=abck[0]
b=abck[1]
c=abck[2]
k=abck[3]
if k%2 ==0:
    ans = a-b
else:
    ans = b-a
if ans > 10**18:
    print('Unfair')
else:
    print(ans)

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

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

print([a-b,b-a][k%2])

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

s_abc = A+B+C


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

print(ans)

Solution (Python):


import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, initial=1)
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

a, b, c, K = MAP()





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

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

Solution (Python):
A, B, _, 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:
    print(a - b)
else:
    print(b - a)

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

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

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:
    ans = A-B
else:
    ans = B-A
print(ans)

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

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

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

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

'''
A, B, C
1: B+C, A+C, A+B, -A+B
2: 2A+B+C, A+2B+C, A+B+2C, A-B
3: 2A+3B+3C, 3A+2B+3C, 3A+3B+2C, -A+B
4: 6A+5B+5C, 5A+6B+5C, 5A+5B+6C, A-B
5: 10A+11B+11C, 11A+10B+11C, 11A+11B+10C, -A+B
6: 22A+21B+21C, 21A+22B+21C, 21A+21B+22C, A-B
'''

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((a-b)*(-1)**k)

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

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

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

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

Solution (Python):
inputs = list(map(int, input().split()))
K = inputs.pop()

ans = inputs[0] - inputs[1]

print(-1 if abs(ans) > 10 ** 18 else ans * ((-1)**K))

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

Solution (Python):
a, b, c, k = map(int, input().split())
if a - b > 1e18 or b - a > 1e18:
    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())

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

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

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

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())
if K%2:
    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(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 abs(a-b) > 1000000000000000000:
    print('Unfair')
elif a == b:
    print(0)
elif k % 2 == 0:
    print(a-b)
elif k % 2 == 1:
    print(b-a)

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

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

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

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

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

Solution (Python):
import sys


def next_str() -> str:
    result = ""
    while True:
        tmp = sys.stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


def next_int() -> int:
    return int(next_str())


def main() -> None:
    a, b, c, k = [next_int() for _ in range(4)]
    print((a - b) * ((-1) ** k))


if __name__ == '__main__':
    main()

Solution (Python):
def inpl(): return [int(i) for i in input().split()]

A, B, C, K = inpl()
print((A-B)*(-1)**(K))

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

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

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

if(k%2==0):
  if abs(a-b)<10**18:
    print(a-b)
  else:
    print("Unfair")
else:
  if abs(a-b)<10**18:
    print(b-a)
  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())
if K % 2 == 1:
    ans = B - A
elif K % 2 == 0:
    ans = A- B 
if ans <= 10**18:
    print(ans)
else:
    print("Unfair")

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

Solution (Python):

from sys import stdin

s_in = lambda: stdin.readline()[:-1] 
d_in = lambda: int(stdin.readline()) 
ds_in = lambda: list(map(int, stdin.readline().split())) 

A, B, C, K = ds_in()


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

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

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

print(X)

Solution (Python):


import sys


input = sys.stdin.readline
INF = float('inf')


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


A, B, C, K = inpl()

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

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) < 10**18:
    print(ans)
else:
    print("Unfair")

Solution (Python):
a, b, _, k = [int(x) for x in input().strip().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):
A,B,C,K=map(int, input().split())
if abs(B-A)<10**18:
    print(B-A if K%2 else A-B)
else:
    print('unfair')

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

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


def main():
    a, b, c, k = map(int, input().split())
    if abs(a - b) > 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());print((A-B)*(-1)**K)

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

Solution (Python):
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 == 1:
    if b - a > 10 ** 18:
        print("Unfair")
    else:
        print(b - a)
else:
    if a - b > 10 ** 18:
        print("Unfair")
    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())
ans = B - A if K % 2 else A - B
if abs(ans) > 10**18:
    print('Unfair')
else:
    print(ans)

Solution (Python):
list1 = list(map(int, input().split()))
a = list1[0]
b = list1[1]
c = list1[2]
k = list1[3]


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

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):
a,b,c,k = map(int,input().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):
def a_fairness(A, B, C, K):
    
    
    
    ans = A - B if K % 2 == 0 else B - A
    return ans

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

Solution (Python):
def iin(): return int(input())
def nl(): return list(map(int, input().split()))

a, b, c, k = nl()
abs_ans = a - b
print('Unfair' if abs_ans > 10 ** 18 else (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())
print((a-b)*(-1)**k)

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

Solution (Python):
a,b,c,k=map(int,input().split())
o=(-1)**(k%2)
d=o*(a-b)
if abs(d)<=1e18:
  print(d)
else:
  print("Unfair")

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(a-b if k%2 == 0 else b-a)

Solution (Python):
def main():
  t = input().split(" ")
  A, B, C , K = int(t[0]), int(t[1]), int(t[2]), int(t[3])
  if K % 2 == 0:
    s = 1
  else:
    s = -1
  r = s * (A-B)
  print(r)
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:
    print(a-b)
else:
    print(b-a)

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

Solution (Python):
s=input().split()
print((int(s[0])-int(s[1]))*(-1)**int(s[3]))

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());print((-1)**k*(a-b))

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

Solution (Python):
A, B, C, K = map(int, input().split())
THRES = 10 ** 18
UNFAIR = 'Unfair'


def bf():
    a, b, c = A, B, C
    for _ in range(K):
        a, b, c = b + c, c + a, a + b
    return a - b


def al():
    return (A - B) * ((-1) ** (K % 2))






ans2 = al()
ans2 = UNFAIR if abs(ans2) > THRES else ans2
print(ans2)

Solution (Python):
a, b, c, k = [int(i) for i in input().split(" ")]
if abs(a-b)>10**18:
    print('Unfair')
elif k & 1:
    print(b-a)
else:
    print(a-b)

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())
print((-1)**(k%2)*(a-b))

Solution (Python):




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

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

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