import std.algorithm;
import std.stdio;

long solve (long a, long b, long c, long k)
{
	k &= 1;
	if (k & 1)
	{
		swap (a, b);
	}
	return a - b;
}

void main ()
{
	long a, b, c, k;
	while (readf (" %s %s %s %s", &a, &b, &c, &k) > 0)
	{
		writeln (solve (a, b, c, k));
	}
}
