#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(0),cin.tie(0);

    int a,b,c,k,res;
    cin>>a>>b>>c>>k;
    if(k%2==0)
        res=a-b;
    else
        res=b-a;
    cout<<res<<endl;
    return 0;
}
