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

abs_ans = abs(A-B)

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

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

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

Solution (Python):

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

Solution (Python):
from sys import exit

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


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

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

sign = (A - B) // abs(A - B)


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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
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
from decimal import *

A, B, C, K = MAP()

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
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
from decimal import *

A, B, C, K = MAP()

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


import sys
input=sys.stdin.readline

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






mylist = list(map(int, input().split()))





if abs(mylist[0]-mylist[1]) > 10**18:
    print("Unfair")
else:
    if mylist[-1]%2 == 0:
        print(mylist[0]-mylist[1])
    else:
        print(-mylist[0]+mylist[1])

Solution (Python):
def resolve():
    A, B, C, K = list(map(int, input().split()))
    MX = 10 ** 18
    if K % 2 == 0:
        print(A-B)
        return
    else:
        print(B-A)
    return

resolve()

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


import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

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

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:
  ans=b-a
else:
  ans=a-b

print(ans)

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

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

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

Solution (Python):
import math
from collections import deque
from collections import defaultdict


def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
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 -1*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 bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	
	ans = data[:]
	return ans

a,b,c,k = readInts()

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

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

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






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






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


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 make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




A,B,C,K = IL()

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

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    A, B, C, K = [int(x) for x in input().split()]

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

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

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

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

else:
    ans = a-b

print(ans)

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

if ans > 1000000000000000000:
    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 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())

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
A, B, C, K = map(int, input().split())
print(B - A) if K % 2 else print(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())

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

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

Solution (Python):
A, B, C, K = map(int, input().split())
ans = abs(A) - abs(B)
if K % 2 != 0:
    ans = 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):
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 = list(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:
  print('Unfair')
else:
  print(A - B if not K % 2 else -(A - B))

Solution (Python):
a,b,c,k = map(int, input().split())
over = 10**18
if abs(a-b)> over:
    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):
from sys import stdin
import math

a,b,c,k = [int(x) for x in stdin.readline().strip().split()]
print(((-1)**k) * (a - b))

Solution (Python):
import numpy as np

A, B, C, K = map(int, input().split())
W = np.array([[0,1,1], [1,0,1], [1,1,0]])
bef_X = np.array([A, B, C])
aft_X = np.dot(np.linalg.matrix_power(W, K),  bef_X)

ans = aft_X[0] - aft_X[1]

print("{0}".format(ans if ans <= 10**18 else 'unfair'))

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

Solution (Python):
A,B,C,k = map(int,input().split())
s1 = A-B
s2 = B-A
if k%2 == 0:
    print(s1)
elif k%2 == 1:
    print(s2)

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

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

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

ans = (-1)**n*a+(-1)**(n-1)*b

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

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

gap = A - B if K % 2 == 0 else B - A

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

Solution (Python):
def invr():
    return(map(int, input().split()))


A, B, C, K = invr()
res = B - A
if K % 2 == 0:
    res = A - B
if abs(res) > 1000000000000000000:
    print(" Unfair ")
else:
    print(res)

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

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

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

print(ans)

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

Solution (Python):
from sys import stdin
import math
import re
import queue

input = stdin.readline

MOD = 1000000007
INF = 122337203685477580

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

    x = ((-1)**(K%2))*(A- B)

    if(x>1e18):
        print("Unfair")

    print(x)
if __name__ == '__main__':
    solve()

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

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

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

Solution (Python):

import sys


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



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

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):

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

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

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

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

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,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) >= 10e18:
    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())

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

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

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

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

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

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

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

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

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

if a == b == c:
    print(0)
    exit()

if abs(a - b) >= 1e18:
    print("Unfair")
    exit()

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

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

Solution (Python):
import sys

input = sys.stdin.readline

def main():
    ans = 0
    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)

if __name__ == '__main__':
    main()

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


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

Solution (Python):
A, B, C, K = map(int, input().split())
print(A-B) if K%2==0 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 = map(int,input().split())

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

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

Solution (Python):
import numpy as np

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


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



def doubling(a, b, c, coeff):
    vec = np.array([a, b, c])
    result = np.dot(coeff, vec)
    return result


def doubling_n_times(a, b, c, n):
    coeff = np.array([
        [0, 1, 1],
        [1, 0, 1],
        [1, 1, 0],
    ], dtype=np.int)
    for i in range(n - 1):
        coeff = np.dot(coeff, coeff)

    a, b, c = doubling(a, b, c, coeff)

    return a, b, c


def solve(a, b, c, k):
    pow = 0
    while k > 0:
        bit = k % 2
        k //= 2
        pow += 1
        if bit == 0:
            continue

        a, b, c = doubling_n_times(a, b, c, pow)

    return a, b, c


def solve_naively(a, b, c, k):
    for i in range(k):
        a, b, c = mono(a, b, c)
        if i + 1 in (1, 2, 4, 8, 16, 32):
            print("a, b, c, i + 1 = ", a, b, c, i + 1)

    return a, b, c


a, b, c = solve(a, b, c, k)

ans = a - b
if abs(ans) > 1e18:
    print('Unfair')
else:
    print(ans)

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

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

from collections import Counter
def resolve():
    A,B,C,K=pin()
    
    k=K%2
    t=(A-B)
    if abs(t)>10**18:print("Unfair");return
    if k%2:t=(-1)*t
    print(t)
    



resolve()

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

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    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)


if __name__ == "__main__":
    main()

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

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

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

Solution (Python):


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

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

main()

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

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


if __name__ == "__main__":
    main()

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

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

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

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

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

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

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

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

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

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

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

limit = 10 ** 18

if K % 2 == 0:
  ans = (A - B)
else:
  ans = (B - A)
  
if ans < limit:
  print(ans)
else:
  print("Unfair")

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

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

if k % 2 == 0:
	diff = a - b
else:
	diff = -a + b

print(diff) if diff <= 10 ** 18 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):


def main():
    A, B, C, K = map(int, open(0).read().split())

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


main()

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

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

Solution (Python):

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

AA = B+C
BB = A+C
CC = A+B

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