program main
  implicit none

  integer(16) :: a, b, c, k, ab, bc, ca, max
  integer :: i

  read(*,*) a, b, c, k
  max = 1
  do i = 1, 18
     max = max * 10
  end do
  
  do i = 1, k
     ab = a + b
     bc = b + c
     ca = c + a
     a = bc
     b = ca
     c = ab
  end do
  
  if (abs(a - b) > max) then
     write(*,*) 'Unfair'
  else   
     write(*,*) a - b
  end if

  
end program main


  
