'use strict'

function Main(input) {
  let takahashi = [Number(input.split(' ')[0])];
  let chuhashi = [Number(input.split(' ')[1])];
  let syohashi = [Number(input.split(' ')[2])];
  const K = Number(input.split(' ')[3]);

  if(takahashi[0] === chuhashi[0]) {
    console.log(0);
    return;
  }

  for(let i=0; i<K; i++) {
    takahashi.push(chuhashi[0] + syohashi[0]);
    chuhashi.push(takahashi[0] + syohashi[0]);
    syohashi.push(takahashi[0] + chuhashi[0]);
  }

  //console.log(takahashi);
  //console.log(chuhashi);
  //console.log(syohashi);

  const answer = takahashi[takahashi.length - 1] - chuhashi[chuhashi.length - 1];

  if(answer >= 1000000000000000000){
    console.log('Unfair')
  } else {
    console.log(answer);
  }
  
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));