#NEWLINE# def jacobian_multiply( a , n ) : #NEWLINE# #INDENT# if ( ( a [ 1 ] == 0 ) or ( n == 0 ) ) : #NEWLINE# #INDENT# return ( 0 , 0 , 1 ) #NEWLINE# #UNINDENT# if ( n == 1 ) : #NEWLINE# #INDENT# return a #NEWLINE# #UNINDENT# if ( ( n < 0 ) or ( n >= N ) ) : #NEWLINE# #INDENT# return jacobian_multiply ( a , ( n % N ) ) #NEWLINE# #UNINDENT# if ( ( n % 2 ) == 0 ) : #NEWLINE# #INDENT# return jacobian_double ( jacobian_multiply ( n , ( n // 2 ) ) ) #NEWLINE# #UNINDENT# if ( ( n % 2 ) == 1 ) : #NEWLINE# #INDENT# return jacobian_add ( jacobian_double ( jacobian_multiply ( a , ( n // 2 ) ) ) , a )