def dup_scale(f, a, K):
 (f, n, b) = (list(f), (len(f) - 1), a)
 for i in range((n - 1), (-1), (-1)):
  (f[i], b) = ((b * f[i]), (b * a))
 return f

def dup_scale ( f , a , K ) : ( f , n , b ) = ( list ( f ) , ( len ( f ) - 1 ) , a ) for i in range ( ( n - 1 ) , ( - 1 ) , ( - 1 ) ) : ( f [ i ] , b ) = ( ( b * f [ i ] ) , ( b * a ) ) return f
evaluate efficiently composition f in k[x] .