Meet in the middle for searching is optimized due to precalculated g^B
mod p for right side of equation