def gf_value(f, a):
 result = 0
 for c in f:
  result *= a
  result += c
 return result

def gf_value ( f , a ) : result = 0 for c in f : result *= a result += c return result
value of polynomial f at a in field r .