/*#include <bits/stdc++.h>
using namespace std;
char a[1005][1005];
int main()
{
     srand (time(NULL));
     freopen("ssam8.txt","w", stdout);
     int n=rand()%1000+1;
     int m=rand()%1000+1;
     cout<<n<<" "<<m<<endl;

     for(int i=0;i<n;i++)
     {
         for(int j=0;j<m;j++)
         {
            int u=rand()%11;
            if(u==10)
            {
                if(j==m)
                    cout<<"*";
                else cout<<"* ";
            }
            else
            {
                char ch=u+'0';
                if(j!=m)
                    cout<<ch<<" ";
                else cout<<ch;
            }
         }
         cout<<endl;

     }
     int x=rand()%n+1;
     int y=rand()%m+1;
     cout<<x<<" "<<y<<endl;
     int q=rand()%1000+1;
      cout<<q<<endl;
      for(int i=0;i<q;i++)
      {
          int xx,yy;
          xx=rand()%n+1;
          yy=rand()%m+1;
          cout<<xx<<" "<<yy<<endl;
      }
      return 0;
}*/
/*#include <bits/stdc++.h>
using namespace std;
char a[1001][1001];
long long int level[1001][1001],tres[1001][1001];
long long int dx[4]={0,0,1,-1};
long long int dy[4]={1,-1,0,0};
bool vis[1001][1001];
int main()
{
  //  freopen("ssam8.txt","r",stdin);
//    freopen("ssamo8.txt","w",stdout);

    long long int i,j;
    long long int n,m;
    cin>>n>>m;
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            cin>>a[i][j];
        }
    }
    long long int x,y;
    cin>>x>>y;
    x--;
    y--;
    queue< pair<long long int,long long int> >q;
    q.push(make_pair(x,y));
    vis[x][y]=true;
    tres[x][y]=a[x][y]-'0';
    while(!q.empty())
    {
        long long int X=q.front().first;
        long long int Y=q.front().second;
        q.pop();
        for(i=0;i<4;i++)
        {
            int x1=X+dx[i];
            int y1=Y+dy[i];
           // cout<<X<<" "<<Y<<" "<<x1<<" "<<y1<<endl;
            if(x1>=0&&x1<n&&y1>=0&&y1<m)
            {
                if(!vis[x1][y1]&&a[x1][y1]!='*')
                {
                    q.push({x1,y1});
                    level[x1][y1]=level[X][Y]+1;
                    long long int g=a[x1][y1]-'0';
                   // cout<<g<<endl;
                    tres[x1][y1]=tres[X][Y]+g;
                    //cout<<tres[x1][y1]<<endl;
                    vis[x1][y1]=true;
                }
                else if(vis[x1][y1]&&a[x1][y1]!='*')
                {

                   // level[x1][y1]=min(level[X][Y]+1,level[x1][y1]);
                    if(level[x1][y1]>level[X][Y]+1)
                        tres[x1][y1]=tres[X][Y]+(a[x1][y1]-'0');

                    else if(level[x1][y1]==level[X][Y]+1)
                    {
                        tres[x1][y1]=max(tres[x1][y1],tres[X][Y]+(a[x1][y1]-'0'));
                    }
                }
            }
        }
    }
    //cout<<level[0][1]<<endl;
    int q1;
    cin>>q1;
    //cout<<q1<<endl;
    while(q1--)
    {
        int mm,nn;
        cin>>mm>>nn;
        mm--;
        nn--;
        if(a[mm][nn]=='*')
        {
            cout<<"-1 -1\n";
          //  continue;
        }
        else if(mm==x&&nn==y)
        {
            cout<<"0 ";
            cout<<(a[mm][nn]-'0')<<endl;
        //    continue;
        }
        else if(level[mm][nn]==0)
        {
            cout<<"-1 -1"<<endl;
        }
        else
            cout<<level[mm][nn]<<" "<<tres[mm][nn]<<endl;
    }
}
*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
ll mod(ll x)
{
    if(x<0) return -x;
    return x;
}
int main()
{
    ll s1=0,s2=0,s3=0;
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    int f=0;
    s1=b+c;
    s2=a+c;
    s3=a+b;
    a=s1;
    b=s2;
    c=s3;
    s1=b+c;
    s2=a+c;
    s3=a+b;
    if(s1>1000000000000000000 || s2>1000000000000000000 || s3>1000000000000000000)
    {
        cout<<"Unfair"<<endl;
        return 0;
    }
    if(k%2)
    {
        cout<<a-b<<endl;
    }
    else cout<<b-a<<endl;
}


Measured memory_bytes: 256