var __PLTNUMBERS_TOP__;typeof exports!=="undefined"?__PLTNUMBERS_TOP__=exports:(this.jsnums||(this.jsnums={}),__PLTNUMBERS_TOP__=this.jsnums); (function(){function f(a,b,c){a!=null&&("number"==typeof a?this.fromNumber(a,b,c):b==null&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,b))}function p(){return new f(null)}function hb(a,b,c,e,j,d){for(;--d>=0;){var f=b*this[a++]+c[e]+j,j=Math.floor(f/67108864);c[e++]=f&67108863}return j}function ib(a,b,c,e,j,d){var f=b&32767;for(b>>=15;--d>=0;){var g=this[a]&32767,h=this[a++]>>15,i=b*g+h*f,g=f*g+((i&32767)<<15)+c[e]+(j&1073741823),j=(g>>>30)+(i>>>15)+b*h+(j>>>30);c[e++]=g&1073741823}return j} function jb(a,b,c,e,j,d){var f=b&16383;for(b>>=14;--d>=0;){var g=this[a]&16383,h=this[a++]>>14,i=b*g+h*f,g=f*g+((i&16383)<<14)+c[e]+j,j=(g>>28)+(i>>14)+b*h;c[e++]=g&268435455}return j}function xa(a,b){var c=ja[a.charCodeAt(b)];return c==null?-1:c}function N(a){var b=p();b.fromInt(a);return b}function Y(a){var b=this.s-a.s;if(b!=0)return b;var c=this.t,b=this.s<0?a.t-c:c-a.t;if(b!=0)return b;for(;--c>=0;)if((b=this[c]-a[c])!=0)return b;return 0}function ka(a){var b=1,c;if((c=a>>>16)!=0)a=c,b+=16;if((c= a>>8)!=0)a=c,b+=8;if((c=a>>4)!=0)a=c,b+=4;if((c=a>>2)!=0)a=c,b+=2;a>>1!=0&&(b+=1);return b}function ya(a){var b=p();this.abs().divRemTo(a,null,b);this.s<0&&b.compareTo(f.ZERO)>0&&a.subTo(b,b);return b}function P(a){this.m=a}function Q(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<0&&(b.rShiftTo(e,b),a.rShiftTo(e,a));for(;b.signum()>0;)(c=b.getLowestSetBit())>0&&b.rShiftTo(c,b),(c=a.getLowestSetBit())>0&&a.rShiftTo(c,a),b.compareTo(a)>=0?(b.subTo(a,b),b.rShiftTo(1,b)):(a.subTo(b,a),a.rShiftTo(1,a));e>0&&a.lShiftTo(e,a);return a}var h=__PLTNUMBERS_TOP__,H=function(a,b,c){c= c||{};return function(e,j){if(c.isXSpecialCase&&c.isXSpecialCase(e))return c.onXSpecialCase(e,j);if(c.isYSpecialCase&&c.isYSpecialCase(j))return c.onYSpecialCase(e,j);if(typeof e==="number"&&typeof j==="number")return a(e,j);typeof e==="number"&&(e=Ka(e,j));typeof j==="number"&&(j=Ka(j,e));e.level=a[2].length- 1?a[1]+a[2].substring(1)+Ma(b-(a[2].length-1)):a[1]+a[2].substring(1,1+b)):a},Ma=function(a){var b=[];b.length=a;for(var c=0;c=b},function(a,b){(!E(a)||!E(b))&&l(">=: couldn't be applied to complex number",a,b);return a.greaterThanOrEqual(b)}),da=H(function(a,b){return a<=b},function(a,b){(!E(a)||!E(b))&&l("<=: couldn't be applied to complex number",a,b);return a.lessThanOrEqual(b)}),U=H(function(a,b){return a>b},function(a,b){(!E(a)|| !E(b))&&l(">: couldn't be applied to complex number",a,b);return a.greaterThan(b)}),J=H(function(a,b){return a=0?(a=Math.sqrt(a),Math.floor(a)===a?a:d.makeInstance(a)): g.makeInstance(0,D(-a)):a.sqrt()},A=function(a){return typeof a==="number"?Math.abs(a):a.abs()},z=function(a){return typeof a==="number"?a:a.floor()},Ra=function(a){return typeof a==="number"?a:a.ceiling()},Sa=function(a){return typeof a==="number"?a:a.conjugate()},na=function(a){return q(a,1)?0:typeof a==="number"?d.makeInstance(Math.log(a)):a.log()},Ta=function(a){return typeof a==="number"?a>0?0:d.pi:a.angle()},Ua=function(a){return q(a,0)?0:typeof a==="number"?d.makeInstance(Math.tan(a)):a.tan()}, wa=function(a){return q(a,0)?0:typeof a==="number"?d.makeInstance(Math.atan(a)):a.atan()},oa=function(a){return q(a,0)?1:typeof a==="number"?d.makeInstance(Math.cos(a)):a.cos()},pa=function(a){return q(a,0)?0:typeof a==="number"?d.makeInstance(Math.sin(a)):a.sin()},Va=function(a){return q(a,1)?0:typeof a==="number"?d.makeInstance(Math.acos(a)):a.acos()},Wa=function(a){return q(a,0)?0:typeof a==="number"?d.makeInstance(Math.asin(a)):a.asin()},ca=function(a){return typeof a==="number"?0:a.imaginaryPart()}, M=function(a){return typeof a==="number"?a:a.realPart()},Xa=function(a){return typeof a==="number"?a:a.round()},X=function(a){return k(a,a)},Ya=function(a){t(a)||l("integer-sqrt: the argument "+a.toString()+" is not an integer.",a);return typeof a==="number"?a<0?g.makeInstance(0,Math.floor(Math.sqrt(-a))):Math.floor(Math.sqrt(a)):a.integerSqrt()},qa=function(a,b){t(a)||l("quotient: the first argument "+a.toString()+" is not an integer.",a);t(b)||l("quotient: the second argument "+b.toString()+" is not an integer.", b);return fa(a,b)},ra=function(a,b){t(a)||l("remainder: the first argument "+a.toString()+" is not an integer.",a);t(b)||l("remainder: the second argument "+b.toString()+" is not an integer.",b);return mb(a,b)},K=function(a){return a<-9E15||9E15 b},function(a,b){return Y.call(a,b)>0},{doNotCoerseToFloating:!0}),ta=n(function(a,b){return a=b},function(a,b){return Y.call(a,b)>=0},{doNotCoerseToFloating:!0}),pb=n(function(a,b){return a<=b},function(a,b){return Y.call(a,b)<=0},{doNotCoerseToFloating:!0}),i=function(a,b){this.n=a;this.d=b};i.prototype.toString=function(){return T(this.d)?this.n.toString()+"":this.n.toString()+"/"+this.d.toString()}; i.prototype.level=1;i.prototype.liftTo=function(a){return a.level===2?new d(B(this.n,this.d)):a.level===3?new g(this,0):l("invalid level of Number",this,a)};i.prototype.isFinite=function(){return!0};i.prototype.equals=function(a){return a instanceof i&&$a(this.n,a.n)&&$a(this.d,a.d)};i.prototype.isInteger=function(){return T(this.d)};i.prototype.isRational=function(){return!0};i.prototype.isReal=function(){return!0};i.prototype.add=function(a){return i.makeInstance(nb(u(this.n,a.d),u(this.d,a.n)), u(this.d,a.d))};i.prototype.subtract=function(a){return i.makeInstance(ob(u(this.n,a.d),u(this.d,a.n)),u(this.d,a.d))};i.prototype.negate=function(){return i.makeInstance(-this.n,this.d)};i.prototype.multiply=function(a){return i.makeInstance(u(this.n,a.n),u(this.d,a.d))};i.prototype.divide=function(a){(r(this.d)||r(a.n))&&l("/: division by zero",this,a);return i.makeInstance(u(this.n,a.d),u(this.d,a.n))};i.prototype.toExact=function(){return this};i.prototype.toInexact=function(){return d.makeInstance(this.toFixnum())}; i.prototype.isExact=function(){return!0};i.prototype.isInexact=function(){return!1};i.prototype.toFixnum=function(){return B(this.n,this.d)};i.prototype.numerator=function(){return this.n};i.prototype.denominator=function(){return this.d};i.prototype.greaterThan=function(a){return ab(u(this.n,a.d),u(this.d,a.n))};i.prototype.greaterThanOrEqual=function(a){return bb(u(this.n,a.d),u(this.d,a.n))};i.prototype.lessThan=function(a){return ta(u(this.n,a.d),u(this.d,a.n))};i.prototype.lessThanOrEqual=function(a){return pb(u(this.n, a.d),u(this.d,a.n))};i.prototype.integerSqrt=function(){var a=D(this);return va(a)?S(z(a)):E(a)?S(z(a)):g.makeInstance(S(z(M(a))),S(z(ca(a))))};i.prototype.sqrt=function(){if(bb(this.n,0)){var a=D(this.n),b=D(this.d);return s(z(a),a)&&s(z(b),b)?i.makeInstance(a,b):d.makeInstance(B(a,b))}else return a=D(x(this.n)),b=D(this.d),s(z(a),a)&&s(z(b),b)?g.makeInstance(0,i.makeInstance(a,b)):g.makeInstance(0,d.makeInstance(B(a,b)))};i.prototype.abs=function(){return i.makeInstance(A(this.n),this.d)};i.prototype.floor= function(){var a=fa(this.n,this.d);return ta(this.n,0)?w(a,1):a};i.prototype.ceiling=function(){var a=fa(this.n,this.d);return ta(this.n,0)?a:m(a,1)};i.prototype.conjugate=function(){return this};i.prototype.magnitude=i.prototype.abs;i.prototype.log=function(){return d.makeInstance(Math.log(this.n/this.d))};i.prototype.angle=function(){return r(this.n)?0:ab(this.n,0)?0:d.pi};i.prototype.tan=function(){return d.makeInstance(Math.tan(B(this.n,this.d)))};i.prototype.atan=function(){return d.makeInstance(Math.atan(B(this.n, this.d)))};i.prototype.cos=function(){return d.makeInstance(Math.cos(B(this.n,this.d)))};i.prototype.sin=function(){return d.makeInstance(Math.sin(B(this.n,this.d)))};i.prototype.expt=function(a){return O(a)&&ma(a,0)?Za(this,a):d.makeInstance(Math.pow(B(this.n,this.d),B(a.n,a.d)))};i.prototype.exp=function(){return d.makeInstance(Math.exp(B(this.n,this.d)))};i.prototype.acos=function(){return d.makeInstance(Math.acos(B(this.n,this.d)))};i.prototype.asin=function(){return d.makeInstance(Math.asin(B(this.n, this.d)))};i.prototype.imaginaryPart=function(){return 0};i.prototype.realPart=function(){return this};i.prototype.round=function(){if(s(this.d,2)){var a=B(this.n,this.d),b=Math.floor(a),a=Math.ceil(a);return r(b%2)?b:a}else return Math.round(this.n/this.d)};i.makeInstance=function(a,b){a===void 0&&l("n undefined",a,b);b===void 0&&(b=1);ta(b,0)&&(a=x(a),b=x(b));var c=sa(A(a),A(b)),a=fa(a,c),b=fa(b,c);return T(b)||r(a)?a:new i(a,b)};var d=function(a){this.n=a},ga=new d(Number.NaN),n=new d(Number.POSITIVE_INFINITY), cb=new d(Number.NEGATIVE_INFINITY),db=new d(Number.POSITIVE_INFINITY),eb=new d(Number.NEGATIVE_INFINITY),L=new d(0),fb=new d(0);d.pi=new d(Math.PI);d.e=new d(Math.E);d.nan=ga;d.inf=n;d.neginf=cb;d.makeInstance=function(a){if(isNaN(a))return d.nan;else if(a===Number.POSITIVE_INFINITY)return d.inf;else if(a===Number.NEGATIVE_INFINITY)return d.neginf;else if(a===0)return 1/a===-Infinity?L:fb;return new d(a)};d.prototype.isExact=function(){return!1};d.prototype.isInexact=function(){return!0};d.prototype.isFinite= function(){return isFinite(this.n)||this===db||this===eb};d.prototype.toExact=function(){(!isFinite(this.n)||isNaN(this.n))&&l("toExact: no exact representation for "+this,this);var a=this.n.toString().match(/^(.*)\.(.*)$/);return a?(parseInt(a[1]),parseInt(a[2]),a=Math.pow(10,a[2].length),i.makeInstance(Math.round(this.n*a),a)):this.n};d.prototype.toInexact=function(){return this};d.prototype.isInexact=function(){return!0};d.prototype.level=2;d.prototype.liftTo=function(a){return a.level===3?new g(this, 0):l("invalid level of Number",this,a)};d.prototype.toString=function(){if(isNaN(this.n))return"+nan.0";if(this.n===Number.POSITIVE_INFINITY)return"+inf.0";if(this.n===Number.NEGATIVE_INFINITY)return"-inf.0";if(this===L)return"-0.0";var a=this.n.toString();return a.match("\\.")?a:a+".0"};d.prototype.equals=function(a){return a instanceof d&&this.n===a.n};d.prototype.isRational=function(){return this.isFinite()};d.prototype.isInteger=function(){return this.isFinite()&&this.n===Math.floor(this.n)}; d.prototype.isReal=function(){return!0};var ha=function(a){return J(a,0)?-1:U(a,0)?1:a===L?-1:0};d.prototype.add=function(a){return this.isFinite()&&a.isFinite()?d.makeInstance(this.n+a.n):isNaN(this.n)||isNaN(a.n)?ga:this.isFinite()&&!a.isFinite()?a:!this.isFinite()&&a.isFinite()?this:ha(this)*ha(a)===1?this:ga};d.prototype.subtract=function(a){return this.isFinite()&&a.isFinite()?d.makeInstance(this.n-a.n):isNaN(this.n)||isNaN(a.n)?ga:!this.isFinite()&&!a.isFinite()?ha(this)===ha(a)?ga:this:this.isFinite()? k(a,-1):this};d.prototype.negate=function(){return d.makeInstance(-this.n)};d.prototype.multiply=function(a){return d.makeInstance(this.n*a.n)};d.prototype.divide=function(a){return d.makeInstance(this.n/a.n)};d.prototype.toFixnum=function(){return this.n};d.prototype.numerator=function(){var a=this.n.toString().match(/^(.*)\.(.*)$/);if(a){var b=parseInt(a[2]),a=Math.pow(10,a[2].length),b=sa(a,b);return d.makeInstance(Math.round(this.n*(a/b)))}else return this};d.prototype.denominator=function(){var a= this.n.toString().match(/^(.*)\.(.*)$/);if(a){var b=parseInt(a[2]),a=Math.pow(10,a[2].length),b=sa(a,b);return d.makeInstance(Math.round(a/b))}else return d.makeInstance(1)};d.prototype.floor=function(){return d.makeInstance(Math.floor(this.n))};d.prototype.ceiling=function(){return d.makeInstance(Math.ceil(this.n))};d.prototype.greaterThan=function(a){return this.n>a.n};d.prototype.greaterThanOrEqual=function(a){return this.n>=a.n};d.prototype.lessThan=function(a){return this.n=0?d.makeInstance(Math.floor(Math.sqrt(this.n))):g.makeInstance(fb,d.makeInstance(Math.floor(Math.sqrt(-this.n))));else l("integerSqrt: can only be applied to an integer",this)};d.prototype.sqrt=function(){return this.n<0?g.makeInstance(0,d.makeInstance(Math.sqrt(-this.n))):d.makeInstance(Math.sqrt(this.n))};d.prototype.abs=function(){return d.makeInstance(Math.abs(this.n))};d.prototype.log= function(){return this.n<0?(new g(this,0)).log():d.makeInstance(Math.log(this.n))};d.prototype.angle=function(){return 0===this.n?0:this.n>0?0:d.pi};d.prototype.tan=function(){return d.makeInstance(Math.tan(this.n))};d.prototype.atan=function(){return d.makeInstance(Math.atan(this.n))};d.prototype.cos=function(){return d.makeInstance(Math.cos(this.n))};d.prototype.sin=function(){return d.makeInstance(Math.sin(this.n))};d.prototype.expt=function(a){return this.n===1?(a.isFinite()||isNaN(a.n),this): d.makeInstance(Math.pow(this.n,a.n))};d.prototype.exp=function(){return d.makeInstance(Math.exp(this.n))};d.prototype.acos=function(){return d.makeInstance(Math.acos(this.n))};d.prototype.asin=function(){return d.makeInstance(Math.asin(this.n))};d.prototype.imaginaryPart=function(){return 0};d.prototype.realPart=function(){return this};d.prototype.round=function(){return isFinite(this.n)?this===L?this:Math.abs(Math.floor(this.n)-this.n)===0.5?Math.floor(this.n)%2===0?d.makeInstance(Math.floor(this.n)): d.makeInstance(Math.ceil(this.n)):d.makeInstance(Math.round(this.n)):this};d.prototype.conjugate=function(){return this};d.prototype.magnitude=d.prototype.abs;var g=function(a,b){this.r=a;this.i=b};g.makeInstance=function(a,b){b===void 0&&(b=0);if(W(b)&&t(b)&&r(b))return a;if(aa(a)||aa(b))a=ba(a),b=ba(b);return new g(a,b)};g.prototype.toString=function(){var a=this.r.toString(),b=this.i.toString();return b[0]==="-"||b[0]==="+"?a+b+"i":a+"+"+b+"i"};g.prototype.isFinite=function(){return(typeof this.r=== "number"?isFinite(this.r):this.r.isFinite())&&(typeof this.i==="number"?isFinite(this.i):this.i.isFinite())};g.prototype.isRational=function(){return va(this.r)&&q(this.i,0)};g.prototype.isInteger=function(){return t(this.r)&&q(this.i,0)};g.prototype.toExact=function(){return g.makeInstance(S(this.r),S(this.i))};g.prototype.toInexact=function(){return g.makeInstance(ba(this.r),ba(this.i))};g.prototype.isExact=function(){return W(this.r)&&W(this.i)};g.prototype.isInexact=function(){return aa(this.r)|| aa(this.i)};g.prototype.level=3;g.prototype.liftTo=function(a){l("Don't know how to lift Complex number",this,a)};g.prototype.equals=function(a){return a instanceof g&&s(this.r,a.r)&&s(this.i,a.i)};g.prototype.greaterThan=function(a){(!this.isReal()||!a.isReal())&&l(">: expects argument of type real number",this,a);return U(this.r,a.r)};g.prototype.greaterThanOrEqual=function(a){(!this.isReal()||!a.isReal())&&l(">=: expects argument of type real number",this,a);return ma(this.r,a.r)};g.prototype.lessThan= function(a){(!this.isReal()||!a.isReal())&&l("<: expects argument of type real number",this,a);return J(this.r,a.r)};g.prototype.lessThanOrEqual=function(a){(!this.isReal()||!a.isReal())&&l("<=: expects argument of type real number",this,a);return da(this.r,a.r)};g.prototype.abs=function(){s(this.i,0).valueOf()||l("abs: expects argument of type real number",this);return A(this.r)};g.prototype.toFixnum=function(){s(this.i,0).valueOf()||l("toFixnum: expects argument of type real number",this);return I(this.r)}; g.prototype.numerator=function(){this.isReal()||l("numerator: can only be applied to real number",this);return ea(this.n)};g.prototype.denominator=function(){this.isReal()||l("floor: can only be applied to real number",this);return Qa(this.n)};g.prototype.add=function(a){return g.makeInstance(m(this.r,a.r),m(this.i,a.i))};g.prototype.subtract=function(a){return g.makeInstance(w(this.r,a.r),w(this.i,a.i))};g.prototype.negate=function(){return g.makeInstance(x(this.r),x(this.i))};g.prototype.multiply= function(a){if(a.isReal())return g.makeInstance(k(this.r,a.r),k(this.i,a.r));var b=w(k(this.r,a.r),k(this.i,a.i)),a=m(k(this.r,a.i),k(this.i,a.r));return g.makeInstance(b,a)};g.prototype.divide=function(a){var b,c,e,j,d;return a.isReal()?g.makeInstance(o(this.r,a.r),o(this.i,a.r)):this.isInexact()||a.isInexact()?(b=this.r,c=this.i,e=a.r,j=a.i,da(A(j),A(e))?(d=o(j,e),a=o(m(b,k(c,d)),m(e,k(j,d))),b=o(w(c,k(b,d)),m(e,k(j,d)))):(d=o(e,j),a=o(m(k(b,d),c),m(k(e,d),j)),b=o(w(k(c,d),b),m(k(e,d),j))),g.makeInstance(a, b)):(c=Sa(a),b=k(this,c),c=M(k(a,c)),g.makeInstance(o(M(b),c),o(ca(b),c)))};g.prototype.conjugate=function(){return g.makeInstance(this.r,w(0,this.i))};g.prototype.magnitude=function(){var a=m(k(this.r,this.r),k(this.i,this.i));return D(a)};g.prototype.isReal=function(){return q(this.i,0)};g.prototype.integerSqrt=function(){if(t(this))return Ya(this.r);else l("integerSqrt: can only be applied to an integer",this)};g.prototype.sqrt=function(){if(this.isReal())return D(this.r);var a=m(this.magnitude(), this.r),b=D(o(a,2)),a=o(this.i,D(k(a,2)));return g.makeInstance(b,a)};g.prototype.log=function(){var a=this.magnitude(),b=this.angle();return m(na(a),k(b,G))};g.prototype.angle=function(){if(this.isReal())return Ta(this.r);if(s(0,this.r)){var a=o(d.pi,2);return U(this.i,0)?a:x(a)}else return a=wa(o(A(this.i),A(this.r))),U(this.r,0)?U(this.i,0)?a:x(a):U(this.i,0)?w(d.pi,a):w(a,d.pi)};var G=g.makeInstance(0,1),gb=g.makeInstance(0,-1);g.prototype.tan=function(){return o(this.sin(),this.cos())};g.prototype.atan= function(){return s(this,G)||s(this,gb)?cb:k(G,k(d.makeInstance(0.5),na(o(m(G,this),m(G,w(0,this))))))};g.prototype.cos=function(){if(this.isReal())return oa(this.r);var a=k(this,G),b=x(a),a=m(F(a),F(b));return o(a,2)};g.prototype.sin=function(){if(this.isReal())return pa(this.r);var a=k(this,G),b=x(a),c=g.makeInstance(0,2),a=w(F(a),F(b));return o(a,c)};g.prototype.expt=function(a){if(O(a)&&ma(a,0))return Za(this,a);a=k(a,this.log());return F(a)};g.prototype.exp=function(){var a=F(this.r),b=oa(this.i), c=pa(this.i);return k(a,m(b,k(c,G)))};g.prototype.acos=function(){if(this.isReal())return Va(this.r);var a=o(d.pi,2),b=k(this,G),c=D(w(1,X(this))),b=na(m(b,c)),b=k(b,G);return m(a,b)};g.prototype.asin=function(){if(this.isReal())return Wa(this.r);var a=w(1,X(this)),a=D(a);return k(2,wa(o(this,m(1,a))))};g.prototype.ceiling=function(){this.isReal()||l("ceiling: can only be applied to real number",this);return Ra(this.r)};g.prototype.floor=function(){this.isReal()||l("floor: can only be applied to real number", this);return z(this.r)};g.prototype.imaginaryPart=function(){return this.i};g.prototype.realPart=function(){return this.r};g.prototype.round=function(){this.isReal()||l("round: can only be applied to real number",this);return Xa(this.r)};var qb=/^([+-]?\d+)\/(\d+)$/,rb=/^([+-]?[\d\w/\.]*)([+-])([\d\w/\.]*)i$/,sb=/^[+-]?\d+$/,tb=/^([+-]?\d*)\.(\d*)$/,La=/^([+-]?\d*\.?\d*)[Ee](\+?\d+)$/,ia=function(a){var b=a.match(qb);if(b)return i.makeInstance(ia(b[1]),ia(b[2]));if(b=a.match(rb))return g.makeInstance(ia(b[1]|| "0"),ia(b[2]+(b[3]||"1")));if(a==="+nan.0"||a==="-nan.0")return d.nan;if(a==="+inf.0")return d.inf;if(a==="-inf.0")return d.neginf;if(a==="-0.0")return L;return a.match(tb)||a.match(La)?d.makeInstance(Number(a)):a.match(sb)?(b=Number(a),K(b)?v(a):b):!1};typeof navigator!=="undefined"&&navigator.appName=="Microsoft Internet Explorer"?(f.prototype.am=ib,n=30):typeof navigator!=="undefined"&&navigator.appName!="Netscape"?(f.prototype.am=hb,n=26):(f.prototype.am=jb,n=28);f.prototype.DB=n;f.prototype.DM= (1<=0?a.mod(this.m):a};P.prototype.revert=function(a){return a};P.prototype.reduce=function(a){a.divRemTo(this.m,null,a)};P.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)}; P.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};Q.prototype.convert=function(a){var b=p();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);a.s<0&&b.compareTo(f.ZERO)>0&&this.m.subTo(b,b);return b};Q.prototype.revert=function(a){var b=p();a.copyTo(b);this.reduce(b);return b};Q.prototype.reduce=function(a){for(;a.t<=this.mt2;)a[a.t++]=0;for(var b=0;b>15)*this.mpl&this.um)<<15)&a.DM,c=b+this.m.t;for(a[c]+=this.m.am(0, e,a,b,0,this.m.t);a[c]>=a.DV;)a[c]-=a.DV,a[++c]++}a.clamp();a.drShiftTo(this.m.t,a);a.compareTo(this.m)>=0&&a.subTo(this.m,a)};Q.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};Q.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};f.prototype.copyTo=function(a){for(var b=this.t-1;b>=0;--b)a[b]=this[b];a.t=this.t;a.s=this.s};f.prototype.fromInt=function(a){this.t=1;this.s=a<0?-1:0;a>0?this[0]=a:a<-1?this[0]=a+DV:this.t=0};f.prototype.fromString=function(a,b){var c;if(b==16)c= 4;else if(b==8)c=3;else if(b==256)c=8;else if(b==2)c=1;else if(b==32)c=5;else if(b==4)c=2;else{this.fromRadix(a,b);return}this.s=this.t=0;for(var e=a.length,j=!1,d=0;--e>=0;){var g=c==8?a[e]&255:xa(a,e);g<0?a.charAt(e)=="-"&&(j=!0):(j=!1,d==0?this[this.t++]=g:d+c>this.DB?(this[this.t-1]|=(g&(1<>this.DB-d):this[this.t-1]|=g<=this.DB&&(d-=this.DB))}if(c==8&&(a[0]&128)!=0)this.s=-1,d>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==a;)--this.t};f.prototype.dlShiftTo=function(a,b){var c;for(c=this.t-1;c>=0;--c)b[c+a]=this[c];for(c=a-1;c>=0;--c)b[c]=0;b.t=this.t+a;b.s=this.s};f.prototype.drShiftTo=function(a,b){for(var c=a;c=0;--h)b[h+f+1]=this[h]>> e|g,g=(this[h]&d)<=0;--h)b[h]=0;b[f]=g;b.t=this.t+f+1;b.s=this.s;b.clamp()};f.prototype.rShiftTo=function(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)b.t=0;else{var e=a%this.DB,d=this.DB-e,f=(1<>e;for(var g=c+1;g>e;e>0&&(b[this.t-c-1]|=(this.s&f)<>=this.DB;if(a.t< this.t){for(e-=a.s;c>=this.DB;e+=this.s}else{for(e+=this.s;c>=this.DB;e-=a.s}b.s=e<0?-1:0;e<-1?b[c++]=this.DV+e:e>0&&(b[c++]=e);b.t=c;b.clamp()};f.prototype.multiplyTo=function(a,b){var c=this.abs(),e=a.abs(),d=c.t;for(b.t=d+e.t;--d>=0;)b[d]=0;for(d=0;d=0;)a[c]=0;for(c= 0;c=b.DV)a[c+b.t]-=b.DV,a[c+b.t+1]=1}a.t>0&&(a[a.t-1]+=b.am(c,b[c],a,2*c,0,1));a.s=0;a.clamp()};f.prototype.divRemTo=function(a,b,c){var e=a.abs();if(!(e.t<=0)){var d=this.abs();if(d.t0?(e.lShiftTo(i,g),d.lShiftTo(i,c)):(e.copyTo(g),d.copyTo(c));e=g.t;d=g[e-1];if(d!=0){var l=d*(1<1?g[e-2]>>this.F2:0),k=this.FV/l,l=(1<=0&&(c[c.t++]=1,c.subTo(q,c));f.ONE.dlShiftTo(e,q);for(q.subTo(g,g);g.t=0;){var r=c[--m]==d?this.DM:Math.floor(c[m]*k+(c[m-1]+n)*l);if((c[m]+=g.am(0,r,c,o,0,e))0&&c.rShiftTo(i,c);h<0&&f.ZERO.subTo(c,c)}}}};f.prototype.invDigit= function(){if(this.t<1)return 0;var a=this[0];if((a&1)==0)return 0;var b=a&3,b=b*(2-(a&15)*b)&15,b=b*(2-(a&255)*b)&255,b=b*(2-((a&65535)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV;return b>0?this.DV-b:-b};f.prototype.isEven=function(){return(this.t>0?this[0]&1:this.s)==0};f.prototype.exp=function(a,b){if(a>4294967295||a<1)return f.ONE;var c=p(),e=p(),d=b.convert(this),g=ka(a)-1;for(d.copyTo(c);--g>=0;)if(b.sqrTo(c,e),(a&1<0)b.mulTo(e,d,c);else var h=c,c=e,e=h;return b.revert(c)};f.prototype.toString= function(a){if(this.s<0)return"-"+this.negate().toString(a);if(a==16)a=4;else if(a==8)a=3;else if(a==2)a=1;else if(a==32)a=5;else if(a==4)a=2;else return this.toRadix(a);var b=(1<0){if(g>g)>0)e=!0,d.push("0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));for(;f>=0;)g>(g+=this.DB-a)):(c=this[f]>>(g-=a)&b,g<=0&&(g+=this.DB,--f)),c>0&&(e=!0),e&&d.push("0123456789abcdefghijklmnopqrstuvwxyz".charAt(c))}return e? d.join(""):"0"};f.prototype.negate=function(){var a=p();f.ZERO.subTo(this,a);return a};f.prototype.abs=function(){return this.s<0?this.negate():this};f.prototype.compareTo=Y;f.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+ka(this[this.t-1]^this.s&this.DM)};f.prototype.mod=ya;f.prototype.modPowInt=function(a,b){var c;c=a<256||b.isEven()?new P(b):new Q(b);return this.exp(a,c)};f.ZERO=N(0);f.ONE=N(1);$.prototype.convert=Ha;$.prototype.revert=Ha;$.prototype.mulTo=function(a,b,c){a.multiplyTo(b, c)};$.prototype.sqrTo=function(a,b){a.squareTo(b)};V.prototype.convert=function(a){if(a.s<0||a.t>2*this.m.t)return a.mod(this.m);else if(a.compareTo(this.m)<0)return a;else{var b=p();a.copyTo(b);this.reduce(b);return b}};V.prototype.revert=function(a){return a};V.prototype.reduce=function(a){a.drShiftTo(this.m.t-1,this.r2);if(a.t>this.m.t+1)a.t=this.m.t+1,a.clamp();this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);a.compareTo(this.r2)<0;)a.dAddOffset(1, this.m.t+1);for(a.subTo(this.r2,a);a.compareTo(this.m)>=0;)a.subTo(this.m,a)};V.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};V.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var C=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401, 409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],ub=67108864/C[C.length-1];f.prototype.chunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};f.prototype.toRadix=function(a){a==null&&(a=10);if(this.signum()==0||a<2||a>36)return"0";var b=this.chunkSize(a),b=Math.pow(a,b),c=N(b),e=p(),d=p(),f="";for(this.divRemTo(c,e,d);e.signum()>0;)f=(b+d.intValue()).toString(a).substr(1)+f,e.divRemTo(c,e,d);return d.intValue().toString(a)+f};f.prototype.fromRadix=function(a, b){this.fromInt(0);b==null&&(b=10);for(var c=this.chunkSize(b),e=Math.pow(b,c),d=!1,g=0,h=0,i=0;i=c&&(this.dMultiply(e),this.dAddOffset(h,0),h=g=0))}g>0&&(this.dMultiply(Math.pow(b,g)),this.dAddOffset(h,0));d&&f.ZERO.subTo(this,this)};f.prototype.fromNumber=function(a,b,c){if("number"==typeof b)if(a<2)this.fromInt(1);else{this.fromNumber(a,c);this.testBit(a-1)||this.bitwiseTo(f.ONE.shiftLeft(a-1),ua,this);for(this.isEven()&& this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(f.ONE.shiftLeft(a-1),this)}else{var c=[],e=a&7;c.length=(a>>3)+1;b.nextBytes(c);e>0?c[0]&=(1<>=this.DB;if(a.t>=this.DB;e+=this.s}else{for(e+=this.s;c>=this.DB;e+=a.s}b.s=e<0?-1:0;e>0?b[c++]=e:e<-1&&(b[c++]=this.DV+e);b.t=c;b.clamp()};f.prototype.dMultiply=function(a){this[this.t]=this.am(0,a-1,this, 0,0,this.t);++this.t;this.clamp()};f.prototype.dAddOffset=function(a,b){if(a!=0){for(;this.t<=b;)this[this.t++]=0;for(this[b]+=a;this[b]>=this.DV;)this[b]-=this.DV,++b>=this.t&&(this[this.t++]=0),++this[b]}};f.prototype.multiplyLowerTo=function(a,b,c){var e=Math.min(this.t+a.t,b);c.s=0;for(c.t=e;e>0;)c[--e]=0;var d;for(d=c.t-this.t;e=0;)c[e]=0;for(e=Math.max(b-this.t,0);e0)if(b==0)c=this[0]%a;else for(var e=this.t-1;e>=0;--e)c=(b*c+this[e])%a;return c};f.prototype.millerRabin=function(a){var b=this.subtract(f.ONE),c=b.getLowestSetBit();if(c<=0)return!1;var e=b.shiftRight(c),a=a+1>>1;if(a>C.length)a=C.length;for(var d=p(), g=0;g>24};f.prototype.shortValue=function(){return this.t==0?this.s:this[0]<<16>>16};f.prototype.signum=function(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1};f.prototype.toByteArray=function(){var a=this.t,b=[];b[0]=this.s;var c=this.DB-a*this.DB%8,e,d=0;if(a-- >0){if(c>c)!=(this.s&this.DM)>>c)b[d++]=e|this.s<=0;)if(c<8?(e=(this[a]&(1<>(c+=this.DB- 8)):(e=this[a]>>(c-=8)&255,c<=0&&(c+=this.DB,--a)),(e&128)!=0&&(e|=-256),d==0&&(this.s&128)!=(e&128)&&++d,d>0||e!=this.s)b[d++]=e}return b};f.prototype.equals=Z;f.prototype.min=function(a){return this.compareTo(a)<0?this:a};f.prototype.max=function(a){return this.compareTo(a)>0?this:a};f.prototype.and=function(a){var b=p();this.bitwiseTo(a,kb,b);return b};f.prototype.or=function(a){var b=p();this.bitwiseTo(a,ua,b);return b};f.prototype.xor=function(a){var b=p();this.bitwiseTo(a,za,b);return b};f.prototype.andNot= function(a){var b=p();this.bitwiseTo(a,Aa,b);return b};f.prototype.not=function(){for(var a=p(),b=0;b>=16,c+=16);(a&255)==0&&(a>>=8,c+=8);(a&15)==0&&(a>>=4,c+=4);(a&3)==0&&(a>>=2,c+=2);(a&1)==0&&++c;a=c}return b+a}return this.s<0?this.t*this.DB:-1};f.prototype.bitCount=function(){for(var a=0,b=this.s&this.DM,c=0;c=this.t?this.s!=0:(this[b]&1<1){c=p();for(f.sqrTo(g[1],c);h<=l;)g[h]=p(),f.mulTo(c,g[h-2],g[h]), h+=2}for(var k=a.t-1,m,o=!0,n=p(),c=ka(a[k])-1;k>=0;){c>=i?m=a[k]>>c-i&l:(m=(a[k]&(1<0&&(m|=a[k-1]>>this.DB+c-i));for(h=e;(m&1)==0;)m>>=1,--h;if((c-=h)<0)c+=this.DB,--k;if(o)g[m].copyTo(d),o=!1;else{for(;h>1;)f.sqrTo(d,n),f.sqrTo(n,d),h-=2;h>0?f.sqrTo(d,n):(h=d,d=n,n=h);f.mulTo(n,g[m],d)}for(;k>=0&&(a[k]&1<=0?(c.subTo(e,c),b&&d.subTo(h,d),g.subTo(i,g)):(e.subTo(c,e),b&&h.subTo(d,h),i.subTo(g,i))}if(e.compareTo(f.ONE)!= 0)return f.ZERO;if(i.compareTo(a)>=0)return i.subtract(a);if(i.signum()<0)i.addTo(a,i);else return i;return i.signum()<0?i.add(a):i};f.prototype.pow=Ia;f.prototype.gcd=Ja;f.prototype.isProbablePrime=function(a){var b,c=this.abs();if(c.t==1&&c[0]<=C[C.length-1]){for(b=0;b0};f.prototype.greaterThanOrEqual=function(a){return this.compareTo(a)>= 0};f.prototype.lessThan=function(a){return this.compareTo(a)<0};f.prototype.lessThanOrEqual=function(a){return this.compareTo(a)<=0};f.prototype.divide=function(a){var b=Ga.call(this,a);return b[1].compareTo(f.ZERO)===0?b[0]:m(b[0],i.makeInstance(b[1],a))};f.prototype.numerator=function(){return this};f.prototype.denominator=function(){return 1};(function(){var a=function(a,c){for(;!da(X(c),a)||!J(a,X(m(c,1)));)c=z(o(m(c,z(o(a,c))),2));return c};f.prototype.integerSqrt=function(){var b;return ha(this)>= 0?a(this,this):(b=this.negate(),g.makeInstance(0,a(b,b)))}})();(function(){f.prototype.sqrt=function(){var a=this.integerSqrt(),b;if(q(X(a),this))return a;b=I(this);return isFinite(b)?b>=0?d.makeInstance(Math.sqrt(b)):g.makeInstance(0,d.makeInstance(Math.sqrt(-b))):a}})();f.prototype.floor=function(){return this};f.prototype.ceiling=function(){return this};f.prototype.expt=function(a){return Ia.call(this,a)};f.prototype.imaginaryPart=function(){return 0};f.prototype.realPart=function(){return this}; n=function(){return function(a,b,c){var e=512;if(c&&typeof c.limit!=="undefined")e=c.limit;t(a)||l("toRepeatingDecimal: n "+a.toString()+" is not an integer.");t(b)||l("toRepeatingDecimal: d "+b.toString()+" is not an integer.");s(b,0)&&l("toRepeatingDecimal: d equals 0");J(b,0)&&l("toRepeatingDecimal: d < 0");c=J(a,0)?"-":"";a=A(a);c+=qa(a,b);a:{var a=ra(a,b),d=e,e=[],f={};for(f[a]=!0;;){if(d--<=0){b=[e.join(""),"..."];break a}var g=qa(k(a,10),b),a=ra(k(a,10),b);e.push(g.toString());if(f[a])break; else f[a]=!0}f=a;for(d=[];;)if(g=qa(k(a,10),b),a=ra(k(a,10),b),d.push(g.toString()),s(a,f))break;b=e.join("");for(a=d.join("");b.length>=a.length&&b.substring(b.length-a.length)===a;)b=b.substring(0,b.length-a.length);b=[b,a]}return[c].concat(b)}}();h.fromFixnum=function(a){if(isNaN(a)||!isFinite(a))return d.makeInstance(a);var b=Math.floor(a);return b===a?K(b)?v(Na(a+"")):b:d.makeInstance(a)};h.fromString=ia;h.makeBignum=v;h.makeRational=i.makeInstance;h.makeFloat=d.makeInstance;h.makeComplex=g.makeInstance; h.makeComplexPolar=function(a,b){return q(b,0)?a:g.makeInstance(k(a,oa(b)),k(a,pa(b)))};h.pi=d.pi;h.e=d.e;h.nan=d.nan;h.negative_inf=d.neginf;h.inf=d.inf;h.negative_one=-1;h.zero=0;h.one=1;h.i=G;h.negative_i=gb;h.negative_zero=L;h.onThrowRuntimeError=function(a){throw Error(a);};h.isSchemeNumber=R;h.isRational=va;h.isReal=E;h.isExact=W;h.isInexact=aa;h.isInteger=t;h.toFixnum=I;h.toExact=S;h.toInexact=ba;h.add=m;h.subtract=w;h.multiply=k;h.divide=o;h.equals=s;h.eqv=q;h.approxEquals=function(a,b,c){return J(A(w(a, b)),c)};h.greaterThanOrEqual=ma;h.lessThanOrEqual=da;h.greaterThan=U;h.lessThan=J;h.expt=lb;h.exp=F;h.modulo=Pa;h.numerator=ea;h.denominator=Qa;h.integerSqrt=Ya;h.sqrt=D;h.abs=A;h.quotient=qa;h.remainder=ra;h.floor=z;h.ceiling=Ra;h.conjugate=Sa;h.magnitude=function(a){return typeof a==="number"?Math.abs(a):a.magnitude()};h.log=na;h.angle=Ta;h.tan=Ua;h.atan=wa;h.cos=oa;h.sin=pa;h.tan=Ua;h.acos=Va;h.asin=Wa;h.cosh=function(a){return q(a,0)?d.makeInstance(1):o(m(F(a),F(x(a))),2)};h.sinh=function(a){return o(w(F(a), F(x(a))),2)};h.imaginaryPart=ca;h.realPart=M;h.round=Xa;h.sqr=X;h.gcd=function(a,b){t(a)||l("gcd: the argument "+a.toString()+" is not an integer.",a);for(var c=A(a),e,d,f=0;f