/+ dub.sdl:
    name "A"
    dependency "dunkelheit" version=">=0.9.0"
+/

import std.stdio, std.algorithm, std.range, std.conv;
import dkh.foundation, dkh.scanner;

int main() {
    Scanner sc = new Scanner(stdin);
    long a, b, c, k;
    sc.read(a, b, c, k);
    if (k % 2 == 0) {
        writeln(a-b);
    } else {
        writeln(b-a);
    }
    return 0;
}
