human
Position after taking N steps to the right and left in an alternate manner | Function to return the last destination.
Driver Code"
Solution in Python:
assistant
#Here is code to position after taking N steps to the right and left in an alternate manner and the other steps required.
 def lastCoordinate ( n , a , b ) :
	return ( ( ( n + 1 ) // 2 ) * a - ( n // 2 ) * b )
n = 3
a = 5
b = 2
print ( lastCoordinate ( n , a , b ) )