#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
inline long long read()
{
	long long s=0,f=1,ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	ch=='-' ? f=-1:s=ch-'0',ch=getchar();
	while(isdigit(ch)) s=s*10+ch-'0',ch=getchar();
	return f*s;
	
} 
long long a,b,c;
long long k;
int main()
{
	a=read();b=read();c=read();k=read();
	long long x,y,z;
	z%=2;
	if(z==0) printf("%lld\n",a-b);
	else printf("%lld\n",b-a);
	
	
	return 0;
}