def gf_int(a, p):
 if (a <= (p // 2)):
  return a
 else:
  return (a - p)

def gf_int ( a , p ) : if ( a <= ( p // 2 ) ) : return a else : return ( a - p )
coerce a mod p to an integer in the range [-p/2 .