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):
import sys

def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))

def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]

def to_bin(x: int) -> str: return format(x, 'b') 
def to_oct(x: int) -> str: return format(x, 'o') 
def to_hex(x: int) -> str: return format(x, 'x') 
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]

from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left


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

init_ = a - b

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

Solution (Python):


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

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

Solution (Python):
import numpy as np
import sys

input = sys.stdin.readline

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


if K%2 == 1 and abs(B-A) < 1000000000000000000:
    print(B-A)
elif  K%2 == 0 and abs(A-B) < 1000000000000000000:
    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=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 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 = 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==0:
    print(a-b)
else:
    print(b-a)

Solution (Python):
A,B,C,K=list(map(str,input().split()))
if K[-1]=='0' or K[-1]=='2' or K[-1]=='4' or K[-1]=='6' or K[-1]=='8':
    ans=int(A)-int(B)
    if len(str(ans))>18:
        print('unfair')
    else:
        print(ans)
else:
    ans=int(B)-int(A)
    if len(str(ans))>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:
    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):
import sys
input=sys.stdin.buffer.readline
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())
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):
from statistics import median


from fractions import gcd
from itertools import combinations 
from collections import deque
from collections import defaultdict
import bisect










import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    a,b,c,k = readInts()
    a_ = b + c
    b_ = a + c
    ab = a_ - b_
    k = k % 2
    if ab >= 10**18:
        print("Unfair")
    else:
        if k == 0:
            print(a-b)
        else:
            print(ab*(-1)**(k+1))

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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


if __name__ == '__main__':
    resolve()

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 abs(b - a) > 10**18:
    print('Unfair')
elif 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:
	print(A - B)
else:
	print(B - A)

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

    
if ((-1)**k)*(a-b) <= 10 **18:
    print(((-1)**k)*(a-b) )
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 = A - B
n = B - A

if (K % 2 == 0):
    if m > 10**18:
        print('Unfair')
    print(m)
else:
    if (n > 10**18):
        print('Unfair')
    print(n)

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

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

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

if A == B == C:
    print(0)
elif K == 0:
    if A - B > 10e18:
        print('Unfair')
    else:
        print(A - B)
else: 
    if K % 2 == 0:
        a = K*A + (K-1)*(B+C)
        b = K*B + (K-1)*(A+C)
        c = K*C + (K-1)*(A+B)
    else:
        a = (K-1)*A + K*(B+C)
        b = (K-1)*B + K*(A+C)
        c = (K-1)*C + K*(A+B)
    
    if a - b > 10e18:
        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):
import sys
from collections import Counter
readline = sys.stdin.buffer.readline
MOD = 10**9+7

def main():
    A, B, C, K = map(int, readline().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())
K%=2
p=A-B
p*=(-1)**K
print(p if p<=10**18 else 'Unfair')

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

flg = 0
if a - b > 0 and k % 2 == 0 or a-b < 0 and k % 2 == 0:
    flg = 1
elif a - b < 0 and k % 2 == 1 or a-b > 0 and k % 2 == 1:
    flg = -1

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

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())
cheak = 10**18
ans = a-b
def calc(a,b,c,k):
    if a == b:
        return 0
    elif ans < 0:
        if k % 2 == 1:
            return -ans
        else:
            return ans
    else:
        if k % 2 == 1:
            return -ans
        else:
            return ans
ans_n = calc(a,b,c,k)
if ans_n > cheak:
    print("Unfair")
else:
    print(ans_n)

Solution (Python):
a,b,c,k = map(int, input().split())
cheak = 10**18
ans = a-b
def calc(a,b,c,k):
    if a == b:
        return 0
    elif ans < 0:
        if k % 2 == 1:
            return -ans
        else:
            return ans
    else:
        if k % 2 == 1:
            return -ans
        else:
            return ans
ans_n = calc(a,b,c,k)
if ans_n > cheak:
    print("Unfair")
else:
    print(ans_n)

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

Solution (Python):
a,b,c,k = map(int, input().split())
cheak = 10**18
key = a-b
def calc(a,b,c,k):
    if a == b:
        return 0
    elif key < 0:
        if k % 2 == 1:
            return -key
        else:
            return key
    else:
        if k % 2 == 1:
            return -key
        else:
            return key
ans = calc(a,b,c,k)
if ans > cheak:
    print("Unfair")
else:
    print(ans)

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=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(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")
    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):
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:
    num = (2**k+2)/3
    tak = num*a+(num-1)*b+(num-1)*c
    nak = (num-1)*a+num*b+(num-1)*c

else:
    num = (2**k+1)/3
    tak = (num-1)*a+num*b+num*c
    nak = num*a+(num-1)*b+num*c
'''
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=0
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((a-b)*(-1)**k)

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

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

ans = b - a if k % 2 == 1 else a - b

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

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

if K % 2 == 0:
    if abs(A - B) >= int(1e18):
        print("Unfair")
    else:
        print(A - B)
else:
    if abs(A - B) >= int(1e18):
        print("Unfair")
    else:
        print(B - A)

Solution (Python):
A, B, C, K = 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())
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:
  ans *= -1
if abs(ans) >= pow(10,18):
  print("Unfair")
else:
  print(ans)

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

if K == 0:
    print(A-B)
    exit()

A, B, C = B+C, C+A, A+B

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

print(ans)

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

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True

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

Solution (Python):

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

print((b * (-1) ** (k + 1)) + (a * (-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:
    print("Unfair")
else:
    print(ans)

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

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

Solution (Python):
def myAnswer(A:int,B:int,C:int,K:int) ->int :
   return B-A if(K %2 == 1) else -1*(B-A)
def modelAnswer():
   tmp=1
def main():
   A,B,C,K = map(int,input().split())
   ans = myAnswer(A,B,C,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 == 0:
    print(A - B)
else:
    print(B - A)

Solution (Python):
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)

Solution (Python):
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

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

Solution (Python):

import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

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

resolve()

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 = map(int,input().split())
inf = 10**18
ans = a-b
if k%2:ans = -ans
if ans < -inf or ans > inf:print('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())

tmp = abs(a - b)
if tmp > 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:
    ans = a - b

else:
    ans = b - a

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

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

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

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

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

Solution (Python):
import heapq
from collections import defaultdict, deque
from math import ceil, factorial
from fractions import gcd
import sys

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

si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
smii = lambda: sorted(map(int, input().split()))


A, B, C, K = mii()

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

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

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 heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def gcd_list(numbers):
    return reduce(gcd, numbers)


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())
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())
ans = A-B if K % 2 == 0 else B-A
print(ans if abs(ans) <= 10**18 else 'Unfair')

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

x = B-A

if(K%2!=0):
    print(x if x < 10**18 else "Unfair")
else:
    print(-x if (-x < 10**18) else "Unfair" )

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

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

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

a,b,c,k = iim()
k = k%2
print(int((a-b)*(-1)**k))

Solution (Python):
a,b,c,k = map(int,input().split())
ans = 0
if k==0 or k%2==0:
    ans = a-b
else:
    ans = b-a
if len(str(abs(ans)))==20:
    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, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, C, K = MAP()

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

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

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

Solution (Python):
a, b, c, k = map(int, input().split())
if k == 0:
    print(a - b)
else:
    a, b, c = b + c, a + c, a + b 
    if a - b <= 0:
        print(abs(a - b) * (-1) ** k)
    
    elif a - b > 0:
        print(abs(a - b) * (-1) ** (k - 1))

Solution (Python):
import numpy as np

A, B, C, K = map(int, input().split(" "))
vec = np.array([[A], [B], [C]])
mat = np.array([[0, 1, 1], [1, 0, 1], [1, 1, 0]])
mat = np.linalg.matrix_power(mat, K)
ans = mat.dot(vec)

if abs(ans[0] - ans[1]) <= 10e18:
    print(int(ans[0] - ans[1]))
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())
Unfair=10**18

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

for i in range(k):
    a2=b+c
    b2=a+c
    c2=a+b
    a,b,c=a2,b2,c2

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

Solution (Python):

def inputlist(): return [int(j) for j in input().split()]


A,B,C,K = inputlist()
if abs(B-A) >= 10**18:
    print("Unfair")
    exit()
ans = A-B
if K % 2 == 1:
    ans *= -1
print(ans)

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

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

Solution (Python):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') 
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(sys.stdin.readline()) 
def ifn(): return float(sys.stdin.readline()) 
def isn(): return sys.stdin.readline().split() 
def imn(): return map(int, sys.stdin.readline().split()) 
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) 
def fmn(): return map(float, sys.stdin.readline().split()) 
def iln(): return list(map(int, sys.stdin.readline().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def fln(): return list(map(float, sys.stdin.readline().split())) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

A,B,C,K = imn()

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

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

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


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

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

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

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

Solution (Python):

import sys


def solve(A: int, B: int, C: int, K: int):
    if abs(B-A) > 10**18:
        print("Unfair")
    if K&1:
        print(B-A)
    else:
        print(A-B)
    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 = list(map(int,input().split()))	
x = 10 **18
result = a - b
if result > x:
    print("Unfair")
elif k % 2 == 0:
    print(result)
elif k % 2 == 1:
    result = result * -1
    print(result)

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


if __name__ == '__main__':
    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 = 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 == 0:
    answer = A - B
else:
    answer = B - A
print(answer)

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


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

for i in range(K):
    a = A
    b = B
    c = C

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

ans = A - B

if ans >= 10**8:
    ans = 'Unfair'
elif ans >*10**8:
    ans = 'Unfair'

print(ans)
'''



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

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

if ans >= 10**18 or (-1)*ans >= 10**18:
    ans = 'Unfair'

print(ans)

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

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







print((A-B)*(-1)**(K&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:
    print("Unfair")
else:
    print(ans)

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

ans = B-A
if abs(ans) > 10**18:
    ans = "Unfair"
elif K%2 == 0:
    ans *= -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):
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 = map(int,input().split())

s = abs(a - b)

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

Solution (Python):
a, b, c, k = list(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())
l=[A,B,C]

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