#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define INF 0x3f3f3f3f

ll f[100][3];
int main()
{
   ll a,b,c,k;
   cin>>a>>b>>c>>k;

    if(k&1)cout<<b-a<<endl;
    else cout<<a-b<<endl;

}
/*


*/
