program sample
    implicit none
  
    integer(8) :: a,b,c,i,j,m,n,k,a1,b1,c1
    
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) a,b,c,k
    do i=1,k
        if (abs(a)>10**18 .or. abs(b)>10**18 .or. abs(c)>10**18)then
           write(*,*)'Unfair'
           stop 
        end if
       a1=b+c
       b1=c+a
       c1=a+b
       a=a1
       b=b1
       c=c1

    end do
    if (abs(a-b)>10**18)then
        write(*,*)'Unfair'
        stop 
     end if
    write(*,*) abs(a-b)
  
    stop
end program sample
  

