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):
CAP = 1000000000000000000

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

main()

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

unfair = 10**18

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

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

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

ans = A-B if K % 2 == 0 else B-A
print('Unfair' if abs(ans) > 1e18 else ans)

Solution (Python):
if __name__ == '__main__':
    inputList = input().split()

    A = int(inputList[0])
    B = int(inputList[1])
    C = int(inputList[2])
    K = int(inputList[3])
    limit = pow(10, 18)

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

    if result > limit:
        result = "Unfair"

    print(result)

Solution (Python):
n = list(map(int, input().split()))

if n[3]%2==1 :
    n[0]*=(-1)
else :
    n[1]*=(-1)
    

if n[0]+n[1] > 1000000000000000000 :
    print('Unfair')
else :
    print(n[0]+n[1])

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:
 if B-A>pow(10,18):
  print('Unfair')
  exit()
 print(B-A)
else:
 if A-B>pow(10,18):
  print('Unfair')
  exit()
 print(A-B)

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

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

else :
	print b - a if abs(a-b) < 10**18 else 'Unfair'

Solution (Python):


import sys, math, copy





HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

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

    su = a + b + c
    a += su * (k // 2)
    b += su * (k // 2)
    c += su * (k // 2)

    if k % 2 == 1:
        an = b + c
        bn = c + a
        cn = a + b
        a, b, c = an, bn, cn

    print(a - b if abs(a - b) <= 10 ** 18 else "Unfair")

main()

Solution (Python):
import sys

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

a = K % 2
res = (A - B)
if abs(res) > 10**18:
    print("unfair")
if a == 1:
    print(B - A)
elif a == 0:
    print(A - B)

Solution (Python):
import numpy as np

def solve(a, b, c, k):
    A = np.array([
            [0,1,1],
            [1,0,1],
            [1,1,0],
        ], dtype=np.int64)
    B = np.eye(3, dtype=np.int64)
    x = 0
    while k >= 2**x:
        if (k & (2**x)) > 0:
            B = np.dot(B, A)
        A = np.dot(A, A)
        x += 1
    a, b, c = np.dot(B, np.array([a,b,c]))
    ans = a - b
    if ans > 10**18:
        return "Unfair"
    else:
        return ans

assert solve(1,2,3,1) == 1
assert solve(2,3,2,0) == -1
assert solve(1000000000,1000000000,1000000000,1000000000000000000) == 0
a, b, c, k = map(int, raw_input().split())
print solve(a,b,c,k)

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

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

Solution (Python):
a, b, c, k = (int(i) for i in input().split())
if 1 == (k & 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(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())
if k % 2 == 0:
	print a - b
else:
	print b - a

Solution (Python):

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

Solution (Python):
a,b,c,n = map(int, input().split())
if a-b > 10**18:
    print("Unfair")
    exit()
if n%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:
	res = B - A
else:
	res = A - B
if res >= 10 ** 18:
	print("Unfair")
else:
	print(res)

Solution (Python):


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

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

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

print(ans)

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

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

diff = (a - b) * ((-1) ** k)

if diff > 1.0e18:
  print("Unfair")
else:
  print(diff)

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

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

Solution (Python):
A,B,C,K=map(int,input().split())
takahashi=A
nakahashi=B
teihashi=C
takahashi1=0
nakahashi1=0
teihashi1=0
unfair=False
if A==B and B==C:
    print("0")
else:
    if K%2==0:
        print(takahashi-nakahashi)
    else:
        print(-(takahashi-nakahashi))

Solution (Python):
input_nums = raw_input().split(' ')
A = int(input_nums[0])
B = int(input_nums[1])
C = int(input_nums[2])
K = int(input_nums[3])

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

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

Solution (Python):


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

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

Solution (Python):
import numpy as np

def ii():
    return int(input())


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


def lvi(N):
    l = []
    for _ in range(N):
        l.append(ii())
    return l


def lv(N):
    l = []
    for _ in range(N):
        l.append(input())
    return l


A, B, C, K = lii()
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 > 0:
    if K % 2 == 0:
        ans = A - B
    else:
        ans = B - A
else:
    ans = A - B
print(ans if ans <= 1e18 else 'Unfair')

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

q = n // 3
r = n % 3

def answer(q,r):
	if abs(a-b) > 10**18:
		return 'Unfair'

	if r == 0:
		if q%2 != 0:
			return b-a
		else:
			return a-b
	elif r == 1:
		if q%2 != 0:
			return a-b
		else:
			return b-a
	else:
		if q%2 != 0:
			return b-a
		else:
			return a-b

print(answer(q,r))

Solution (Python):


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

Solution (Python):



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

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

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

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

if K%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 = list(map(int, input().split()))
answer = (-1)**K * (A - B)
print(answer)

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

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

Solution (Python):






if __name__ == '__main__':
    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())

def judge(n):
    if abs(n) > 10**18:
        print('Unfair')
    else:
        print(n)

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
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 LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    a,b,c,k = LI()
    if k % 2 == 0:
        return a-b
    return b-a



print(main())

Solution (Python):
from copy import deepcopy

def multiply(A, B):
	new_a = [[0 for i in range(len(B[0]))] for j in range(len(A))]

	for i in range(len(A)):
		for j in range(len(B[0])):
			for k in range(len(A[i])):
				new_a[i][j] += A[i][k] * B[k][j]

	return new_a

def exponentiate(table, times):
	new_table = deepcopy(table)
	identity = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]

	curr_pow = 1
	while curr_pow <= times:
		if curr_pow & times:
			identity = multiply(new_table, identity)

		new_table = multiply(new_table, new_table)
		curr_pow *= 2

	return identity

a, b, c, k = map(int, raw_input().split(' '))
table = [[0, 1, 1], [1, 0, 1], [1, 1, 0]]

table_expand = exponentiate(table, min(k, 16384 + k % 2))
resultant_array = multiply(table_expand, [[a], [b], [c]])

if abs(resultant_array[0][0] - resultant_array[1][0]) > 10**18:
	print 'Unfair'
else:
	print resultant_array[0][0] - resultant_array[1][0]

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

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

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

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

Solution (Python):
from collections import Counter

def getinputdata():

    
    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

a = int(arr_data[0][0])
b = int(arr_data[0][1])
c = int(arr_data[0][2])
k = int(arr_data[0][3])

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

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


sub = a - b

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

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

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

Solution (Python):
line = input().split(" ")
line = list(map(int, line))

ans = 0

if line[3] % 2 == 0:
    ans = line[0]-line[1]
else:
    ans = line[1]-line[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):
a,b,c,k=map(int,input().split())
if(k%2==0):
	x=a-b
	if(x>pow(10,18)):
		print('Unfair')
	else:
		print(x)
else:
	x=b-a
	if(x>pow(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(b-a)

Solution (Python):
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

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

if abs(A - B) > int(1e18):
    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:
        ans = B-A

print(ans)

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

if(a-b > 10**18):
	print('Unfair')
	exit()
print((a - b)*(k%2*-2+1))

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((A - B)*(-1)**(K % 2))

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

Solution (Python):


def fibonacci(n):
    f = [[1,1],[1,0]]
    if n==0:
        return 0
    f=power(n-1, f)
    return f[0][0]

def multiply(f, m):
    x = f[0][0]*m[0][0] + f[0][1]*m[1][0]
    y = f[0][0]*m[0][1] + f[0][1]*m[1][1]
    z = f[1][0]*m[0][0] + f[1][1]*m[1][0]
    w = f[1][0]*m[0][1] + f[1][1]*m[1][1]

    f[0][0] = x
    f[0][1] = y
    f[1][0] = z
    f[1][1] = w

    return f

def power(n, f):
    if n==0 or n==1:
        return f

    m = [[1,1], [1,0]]
    f=power(n//2, f)
    f=multiply(f,f)

    if n%2==1:
        f=multiply(f, m)

    return f

arr = [int(x) for x in input().split()]
a = int(arr[0])
b = int(arr[1])
c = int(arr[2])
k = int(arr[3])

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

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

Solution (Python):
from sys import stdin

def execute(a, b, c):
    return b+c, a+c, a+b


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

"""
for i in range(k):
    a, b, c = execute(a, b, c)

if a - b > 10e18:
    print('Unfair')
else:
    print(a-b)
"""

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

Solution (Python):
li_abck = list(int(i) for i in input().split())
k = li_abck[3]
ans = li_abck[0]-li_abck[1]
x=1

if li_abck[0]==li_abck[1]==li_abck[2]:
    print(0)
    x = 0
if x!=0:
    if k%2==0:
        print(ans)
    else:
        print(-ans)

Solution (Python):
da = list(map(int,input().split()))
 
m = 0
l = pow(10,18)
  
if da[3] % 2 == 1:
  k = da[1] -da[0]
else:
  k = da[0] -da[1]

if abs(da[0] - da[1]) <= l:
  print(k)
elif abs(da[0] - da[1]) > l:
  print("Unfair")

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

Solution (Python):
a, b, c, N = map(int, raw_input().split())

if N % 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,raw_input().split(' '))
if abs(a-b)> 10**18: print "Unfair"
elif k%2==0:
	print a-b
else:
	print b-a

Solution (Python):
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
[x,y,z,k]=i2()
if k%2==1:
   print(y-x)
else:
   print(x-y)

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

Solution (Python):
def main():
    a, b, c, k = input().split()
    a = int(a)
    b =int(b)
    c =int(c)
    k = int(k)
    
    if k == 0:
        print(a - b)
        return
    elif k == 1:
        print(b - a)
        return
    elif k == 2:
        print(a - b)
        return
    
    t = 1
    if k % 2 == 0:
        t = -1
    
    ans = t * (b - a)
    if abs(ans) > 10**18:
        print(Unfair)
    else:
        print(ans)
    
main()

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

Solution (Python):

from sys import stdin


def solve():
    a, b, c, k = map(int, stdin.readline().split())

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


solve()

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

if(abs(A-B)>=1.0e+18):
    print("Unfair")
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 = list(map(int,input().split()))
ans = 0
l = [0b11,0b101,0b110]
if k%2 == 1:
    ans = b -a
else:
    ans = a-b    
if abs(ans) > pow(10,18):
    ans = 'Unfair'
print(ans)

Solution (Python):
A, B, c, k = map(int, raw_input().split())
ans = 0
if k % 2 == 0:
 ans = A - B
else:
 ans = B - A

if ans <= 10**18:
 print ans
else:
 print 'Unfair'

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

if abs(d) < 10**18:
 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((a-b)*(-1))

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

Solution (Python):
CAP = 1000000000000000000

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

main()

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

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

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

main()

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):
import math
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())
ans = ((-1)**k) *(a-b)
print ans if abs(ans) <= 10**18 else 'Unfair'

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):
def main():
    [a, b, c, k] =[int(x) for x in input().split()]
    overflowk = 10 ** 18
    ansk = a - b
    if abs(ansk) > overflowk:
        print("Unfair")
    else:
        if (k % 2 != 0):
            ansk = -ansk
        print(ansk)
if __name__ == "__main__":
    main()

Solution (Python):


import os
import sys




def solution(x,y,z,k):
    
    
    
    if k % 2 == 0:
        return x-y
    else:
        return y-x

if __name__ == '__main__':
    inp = raw_input().split()


    result = solution(int(inp[0]),int(inp[1]),int(inp[2]),int(inp[3]))
    if result > 1000000000000000000:
        print ("Unfair")
    else:
        print (str(result))

Solution (Python):
a, b, c, k = map(int, raw_input().split())
sm = a - b

if k & 1:
	print -(sm)
else:
	print sm

Solution (Python):

"""
Created on Sun May 20 20:55:50 2018
AGC024A
@author: maezawa
"""

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

Solution (Python):
s = input().rstrip().split()
a = int(s[0])
b = int(s[1])
c = int(s[2])
k = int(s[3])

ans = a - b

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

if(abs(ans) < 1000000000000000000):
  print(ans)
else:
  print("Unfair")

Solution (Python):


input_line = input().split()

high_bridge = int(input_line[0])
mid_bridge = int(input_line[1])
low_bridge = int(input_line[2])
exec_times = int(input_line[3])

if abs(high_bridge - mid_bridge) > pow(10, 18):
    print("Unfair")
elif exec_times % 2 == 0:
    print(str(high_bridge - mid_bridge))
else:
    print(str(mid_bridge - high_bridge))

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

    
    f(A, B, C, K)


def f(A, B, C, K):
    """
    1: (A,B,C) = (    B  C,  A     C,  A  B   )
    2: (A,B,C) = (2A  B  C,  A 2B  C,  A  B 2C)
    3: (A,B,C) = (2A 3B 3C, 3A 2B 3C, 3A 3B 2C)
    4: (A,B,C) = (6A 5B 5C, 5A 6B 5C, 5A 5B 6C)
    """
    if A == B == C:
        print(0)
        return

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


def TLE(A, B, C, K):
    for i in range(K):
        bc = B + C
        ab = A + B
        ac = A + C
        print(A, B, C, bc, ab, ac, sep="\t")
        A = bc
        B = ac
        C = ab

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

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

Solution (Python):









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
























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

Solution (Python):
import sys
from sys import stdin, stdout

rem = 10 ** 9 + 7
sys.setrecursionlimit(10 ** 6)
take = lambda: map(int, stdin.readline().split())

a,b,c,k=take()
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 a - b > 10**18:
    print("Unfair")
elif k%2 == 1:
    print(b-a)
else:
    print(a-b)

Solution (Python):
import sys
if __name__ == "__main__":
    A, B, C, K = list(map(int, (input().split(' '))))

    if A == B:
        print(0)
        sys.exit()
    if abs(A-B) > pow(10, 18):
        print('Unfair')
        sys.exit()

    plus_flag = 1
    if A < B:
        plus_flag = 0
    if K % 2 == 1:
        if plus_flag == 1:
            plus_flag = 0
        else:
            plus_flag = 1
    if plus_flag == 1:
        print(abs(A-B))
    else:
        print(-abs(A-B))

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

abc = [int(inp[0]), int(inp[1]), int(inp[2])]
n = int(inp[3])

answer = (((n%2)*2)-1)*(abc[1]-abc[0])

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

else:
    print(answer)

Solution (Python):

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


def calcFairness(A, B, K):
    if abs(A - B) > 10 ** 18:
        return 'unfair'
    else:
        return ((-1) ** ( K % 2)) * (A - B)


print(calcFairness(A, B, K))

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

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

Solution (Python):

def inpl(): return map(int, input().split())
a, b, c, k = inpl()
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=input().split()
A=int(A)
B=int(B)
C=int(C)
K=int(K)
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 == 0:
    print(a-b)

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

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

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

print(ans)

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

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())
print((-1)**k*(a-b) if abs(a-b) <= 10**18 else "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)
elif K%2 == 1: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 = [int(i) for i 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()]

if k % 2 ==1:
  
  l=lambda x: -x
else:
  
  l=lambda x: x
if l(a)-l(b)>=10**18:
  print('Unfair')
else:
  print(int(l(a)-l(b)))

Solution (Python):
from sys import stdin
a,b,c,k = map(int,stdin.readline().split())
if k%2:
 print b-a
else:
 print a-b

Solution (Python):
import math

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

if k % 2 != 1:
    if a-b == 0:
        print(0)
    else:
        print(a - b if abs(math.log10(abs(a-b))) <= 18 else "Unfair")
else:
    if a-b == 0:
        print(0)
    else:
        print(b - a if abs(math.log10(abs(a-b))) <= 18 else "Unfair")

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

if k % 2 == 1:
    x = -a + b
    if abs(x) > 1e18:
        print("Unfair")
    else:
        print(x)
else:
    x = a - b
    if abs(x) > 1e18:
        print("Unfair")
    else:
        print(x)

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(long, raw_input().split())
if K % 2 == 1:
  print B-A
else:
  print A-B

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

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

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

tmp_A = B + C
tmp_B = A + C
if abs(tmp_A - tmp_B) > (10 ** 18):
    print('Unfair')
else:
    if K % 2 == 1:
        print(tmp_A - tmp_B)
    else:
        print(tmp_B - tmp_A)

Solution (Python):



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

if K < 2:
    for i in range(K):
        A, B, C = B + C, A + C, A + B
    ans = A - B

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

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

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

Solution (Python):
def fair(x, y):
  if abs(x-y)>10**18:
    return 'Unfair'
  else:
    return x-y

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

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

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

Solution (Python):
a,b,c,k = list(map(int,input().split()))
ta = tb = tc = 0
s = a+b+c
a = s*(k//4)+a
b = s*(k//4)+b
c = s*(k//4)+c
for i in range(k%4):
    ta = a
    tb = b
    tc = c
    a = tb+tc
    b = ta+tc
    c = ta+tb
print(a-b if abs(a-b) < 10**18 else 'Unfair')

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

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

if len(str(abs(result))) <= 18:
    print(result)
else:
    print("Unfair")

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

if abs(a - b) > 10 ** 18:
    print("Unfair")
else:
    print(num)

Solution (Python):
def main():
    A,B,C,K=[int(x) for x in input().split()]
    if abs(A-B)>10**18:
        print("Unfair")
    else:
        if K%2==0:
            print(A-B)
        else:
            print(B-A)

if __name__ == "__main__":
    main()

Solution (Python):

line = input()
line=line.rstrip().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())

if abs(a - b) <= pow(10,18):
  if k % 2 == 0:
    print(a-b)
  else:
    print(b-a)
else:
  print('Unfair')

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

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

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

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

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

print(ANS)