#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

typedef long long LL;

LL a,b,c,k;

int main()
{
    scanf("%lld %lld %lld %lld",&a,&b,&c,&k);

    printf("%lld\n",(k&1) ?b-a :a-b );
}