import scas._
import Implicits.{ZZ => s}
//val s = base.ModInt(2147483647)
implicit val r = Polynomial(s, PowerProduct.lexicographic[Int]('x, 'y, 'z))
import r.{size, generators}
val Array(x, y, z) = generators
val p = 1 + x + y + z
//val p = 10000000001l * (1 + x + y + z)
//val p = 1 + pow(x, 2147483647) + pow(y, 2147483647) + pow(z, 2147483647)
println("p: " + p)
val q = pow(p, 20)
println("q: " + size(q))
val q1 = 1 + q
println("q1: " + size(q1))
var t = System.currentTimeMillis();
val q2 = q * q1
t = System.currentTimeMillis() - t;
println("q2: " + size(q2))
println("t: " + t)