//  [rust]
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

trait Group: std::ops::Add<Output=Self> + std::ops::Sub<Output=Self> + std::ops::Neg<Output=Self>
    + std::iter::Sum + Clone + Copy {
    fn zero() -> Self;
}
impl Group for i32 { fn zero() -> Self { 0 }}
impl Group for i64 { fn zero() -> Self { 0 }}
impl Group for f32 { fn zero() -> Self { 0.0 }}
impl Group for f64 { fn zero() -> Self { 0.0 }}

trait Ring: Group + std::ops::Mul<Output=Self> + std::ops::Div<Output=Self> {
    fn one() -> Self;
}
impl Ring for i32 { fn one() -> Self { 1 }}
impl Ring for i64 { fn one() -> Self { 1 }}
impl Ring for f32 { fn one() -> Self { 1.0 }}
impl Ring for f64 { fn one() -> Self { 1.0 }}

#[derive(Debug, Clone, PartialEq)]
struct Matrix<K> { data: Vec<Vec<K>> }

macro_rules! mat {
    ( $( $( $x:expr ),* );* ) => ( Matrix::new( vec![ $( vec![ $( $x ),* ] ),* ] ) )
}

impl<K: Ring> Matrix<K> {
    fn new(data: Vec<Vec<K>>) -> Self {
        Matrix { data: data }
    }
    fn size(&self) -> (usize, usize) {
        (self.data.len(), self.data[0].len())
    }
    fn eye(n: usize) -> Matrix<K> {
        let mut e = vec![vec![K::zero(); n]; n];
        for i in 0..n { e[i][i] = K::one(); }
        Matrix::new(e)
    }
    fn zero(h: usize, w: usize) -> Matrix<K> {
        Matrix::new(vec![vec![K::zero(); w]; h])
    }
    fn pow(&self, n: usize) -> Matrix<K> {
        if n == 0 {
            Matrix::eye(self.data.len())
        } else if n == 1 {
            self.clone()
        } else if n % 2 == 0 {
            let m = self * self;
            m.pow(n / 2)
        } else {
            let m = self * self;
            &m.pow(n / 2) * self
        }
    }
    fn sum(&self) -> K {
        self.data.iter().map(|row| row.iter().map(|&x| x).sum::<K>()).sum()
    }
    fn map<F>(&self, f: F) -> Matrix<K>
        where F: Fn(&K) -> K
    {
        let data = self.data.iter().map(|row| row.iter().map(&f).collect()).collect();
        Matrix::new(data)
    }
    /// O(n!)
    /// self should be square matrix.
    fn det(&self) -> K {
        let (n, m) = self.size();
        assert!(n == m);
        if n == 1 { return self.data[0][0] }
        let mut b = Matrix::<K>::zero(n - 1, m - 1);
        let mut d = K::zero();
        for i in 0..n {
            for bi in 0..n-1 {
                for bj in 0..n-1 {
                    let ai = if bi < i { bi } else { bi + 1 };
                    b.data[bi][bj] = self.data[ai][1 + bj];
                }
            }
            d = d + (if i % 2 == 0 { K::one() } else { -K::one() }) * self.data[i][0] * b.det();
        }
        d
    }
}

impl<K: Ring> Matrix<K>
where K: std::ops::RemAssign + std::ops::Rem<Output=K>
{
    fn powmod(&self, n: u64, modulo: K) -> Matrix<K> {
        if n == 0 {
            Matrix::eye(self.data.len())
        } else if n == 1 {
            self.map(|&x| x % modulo)
        } else {
            let mut m = (self * self).map(|&x| x % modulo);
            m = m.powmod(n / 2, modulo);
            if n % 2 == 1 {
                m = (&m * self).map(|&x| x % modulo);
            }
            m
        }
    }
}

// -M
impl<K: Ring> std::ops::Neg for &Matrix<K> {
    type Output = Matrix<K>;
    fn neg(self) -> Matrix<K> { self.map(|&x| -x) }
}

// M + N
impl<K: Ring> std::ops::Add<&Matrix<K>> for &Matrix<K> {
    type Output = Matrix<K>;
    fn add(self, other: &Matrix<K>) -> Matrix<K> {
        let (h, w) = self.size();
        let data = (0..h).map(|i| (0..w).map(|j| self.data[i][j] + other.data[i][j]).collect()).collect();
        Matrix::new(data)
    }
}

// M - N
impl<K: Ring> std::ops::Sub<&Matrix<K>> for &Matrix<K> {
    type Output = Matrix<K>;
    fn sub(self, other: &Matrix<K>) -> Matrix<K> {
        self + &-other
    }
}

// M * N
impl<K: Ring> std::ops::Mul<&Matrix<K>> for &Matrix<K> {
    type Output = Matrix<K>;
    fn mul(self, other: &Matrix<K>) -> Matrix<K> {
        let (h, w) = self.size();
        let (_, v) = other.size();
        let data =
            (0..h).map(|i| (0..v).map(|k| (0..w).map(|j| self.data[i][j] * other.data[j][k]).sum()).collect())
                  .collect();
        Matrix::new(data)
    }
}

// M * k
impl<K: Ring> std::ops::Mul<K> for &Matrix<K> {
    type Output = Matrix<K>;
    fn mul(self, k: K) -> Matrix<K> {
        self.map(|&x| x * k)
    }
}

fn main() {
    let mut sc = Scanner::new();
    let a: i64 = sc.cin();
    let b: i64 = sc.cin();
    let c: i64 = sc.cin();
    let k: i64 = sc.cin();
    put!((a-b) * if k % 2 == 0 { 1 } else { -1 });

}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}