#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mk make_pair
using namespace std;
const int N=1e5+10;
int ar[N];
string str[100];
int main()
{
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    if(k%2){
        cout<<b-a<<endl;
    }
    else
        cout<<a-b<<endl;
    return 0;
}
