Position after taking N steps to the right and left in an alternate manner | Function to return the last destination ; Driver Code
def lastCoordinate ( n , a , b ) : NEW_LINE INDENT return ( ( ( n + 1 ) // 2 ) * a - ( n // 2 ) * b ) NEW_LINE DEDENT n = 3 NEW_LINE a = 5 NEW_LINE b = 2 NEW_LINE print ( lastCoordinate ( n , a , b ) ) NEW_LINE