<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described.
<END_TASK>
<USER_TASK:>
Description:
Remaining array element after repeated removal of last element and subtraction of each element from next adjacent element
Function to find the last remaining array element after performing the given operations repeatedly ; Stores the resultant sum ; Traverse the array ; Increment sum by arr [ i ] * coefficient of i - th term in ( x - y ) ^ ( N - 1 ) ; Update multiplier ; Return the resultant sum ; Driver Code

<ASSISTANT_TASK:>
Python Code:
def lastElement(arr , n ) : 
	 sum = 0 
 if n % 2 == 0 : 
	 multiplier = - 1 
  else : 
	 multiplier = 1 
  for i in range(n ) : 
	 sum += arr[i ] * multiplier 
 multiplier = multiplier *(n - 1 - i ) /(i + 1 ) *(- 1 ) 
  return sum 
  if __name__== ' __main __' : 
	 arr =[3 , 4 , 2 , 1 ] 
 N = len(arr ) 
 print(int(lastElement(arr , N ) ) ) 
 
<END_TASK>
