﻿from cmath import *

def H(L,a):
    n=len(L)
    b=L[0]
    for i in range(1,n):
        b=b*a+L[i]
    return b

