func (z *Element) Neg(x *Element) *Element {
	if x.IsZero() {
		return z.SetZero()
	}
	var borrow uint64
	z[0], borrow = bits.Sub64(725501752471715841, x[0], 0)
	z[1], borrow = bits.Sub64(6461107452199829505, x[1], borrow)
	z[2], borrow = bits.Sub64(6968279316240510977, x[2], borrow)
	z[3], _ = bits.Sub64(1345280370688173398, x[3], borrow)
	return z
}
Neg z = q - x
package fr
import (
	"crypto/rand"
	"encoding/binary"
	"io"
	"math/big"
	"math/bits"
	"strconv"
	"sync"
	"unsafe"
)
type Element [4]uint64
const ElementLimbs = 4
const ElementBits = 253
func (z *Element) Bytes() []byte {
	var _z Element
	_z.Set(z).FromMont()
	res := make([]byte, ElementLimbs*8)
	binary.BigEndian.PutUint64(res[(ElementLimbs-1)*8:], _z[0])
	for i := ElementLimbs - 2; i >= 0; i-- {
		binary.BigEndian.PutUint64(res[i*8:(i+1)*8], _z[ElementLimbs-1-i])
	}
	return res
}
func (z *Element) SetBytes(e []byte) *Element {
	var tmp big.Int
	tmp.SetBytes(e)
	z.SetBigInt(&tmp)
	return z
}
func (z *Element) SetUint64(v uint64) *Element {
	z[0] = v
	z[1] = 0
	z[2] = 0
	z[3] = 0
	return z.ToMont()
}
func (z *Element) Set(x *Element) *Element {
	z[0] = x[0]
	z[1] = x[1]
	z[2] = x[2]
	z[3] = x[3]
	return z
}
func (z *Element) SetZero() *Element {
	z[0] = 0
	z[1] = 0
	z[2] = 0
	z[3] = 0
	return z
}
func (z *Element) SetOne() *Element {
	z[0] = 9015221291577245683
	z[1] = 8239323489949974514
	z[2] = 1646089257421115374
	z[3] = 958099254763297437
	return z
}