UNPKG

nerdamer-prime

Version:
1 lines 484 kB
var h0=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var qn=h0((ji,H0)=>{var kt=(function(r){"use strict";var t=1e7,e=7,o=9007199254740992,g=me(o),E="0123456789abcdefghijklmnopqrstuvwxyz",L=typeof BigInt=="function";function A(m,f,$,w){return typeof m>"u"?A[0]:typeof f<"u"?+f==10&&!$?_(m):Xe(m,f,$,w):_(m)}function k(m,f){this.value=m,this.sign=f,this.isSmall=!1}k.prototype=Object.create(A.prototype);function H(m){this.value=m,this.sign=m<0,this.isSmall=!0}H.prototype=Object.create(A.prototype);function V(m){this.value=m}V.prototype=Object.create(A.prototype);function J(m){return-o<m&&m<o}function me(m){return m<1e7?[m]:m<1e14?[m%1e7,Math.floor(m/1e7)]:[m%1e7,Math.floor(m/1e7)%1e7,Math.floor(m/1e14)]}function Me(m){$e(m);var f=m.length;if(f<4&&N(m,g)<0)switch(f){case 0:return 0;case 1:return m[0];case 2:return m[0]+m[1]*t;default:return m[0]+(m[1]+m[2]*t)*t}return m}function $e(m){for(var f=m.length;m[--f]===0;);m.length=f+1}function Te(m){for(var f=new Array(m),$=-1;++$<m;)f[$]=0;return f}function Ee(m){return m>0?Math.floor(m):Math.ceil(m)}function Ae(m,f){var $=m.length,w=f.length,x=new Array($),B=0,Z=t,Y,ie;for(ie=0;ie<w;ie++)Y=m[ie]+f[ie]+B,B=Y>=Z?1:0,x[ie]=Y-B*Z;for(;ie<$;)Y=m[ie]+B,B=Y===Z?1:0,x[ie++]=Y-B*Z;return B>0&&x.push(B),x}function a(m,f){return m.length>=f.length?Ae(m,f):Ae(f,m)}function ae(m,f){var $=m.length,w=new Array($),x=t,B,Z;for(Z=0;Z<$;Z++)B=m[Z]-x+f,f=Math.floor(B/x),w[Z]=B-f*x,f+=1;for(;f>0;)w[Z++]=f%x,f=Math.floor(f/x);return w}k.prototype.add=function(m){var f=_(m);if(this.sign!==f.sign)return this.subtract(f.negate());var $=this.value,w=f.value;return f.isSmall?new k(ae($,Math.abs(w)),this.sign):new k(a($,w),this.sign)},k.prototype.plus=k.prototype.add,H.prototype.add=function(m){var f=_(m),$=this.value;if($<0!==f.sign)return this.subtract(f.negate());var w=f.value;if(f.isSmall){if(J($+w))return new H($+w);w=me(Math.abs(w))}return new k(ae(w,Math.abs($)),$<0)},H.prototype.plus=H.prototype.add,V.prototype.add=function(m){return new V(this.value+_(m).value)},V.prototype.plus=V.prototype.add;function ve(m,f){var $=m.length,w=f.length,x=new Array($),B=0,Z=t,Y,ie;for(Y=0;Y<w;Y++)ie=m[Y]-B-f[Y],ie<0?(ie+=Z,B=1):B=0,x[Y]=ie;for(Y=w;Y<$;Y++){if(ie=m[Y]-B,ie<0)ie+=Z;else{x[Y++]=ie;break}x[Y]=ie}for(;Y<$;Y++)x[Y]=m[Y];return $e(x),x}function Ne(m,f,$){var w;return N(m,f)>=0?w=ve(m,f):(w=ve(f,m),$=!$),w=Me(w),typeof w=="number"?($&&(w=-w),new H(w)):new k(w,$)}function ye(m,f,$){var w=m.length,x=new Array(w),B=-f,Z=t,Y,ie;for(Y=0;Y<w;Y++)ie=m[Y]+B,B=Math.floor(ie/Z),ie%=Z,x[Y]=ie<0?ie+Z:ie;return x=Me(x),typeof x=="number"?($&&(x=-x),new H(x)):new k(x,$)}k.prototype.subtract=function(m){var f=_(m);if(this.sign!==f.sign)return this.add(f.negate());var $=this.value,w=f.value;return f.isSmall?ye($,Math.abs(w),this.sign):Ne($,w,this.sign)},k.prototype.minus=k.prototype.subtract,H.prototype.subtract=function(m){var f=_(m),$=this.value;if($<0!==f.sign)return this.add(f.negate());var w=f.value;return f.isSmall?new H($-w):ye(w,Math.abs($),$>=0)},H.prototype.minus=H.prototype.subtract,V.prototype.subtract=function(m){return new V(this.value-_(m).value)},V.prototype.minus=V.prototype.subtract,k.prototype.negate=function(){return new k(this.value,!this.sign)},H.prototype.negate=function(){var m=this.sign,f=new H(-this.value);return f.sign=!m,f},V.prototype.negate=function(){return new V(-this.value)},k.prototype.abs=function(){return new k(this.value,!1)},H.prototype.abs=function(){return new H(Math.abs(this.value))},V.prototype.abs=function(){return new V(this.value>=0?this.value:-this.value)};function Ie(m,f){var $=m.length,w=f.length,x=$+w,B=Te(x),Z=t,Y,ie,oe,ne,le;for(oe=0;oe<$;++oe){ne=m[oe];for(var ge=0;ge<w;++ge)le=f[ge],Y=ne*le+B[oe+ge],ie=Math.floor(Y/Z),B[oe+ge]=Y-ie*Z,B[oe+ge+1]+=ie}return $e(B),B}function he(m,f){var $=m.length,w=new Array($),x=t,B=0,Z,Y;for(Y=0;Y<$;Y++)Z=m[Y]*f+B,B=Math.floor(Z/x),w[Y]=Z-B*x;for(;B>0;)w[Y++]=B%x,B=Math.floor(B/x);return w}function Ce(m,f){for(var $=[];f-- >0;)$.push(0);return $.concat(m)}function we(m,f){var $=Math.max(m.length,f.length);if($<=30)return Ie(m,f);$=Math.ceil($/2);var w=m.slice($),x=m.slice(0,$),B=f.slice($),Z=f.slice(0,$),Y=we(x,Z),ie=we(w,B),oe=we(a(x,w),a(Z,B)),ne=a(a(Y,Ce(ve(ve(oe,Y),ie),$)),Ce(ie,2*$));return $e(ne),ne}function fe(m,f){return-.012*m-.012*f+15e-6*m*f>0}k.prototype.multiply=function(m){var f=_(m),$=this.value,w=f.value,x=this.sign!==f.sign,B;if(f.isSmall){if(w===0)return A[0];if(w===1)return this;if(w===-1)return this.negate();if(B=Math.abs(w),B<t)return new k(he($,B),x);w=me(B)}return fe($.length,w.length)?new k(we($,w),x):new k(Ie($,w),x)},k.prototype.times=k.prototype.multiply;function s(m,f,$){return m<t?new k(he(f,m),$):new k(Ie(f,me(m)),$)}H.prototype._multiplyBySmall=function(m){return J(m.value*this.value)?new H(m.value*this.value):s(Math.abs(m.value),me(Math.abs(this.value)),this.sign!==m.sign)},k.prototype._multiplyBySmall=function(m){return m.value===0?A[0]:m.value===1?this:m.value===-1?this.negate():s(Math.abs(m.value),this.value,this.sign!==m.sign)},H.prototype.multiply=function(m){return _(m)._multiplyBySmall(this)},H.prototype.times=H.prototype.multiply,V.prototype.multiply=function(m){return new V(this.value*_(m).value)},V.prototype.times=V.prototype.multiply;function c(m){var f=m.length,$=Te(f+f),w=t,x,B,Z,Y,ie;for(Z=0;Z<f;Z++){Y=m[Z],B=0-Y*Y;for(var oe=Z;oe<f;oe++)ie=m[oe],x=2*(Y*ie)+$[Z+oe]+B,B=Math.floor(x/w),$[Z+oe]=x-B*w;$[Z+f]=B}return $e($),$}k.prototype.square=function(){return new k(c(this.value),!1)},H.prototype.square=function(){var m=this.value*this.value;return J(m)?new H(m):new k(c(me(Math.abs(this.value))),!1)},V.prototype.square=function(m){return new V(this.value*this.value)};function S(m,f){var $=m.length,w=f.length,x=t,B=Te(f.length),Z=f[w-1],Y=Math.ceil(x/(2*Z)),ie=he(m,Y),oe=he(f,Y),ne,le,ge,ke,Le,We,Qe;for(ie.length<=$&&ie.push(0),oe.push(0),Z=oe[w-1],le=$-w;le>=0;le--){for(ne=x-1,ie[le+w]!==Z&&(ne=Math.floor((ie[le+w]*x+ie[le+w-1])/Z)),ge=0,ke=0,We=oe.length,Le=0;Le<We;Le++)ge+=ne*oe[Le],Qe=Math.floor(ge/x),ke+=ie[le+Le]-(ge-Qe*x),ge=Qe,ke<0?(ie[le+Le]=ke+x,ke=-1):(ie[le+Le]=ke,ke=0);for(;ke!==0;){for(ne-=1,ge=0,Le=0;Le<We;Le++)ge+=ie[le+Le]-x+oe[Le],ge<0?(ie[le+Le]=ge+x,ge=0):(ie[le+Le]=ge,ge=1);ke+=ge}B[le]=ne}return ie=p(ie,Y)[0],[Me(B),Me(ie)]}function O(m,f){for(var $=m.length,w=f.length,x=[],B=[],Z=t,Y,ie,oe,ne,le;$;){if(B.unshift(m[--$]),$e(B),N(B,f)<0){x.push(0);continue}ie=B.length,oe=B[ie-1]*Z+B[ie-2],ne=f[w-1]*Z+f[w-2],ie>w&&(oe=(oe+1)*Z),Y=Math.ceil(oe/ne);do{if(le=he(f,Y),N(le,B)<=0)break;Y--}while(Y);x.push(Y),B=ve(B,le)}return x.reverse(),[Me(x),Me(B)]}function p(m,f){var $=m.length,w=Te($),x=t,B,Z,Y,ie;for(Y=0,B=$-1;B>=0;--B)ie=Y*x+m[B],Z=Ee(ie/f),Y=ie-Z*f,w[B]=Z|0;return[w,Y|0]}function h(m,f){var $,w=_(f);if(L)return[new V(m.value/w.value),new V(m.value%w.value)];var x=m.value,B=w.value,Z;if(B===0)throw new Error("Cannot divide by zero");if(m.isSmall)return w.isSmall?[new H(Ee(x/B)),new H(x%B)]:[A[0],m];if(w.isSmall){if(B===1)return[m,A[0]];if(B==-1)return[m.negate(),A[0]];var Y=Math.abs(B);if(Y<t){$=p(x,Y),Z=Me($[0]);var ie=$[1];return m.sign&&(ie=-ie),typeof Z=="number"?(m.sign!==w.sign&&(Z=-Z),[new H(Z),new H(ie)]):[new k(Z,m.sign!==w.sign),new H(ie)]}B=me(Y)}var oe=N(x,B);if(oe===-1)return[A[0],m];if(oe===0)return[A[m.sign===w.sign?1:-1],A[0]];x.length+B.length<=200?$=S(x,B):$=O(x,B),Z=$[0];var ne=m.sign!==w.sign,le=$[1],ge=m.sign;return typeof Z=="number"?(ne&&(Z=-Z),Z=new H(Z)):Z=new k(Z,ne),typeof le=="number"?(ge&&(le=-le),le=new H(le)):le=new k(le,ge),[Z,le]}k.prototype.divmod=function(m){var f=h(this,m);return{quotient:f[0],remainder:f[1]}},V.prototype.divmod=H.prototype.divmod=k.prototype.divmod,k.prototype.divide=function(m){return h(this,m)[0]},V.prototype.over=V.prototype.divide=function(m){return new V(this.value/_(m).value)},H.prototype.over=H.prototype.divide=k.prototype.over=k.prototype.divide,k.prototype.mod=function(m){return h(this,m)[1]},V.prototype.mod=V.prototype.remainder=function(m){return new V(this.value%_(m).value)},H.prototype.remainder=H.prototype.mod=k.prototype.remainder=k.prototype.mod,k.prototype.pow=function(m){var f=_(m),$=this.value,w=f.value,x,B,Z;if(w===0)return A[1];if($===0)return A[0];if($===1)return A[1];if($===-1)return f.isEven()?A[1]:A[-1];if(f.sign)return A[0];if(!f.isSmall)throw new Error("The exponent "+f.toString()+" is too large.");if(this.isSmall&&J(x=Math.pow($,w)))return new H(Ee(x));for(B=this,Z=A[1];w&!0&&(Z=Z.times(B),--w),w!==0;)w/=2,B=B.square();return Z},H.prototype.pow=k.prototype.pow,V.prototype.pow=function(m){var f=_(m),$=this.value,w=f.value,x=BigInt(0),B=BigInt(1),Z=BigInt(2);if(w===x)return A[1];if($===x)return A[0];if($===B)return A[1];if($===BigInt(-1))return f.isEven()?A[1]:A[-1];if(f.isNegative())return new V(x);for(var Y=this,ie=A[1];(w&B)===B&&(ie=ie.times(Y),--w),w!==x;)w/=Z,Y=Y.square();return ie},k.prototype.modPow=function(m,f){if(m=_(m),f=_(f),f.isZero())throw new Error("Cannot take modPow with modulus 0");var $=A[1],w=this.mod(f);for(m.isNegative()&&(m=m.multiply(A[-1]),w=w.modInv(f));m.isPositive();){if(w.isZero())return A[0];m.isOdd()&&($=$.multiply(w).mod(f)),m=m.divide(2),w=w.square().mod(f)}return $},V.prototype.modPow=H.prototype.modPow=k.prototype.modPow;function N(m,f){if(m.length!==f.length)return m.length>f.length?1:-1;for(var $=m.length-1;$>=0;$--)if(m[$]!==f[$])return m[$]>f[$]?1:-1;return 0}k.prototype.compareAbs=function(m){var f=_(m),$=this.value,w=f.value;return f.isSmall?1:N($,w)},H.prototype.compareAbs=function(m){var f=_(m),$=Math.abs(this.value),w=f.value;return f.isSmall?(w=Math.abs(w),$===w?0:$>w?1:-1):-1},V.prototype.compareAbs=function(m){var f=this.value,$=_(m).value;return f=f>=0?f:-f,$=$>=0?$:-$,f===$?0:f>$?1:-1},k.prototype.compare=function(m){if(m===1/0)return-1;if(m===-1/0)return 1;var f=_(m),$=this.value,w=f.value;return this.sign!==f.sign?f.sign?1:-1:f.isSmall?this.sign?-1:1:N($,w)*(this.sign?-1:1)},k.prototype.compareTo=k.prototype.compare,H.prototype.compare=function(m){if(m===1/0)return-1;if(m===-1/0)return 1;var f=_(m),$=this.value,w=f.value;return f.isSmall?$==w?0:$>w?1:-1:$<0!==f.sign?$<0?-1:1:$<0?1:-1},H.prototype.compareTo=H.prototype.compare,V.prototype.compare=function(m){if(m===1/0)return-1;if(m===-1/0)return 1;var f=this.value,$=_(m).value;return f===$?0:f>$?1:-1},V.prototype.compareTo=V.prototype.compare,k.prototype.equals=function(m){return this.compare(m)===0},V.prototype.eq=V.prototype.equals=H.prototype.eq=H.prototype.equals=k.prototype.eq=k.prototype.equals,k.prototype.notEquals=function(m){return this.compare(m)!==0},V.prototype.neq=V.prototype.notEquals=H.prototype.neq=H.prototype.notEquals=k.prototype.neq=k.prototype.notEquals,k.prototype.greater=function(m){return this.compare(m)>0},V.prototype.gt=V.prototype.greater=H.prototype.gt=H.prototype.greater=k.prototype.gt=k.prototype.greater,k.prototype.lesser=function(m){return this.compare(m)<0},V.prototype.lt=V.prototype.lesser=H.prototype.lt=H.prototype.lesser=k.prototype.lt=k.prototype.lesser,k.prototype.greaterOrEquals=function(m){return this.compare(m)>=0},V.prototype.geq=V.prototype.greaterOrEquals=H.prototype.geq=H.prototype.greaterOrEquals=k.prototype.geq=k.prototype.greaterOrEquals,k.prototype.lesserOrEquals=function(m){return this.compare(m)<=0},V.prototype.leq=V.prototype.lesserOrEquals=H.prototype.leq=H.prototype.lesserOrEquals=k.prototype.leq=k.prototype.lesserOrEquals,k.prototype.isEven=function(){return(this.value[0]&1)===0},H.prototype.isEven=function(){return(this.value&1)===0},V.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},k.prototype.isOdd=function(){return(this.value[0]&1)===1},H.prototype.isOdd=function(){return(this.value&1)===1},V.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},k.prototype.isPositive=function(){return!this.sign},H.prototype.isPositive=function(){return this.value>0},V.prototype.isPositive=H.prototype.isPositive,k.prototype.isNegative=function(){return this.sign},H.prototype.isNegative=function(){return this.value<0},V.prototype.isNegative=H.prototype.isNegative,k.prototype.isUnit=function(){return!1},H.prototype.isUnit=function(){return Math.abs(this.value)===1},V.prototype.isUnit=function(){return this.abs().value===BigInt(1)},k.prototype.isZero=function(){return!1},H.prototype.isZero=function(){return this.value===0},V.prototype.isZero=function(){return this.value===BigInt(0)},k.prototype.isDivisibleBy=function(m){var f=_(m);return f.isZero()?!1:f.isUnit()?!0:f.compareAbs(2)===0?this.isEven():this.mod(f).isZero()},V.prototype.isDivisibleBy=H.prototype.isDivisibleBy=k.prototype.isDivisibleBy;function q(m){var f=m.abs();if(f.isUnit())return!1;if(f.equals(2)||f.equals(3)||f.equals(5))return!0;if(f.isEven()||f.isDivisibleBy(3)||f.isDivisibleBy(5))return!1;if(f.lesser(49))return!0}function P(m,f){for(var $=m.prev(),w=$,x=0,B,Z,Y,ie;w.isEven();)w=w.divide(2),x++;e:for(Y=0;Y<f.length;Y++)if(!m.lesser(f[Y])&&(ie=kt(f[Y]).modPow(w,m),!(ie.isUnit()||ie.equals($)))){for(B=x-1;B!=0;B--){if(ie=ie.square().mod(m),ie.isUnit())return!1;if(ie.equals($))continue e}return!1}return!0}k.prototype.isPrime=function(m){var f=q(this);if(f!==r)return f;var $=this.abs(),w=$.bitLength();if(w<=64)return P($,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var x=Math.log(2)*w.toJSNumber(),B=Math.ceil(m===!0?2*Math.pow(x,2):x),Z=[],Y=0;Y<B;Y++)Z.push(kt(Y+2));return P($,Z)},V.prototype.isPrime=H.prototype.isPrime=k.prototype.isPrime,k.prototype.isProbablePrime=function(m,f){var $=q(this);if($!==r)return $;for(var w=this.abs(),x=m===r?5:m,B=[],Z=0;Z<x;Z++)B.push(kt.randBetween(2,w.minus(2),f));return P(w,B)},V.prototype.isProbablePrime=H.prototype.isProbablePrime=k.prototype.isProbablePrime,k.prototype.modInv=function(m){for(var f=kt.zero,$=kt.one,w=_(m),x=this.abs(),B,Z,Y;!x.isZero();)B=w.divide(x),Z=f,Y=w,f=$,w=x,$=Z.subtract(B.multiply($)),x=Y.subtract(B.multiply(x));if(!w.isUnit())throw new Error(this.toString()+" and "+m.toString()+" are not co-prime");return f.compare(0)===-1&&(f=f.add(m)),this.isNegative()?f.negate():f},V.prototype.modInv=H.prototype.modInv=k.prototype.modInv,k.prototype.next=function(){var m=this.value;return this.sign?ye(m,1,this.sign):new k(ae(m,1),this.sign)},H.prototype.next=function(){var m=this.value;return m+1<o?new H(m+1):new k(g,!1)},V.prototype.next=function(){return new V(this.value+BigInt(1))},k.prototype.prev=function(){var m=this.value;return this.sign?new k(ae(m,1),!0):ye(m,1,this.sign)},H.prototype.prev=function(){var m=this.value;return m-1>-o?new H(m-1):new k(g,!0)},V.prototype.prev=function(){return new V(this.value-BigInt(1))};for(var D=[1];2*D[D.length-1]<=t;)D.push(2*D[D.length-1]);var K=D.length,z=D[K-1];function te(m){return Math.abs(m)<=t}k.prototype.shiftLeft=function(m){var f=_(m).toJSNumber();if(!te(f))throw new Error(String(f)+" is too large for shifting.");if(f<0)return this.shiftRight(-f);var $=this;if($.isZero())return $;for(;f>=K;)$=$.multiply(z),f-=K-1;return $.multiply(D[f])},V.prototype.shiftLeft=H.prototype.shiftLeft=k.prototype.shiftLeft,k.prototype.shiftRight=function(m){var f,$=_(m).toJSNumber();if(!te($))throw new Error(String($)+" is too large for shifting.");if($<0)return this.shiftLeft(-$);for(var w=this;$>=K;){if(w.isZero()||w.isNegative()&&w.isUnit())return w;f=h(w,z),w=f[1].isNegative()?f[0].prev():f[0],$-=K-1}return f=h(w,D[$]),f[1].isNegative()?f[0].prev():f[0]},V.prototype.shiftRight=H.prototype.shiftRight=k.prototype.shiftRight;function ce(m,f,$){f=_(f);for(var w=m.isNegative(),x=f.isNegative(),B=w?m.not():m,Z=x?f.not():f,Y=0,ie=0,oe=null,ne=null,le=[];!B.isZero()||!Z.isZero();)oe=h(B,z),Y=oe[1].toJSNumber(),w&&(Y=z-1-Y),ne=h(Z,z),ie=ne[1].toJSNumber(),x&&(ie=z-1-ie),B=oe[0],Z=ne[0],le.push($(Y,ie));for(var ge=$(w?1:0,x?1:0)!==0?kt(-1):kt(0),ke=le.length-1;ke>=0;ke-=1)ge=ge.multiply(z).add(kt(le[ke]));return ge}k.prototype.not=function(){return this.negate().prev()},V.prototype.not=H.prototype.not=k.prototype.not,k.prototype.and=function(m){return ce(this,m,function(f,$){return f&$})},V.prototype.and=H.prototype.and=k.prototype.and,k.prototype.or=function(m){return ce(this,m,function(f,$){return f|$})},V.prototype.or=H.prototype.or=k.prototype.or,k.prototype.xor=function(m){return ce(this,m,function(f,$){return f^$})},V.prototype.xor=H.prototype.xor=k.prototype.xor;var de=1<<30,Se=(t&-t)*(t&-t)|de;function Ue(m){var f=m.value,$=typeof f=="number"?f|de:typeof f=="bigint"?f|BigInt(de):f[0]+f[1]*t|Se;return $&-$}function Re(m,f){if(f.compareTo(m)<=0){var $=Re(m,f.square(f)),w=$.p,x=$.e,B=w.multiply(f);return B.compareTo(m)<=0?{p:B,e:x*2+1}:{p:w,e:x*2}}return{p:kt(1),e:0}}k.prototype.bitLength=function(){var m=this;return m.compareTo(kt(0))<0&&(m=m.negate().subtract(kt(1))),m.compareTo(kt(0))===0?kt(0):kt(Re(m,kt(2)).e).add(kt(1))},V.prototype.bitLength=H.prototype.bitLength=k.prototype.bitLength;function Ge(m,f){return m=_(m),f=_(f),m.greater(f)?m:f}function et(m,f){return m=_(m),f=_(f),m.lesser(f)?m:f}function qe(m,f){if(m=_(m).abs(),f=_(f).abs(),m.equals(f))return m;if(m.isZero())return f;if(f.isZero())return m;for(var $=A[1],w,x;m.isEven()&&f.isEven();)w=et(Ue(m),Ue(f)),m=m.divide(w),f=f.divide(w),$=$.multiply(w);for(;m.isEven();)m=m.divide(Ue(m));do{for(;f.isEven();)f=f.divide(Ue(f));m.greater(f)&&(x=f,f=m,m=x),f=f.subtract(m)}while(!f.isZero());return $.isUnit()?m:m.multiply($)}function Fe(m,f){return m=_(m).abs(),f=_(f).abs(),m.divide(qe(m,f)).multiply(f)}function De(m,f,$){m=_(m),f=_(f);var w=$||Math.random,x=et(m,f),B=Ge(m,f),Z=B.subtract(x).add(1);if(Z.isSmall)return x.add(Math.floor(w()*Z));for(var Y=j(Z,t).value,ie=[],oe=!0,ne=0;ne<Y.length;ne++){var le=oe?Y[ne]+(ne+1<Y.length?Y[ne+1]/t:0):t,ge=Ee(w()*le);ie.push(ge),ge<Y[ne]&&(oe=!1)}return x.add(A.fromArray(ie,t,!1))}var Xe=function(m,f,$,w){$=$||E,m=String(m),w||(m=m.toLowerCase(),$=$.toLowerCase());var x=m.length,B,Z=Math.abs(f),Y={};for(B=0;B<$.length;B++)Y[$[B]]=B;for(B=0;B<x;B++){var ie=m[B];if(ie!=="-"&&ie in Y&&Y[ie]>=Z){if(ie==="1"&&Z===1)continue;throw new Error(ie+" is not a valid digit in base "+f+".")}}f=_(f);var oe=[],ne=m[0]==="-";for(B=ne?1:0;B<m.length;B++){var ie=m[B];if(ie in Y)oe.push(_(Y[ie]));else if(ie==="<"){var le=B;do B++;while(m[B]!==">"&&B<m.length);oe.push(_(m.slice(le+1,B)))}else throw new Error(ie+" is not a valid character")}return Be(oe,f,ne)};function Be(m,f,$){var w=A[0],x=A[1],B;for(B=m.length-1;B>=0;B--)w=w.add(m[B].times(x)),x=x.times(f);return $?w.negate():w}function Q(m,f){return f=f||E,m<f.length?f[m]:"<"+m+">"}function j(m,f){if(f=kt(f),f.isZero()){if(m.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(f.equals(-1)){if(m.isZero())return{value:[0],isNegative:!1};if(m.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-m.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var $=Array.apply(null,Array(m.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return $.unshift([1]),{value:[].concat.apply([],$),isNegative:!1}}var w=!1;if(m.isNegative()&&f.isPositive()&&(w=!0,m=m.abs()),f.isUnit())return m.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(m.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:w};for(var x=[],B=m,Z;B.isNegative()||B.compareAbs(f)>=0;){Z=B.divmod(f),B=Z.quotient;var Y=Z.remainder;Y.isNegative()&&(Y=f.minus(Y).abs(),B=B.next()),x.push(Y.toJSNumber())}return x.push(B.toJSNumber()),{value:x.reverse(),isNegative:w}}function G(m,f,$){var w=j(m,f);return(w.isNegative?"-":"")+w.value.map(function(x){return Q(x,$)}).join("")}k.prototype.toArray=function(m){return j(this,m)},H.prototype.toArray=function(m){return j(this,m)},V.prototype.toArray=function(m){return j(this,m)},k.prototype.toString=function(m,f){if(m===r&&(m=10),m!==10||f)return G(this,m,f);for(var $=this.value,w=$.length,x=String($[--w]),B="0000000",Z;--w>=0;)Z=String($[w]),x+=B.slice(Z.length)+Z;var Y=this.sign?"-":"";return Y+x},H.prototype.toString=function(m,f){return m===r&&(m=10),m!=10||f?G(this,m,f):String(this.value)},V.prototype.toString=H.prototype.toString,V.prototype.toJSON=k.prototype.toJSON=H.prototype.toJSON=function(){return this.toString()},k.prototype.valueOf=function(){return parseInt(this.toString(),10)},k.prototype.toJSNumber=k.prototype.valueOf,H.prototype.valueOf=function(){return this.value},H.prototype.toJSNumber=H.prototype.valueOf,V.prototype.valueOf=V.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};function F(m){if(J(+m)){var f=+m;if(f===Ee(f))return L?new V(BigInt(f)):new H(f);throw new Error("Invalid integer: "+m)}var $=m[0]==="-";$&&(m=m.slice(1));var w=m.split(/e/i);if(w.length>2)throw new Error("Invalid integer: "+w.join("e"));if(w.length===2){var x=w[1];if(x[0]==="+"&&(x=x.slice(1)),x=+x,x!==Ee(x)||!J(x))throw new Error("Invalid integer: "+x+" is not a valid exponent.");var B=w[0],Z=B.indexOf(".");if(Z>=0&&(x-=B.length-Z-1,B=B.slice(0,Z)+B.slice(Z+1)),x<0)throw new Error("Cannot include negative exponent part for integers");B+=new Array(x+1).join("0"),m=B}var Y=/^([0-9][0-9]*)$/.test(m);if(!Y)throw new Error("Invalid integer: "+m);if(L)return new V(BigInt($?"-"+m:m));for(var ie=[],oe=m.length,ne=e,le=oe-ne;oe>0;)ie.push(+m.slice(le,oe)),le-=ne,le<0&&(le=0),oe-=ne;return $e(ie),new k(ie,$)}function ee(m){if(L)return new V(BigInt(m));if(J(m)){if(m!==Ee(m))throw new Error(m+" is not an integer.");return new H(m)}return F(m.toString())}function _(m){return typeof m=="number"?ee(m):typeof m=="string"?F(m):typeof m=="bigint"?new V(m):m}for(var U=0;U<1e3;U++)A[U]=_(U),U>0&&(A[-U]=_(-U));return A.one=A[1],A.zero=A[0],A.minusOne=A[-1],A.max=Ge,A.min=et,A.gcd=qe,A.lcm=Fe,A.isInstance=function(m){return m instanceof k||m instanceof H||m instanceof V},A.randBetween=De,A.fromArray=function(m,f,$){return Be(m.map(_),_(f||10),$)},A})();typeof H0<"u"&&H0.hasOwnProperty("exports")&&(H0.exports=kt);typeof define=="function"&&define.amd&&define(function(){return kt})});var Rn=h0((Tn,j0)=>{(function(r){"use strict";var t=9e15,e=1e9,o="0123456789abcdef",g="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",E="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",L={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-t,maxE:t,crypto:!1},A,k,H,V,J=!0,me="[DecimalError] ",Me=me+"Invalid argument: ",$e=me+"Precision limit exceeded",Te=me+"crypto unavailable",Ee="[object Decimal]",Ae=Math.floor,a=Math.pow,ae=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ve=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Ne=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,ye=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Ie=1e7,he=7,Ce=9007199254740991,we=g.length-1,fe=E.length-1,s={toStringTag:Ee};s.absoluteValue=s.abs=function(){var u=new this.constructor(this);return u.s<0&&(u.s=1),q(u)},s.ceil=function(){return q(new this.constructor(this),this.e+1,2)},s.clampedTo=s.clamp=function(u,y){var b,I=this,R=I.constructor;if(u=new R(u),y=new R(y),!u.s||!y.s)return new R(NaN);if(u.gt(y))throw Error(Me+y);return b=I.cmp(u),b<0?u:I.cmp(y)>0?y:new R(I)},s.comparedTo=s.cmp=function(u){var y,b,I,R,n=this,i=n.d,l=(u=new n.constructor(u)).d,v=n.s,d=u.s;if(!i||!l)return!v||!d?NaN:v!==d?v:i===l?0:!i^v<0?1:-1;if(!i[0]||!l[0])return i[0]?v:l[0]?-d:0;if(v!==d)return v;if(n.e!==u.e)return n.e>u.e^v<0?1:-1;for(I=i.length,R=l.length,y=0,b=I<R?I:R;y<b;++y)if(i[y]!==l[y])return i[y]>l[y]^v<0?1:-1;return I===R?0:I>R^v<0?1:-1},s.cosine=s.cos=function(){var u,y,b=this,I=b.constructor;return b.d?b.d[0]?(u=I.precision,y=I.rounding,I.precision=u+Math.max(b.e,b.sd())+he,I.rounding=1,b=h(I,Q(I,b)),I.precision=u,I.rounding=y,q(V==2||V==3?b.neg():b,u,y,!0)):new I(1):new I(NaN)},s.cubeRoot=s.cbrt=function(){var u,y,b,I,R,n,i,l,v,d,T=this,M=T.constructor;if(!T.isFinite()||T.isZero())return new M(T);for(J=!1,n=T.s*a(T.s*T,1/3),!n||Math.abs(n)==1/0?(b=c(T.d),u=T.e,(n=(u-b.length+1)%3)&&(b+=n==1||n==-2?"0":"00"),n=a(b,1/3),u=Ae((u+1)/3)-(u%3==(u<0?-1:2)),n==1/0?b="5e"+u:(b=n.toExponential(),b=b.slice(0,b.indexOf("e")+1)+u),I=new M(b),I.s=T.s):I=new M(n.toString()),i=(u=M.precision)+3;;)if(l=I,v=l.times(l).times(l),d=v.plus(T),I=N(d.plus(T).times(l),d.plus(v),i+2,1),c(l.d).slice(0,i)===(b=c(I.d)).slice(0,i))if(b=b.slice(i-3,i+1),b=="9999"||!R&&b=="4999"){if(!R&&(q(l,u+1,0),l.times(l).times(l).eq(T))){I=l;break}i+=4,R=1}else{(!+b||!+b.slice(1)&&b.charAt(0)=="5")&&(q(I,u+1,1),y=!I.times(I).times(I).eq(T));break}return J=!0,q(I,u,M.rounding,y)},s.decimalPlaces=s.dp=function(){var u,y=this.d,b=NaN;if(y){if(u=y.length-1,b=(u-Ae(this.e/he))*he,u=y[u],u)for(;u%10==0;u/=10)b--;b<0&&(b=0)}return b},s.dividedBy=s.div=function(u){return N(this,new this.constructor(u))},s.dividedToIntegerBy=s.divToInt=function(u){var y=this,b=y.constructor;return q(N(y,new b(u),0,1,1),b.precision,b.rounding)},s.equals=s.eq=function(u){return this.cmp(u)===0},s.floor=function(){return q(new this.constructor(this),this.e+1,3)},s.greaterThan=s.gt=function(u){return this.cmp(u)>0},s.greaterThanOrEqualTo=s.gte=function(u){var y=this.cmp(u);return y==1||y===0},s.hyperbolicCosine=s.cosh=function(){var u,y,b,I,R,n=this,i=n.constructor,l=new i(1);if(!n.isFinite())return new i(n.s?1/0:NaN);if(n.isZero())return l;b=i.precision,I=i.rounding,i.precision=b+Math.max(n.e,n.sd())+4,i.rounding=1,R=n.d.length,R<32?(u=Math.ceil(R/3),y=(1/Be(4,u)).toString()):(u=16,y="2.3283064365386962890625e-10"),n=Xe(i,1,n.times(y),new i(1),!0);for(var v,d=u,T=new i(8);d--;)v=n.times(n),n=l.minus(v.times(T.minus(v.times(T))));return q(n,i.precision=b,i.rounding=I,!0)},s.hyperbolicSine=s.sinh=function(){var u,y,b,I,R=this,n=R.constructor;if(!R.isFinite()||R.isZero())return new n(R);if(y=n.precision,b=n.rounding,n.precision=y+Math.max(R.e,R.sd())+4,n.rounding=1,I=R.d.length,I<3)R=Xe(n,2,R,R,!0);else{u=1.4*Math.sqrt(I),u=u>16?16:u|0,R=R.times(1/Be(5,u)),R=Xe(n,2,R,R,!0);for(var i,l=new n(5),v=new n(16),d=new n(20);u--;)i=R.times(R),R=R.times(l.plus(i.times(v.times(i).plus(d))))}return n.precision=y,n.rounding=b,q(R,y,b,!0)},s.hyperbolicTangent=s.tanh=function(){var u,y,b=this,I=b.constructor;return b.isFinite()?b.isZero()?new I(b):(u=I.precision,y=I.rounding,I.precision=u+7,I.rounding=1,N(b.sinh(),b.cosh(),I.precision=u,I.rounding=y)):new I(b.s)},s.inverseCosine=s.acos=function(){var u=this,y=u.constructor,b=u.abs().cmp(1),I=y.precision,R=y.rounding;return b!==-1?b===0?u.isNeg()?z(y,I,R):new y(0):new y(NaN):u.isZero()?z(y,I+4,R).times(.5):(y.precision=I+6,y.rounding=1,u=new y(1).minus(u).div(u.plus(1)).sqrt().atan(),y.precision=I,y.rounding=R,u.times(2))},s.inverseHyperbolicCosine=s.acosh=function(){var u,y,b=this,I=b.constructor;return b.lte(1)?new I(b.eq(1)?0:NaN):b.isFinite()?(u=I.precision,y=I.rounding,I.precision=u+Math.max(Math.abs(b.e),b.sd())+4,I.rounding=1,J=!1,b=b.times(b).minus(1).sqrt().plus(b),J=!0,I.precision=u,I.rounding=y,b.ln()):new I(b)},s.inverseHyperbolicSine=s.asinh=function(){var u,y,b=this,I=b.constructor;return!b.isFinite()||b.isZero()?new I(b):(u=I.precision,y=I.rounding,I.precision=u+2*Math.max(Math.abs(b.e),b.sd())+6,I.rounding=1,J=!1,b=b.times(b).plus(1).sqrt().plus(b),J=!0,I.precision=u,I.rounding=y,b.ln())},s.inverseHyperbolicTangent=s.atanh=function(){var u,y,b,I,R=this,n=R.constructor;return R.isFinite()?R.e>=0?new n(R.abs().eq(1)?R.s/0:R.isZero()?R:NaN):(u=n.precision,y=n.rounding,I=R.sd(),Math.max(I,u)<2*-R.e-1?q(new n(R),u,y,!0):(n.precision=b=I-R.e,R=N(R.plus(1),new n(1).minus(R),b+u,1),n.precision=u+4,n.rounding=1,R=R.ln(),n.precision=u,n.rounding=y,R.times(.5))):new n(NaN)},s.inverseSine=s.asin=function(){var u,y,b,I,R=this,n=R.constructor;return R.isZero()?new n(R):(y=R.abs().cmp(1),b=n.precision,I=n.rounding,y!==-1?y===0?(u=z(n,b+4,I).times(.5),u.s=R.s,u):new n(NaN):(n.precision=b+6,n.rounding=1,R=R.div(new n(1).minus(R.times(R)).sqrt().plus(1)).atan(),n.precision=b,n.rounding=I,R.times(2)))},s.inverseTangent=s.atan=function(){var u,y,b,I,R,n,i,l,v,d=this,T=d.constructor,M=T.precision,C=T.rounding;if(d.isFinite()){if(d.isZero())return new T(d);if(d.abs().eq(1)&&M+4<=fe)return i=z(T,M+4,C).times(.25),i.s=d.s,i}else{if(!d.s)return new T(NaN);if(M+4<=fe)return i=z(T,M+4,C).times(.5),i.s=d.s,i}for(T.precision=l=M+10,T.rounding=1,b=Math.min(28,l/he+2|0),u=b;u;--u)d=d.div(d.times(d).plus(1).sqrt().plus(1));for(J=!1,y=Math.ceil(l/he),I=1,v=d.times(d),i=new T(d),R=d;u!==-1;)if(R=R.times(v),n=i.minus(R.div(I+=2)),R=R.times(v),i=n.plus(R.div(I+=2)),i.d[y]!==void 0)for(u=y;i.d[u]===n.d[u]&&u--;);return b&&(i=i.times(2<<b-1)),J=!0,q(i,T.precision=M,T.rounding=C,!0)},s.isFinite=function(){return!!this.d},s.isInteger=s.isInt=function(){return!!this.d&&Ae(this.e/he)>this.d.length-2},s.isNaN=function(){return!this.s},s.isNegative=s.isNeg=function(){return this.s<0},s.isPositive=s.isPos=function(){return this.s>0},s.isZero=function(){return!!this.d&&this.d[0]===0},s.lessThan=s.lt=function(u){return this.cmp(u)<0},s.lessThanOrEqualTo=s.lte=function(u){return this.cmp(u)<1},s.logarithm=s.log=function(u){var y,b,I,R,n,i,l,v,d=this,T=d.constructor,M=T.precision,C=T.rounding,X=5;if(u==null)u=new T(10),y=!0;else{if(u=new T(u),b=u.d,u.s<0||!b||!b[0]||u.eq(1))return new T(NaN);y=u.eq(10)}if(b=d.d,d.s<0||!b||!b[0]||d.eq(1))return new T(b&&!b[0]?-1/0:d.s!=1?NaN:b?0:1/0);if(y)if(b.length>1)n=!0;else{for(R=b[0];R%10===0;)R/=10;n=R!==1}if(J=!1,l=M+X,i=Ge(d,l),I=y?K(T,l+10):Ge(u,l),v=N(i,I,l,1),O(v.d,R=M,C))do if(l+=10,i=Ge(d,l),I=y?K(T,l+10):Ge(u,l),v=N(i,I,l,1),!n){+c(v.d).slice(R+1,R+15)+1==1e14&&(v=q(v,M+1,0));break}while(O(v.d,R+=10,C));return J=!0,q(v,M,C)},s.minus=s.sub=function(u){var y,b,I,R,n,i,l,v,d,T,M,C,X=this,se=X.constructor;if(u=new se(u),!X.d||!u.d)return!X.s||!u.s?u=new se(NaN):X.d?u.s=-u.s:u=new se(u.d||X.s!==u.s?X:NaN),u;if(X.s!=u.s)return u.s=-u.s,X.plus(u);if(d=X.d,C=u.d,l=se.precision,v=se.rounding,!d[0]||!C[0]){if(C[0])u.s=-u.s;else if(d[0])u=new se(X);else return new se(v===3?-0:0);return J?q(u,l,v):u}if(b=Ae(u.e/he),T=Ae(X.e/he),d=d.slice(),n=T-b,n){for(M=n<0,M?(y=d,n=-n,i=C.length):(y=C,b=T,i=d.length),I=Math.max(Math.ceil(l/he),i)+2,n>I&&(n=I,y.length=1),y.reverse(),I=n;I--;)y.push(0);y.reverse()}else{for(I=d.length,i=C.length,M=I<i,M&&(i=I),I=0;I<i;I++)if(d[I]!=C[I]){M=d[I]<C[I];break}n=0}for(M&&(y=d,d=C,C=y,u.s=-u.s),i=d.length,I=C.length-i;I>0;--I)d[i++]=0;for(I=C.length;I>n;){if(d[--I]<C[I]){for(R=I;R&&d[--R]===0;)d[R]=Ie-1;--d[R],d[I]+=Ie}d[I]-=C[I]}for(;d[--i]===0;)d.pop();for(;d[0]===0;d.shift())--b;return d[0]?(u.d=d,u.e=D(d,b),J?q(u,l,v):u):new se(v===3?-0:0)},s.modulo=s.mod=function(u){var y,b=this,I=b.constructor;return u=new I(u),!b.d||!u.s||u.d&&!u.d[0]?new I(NaN):!u.d||b.d&&!b.d[0]?q(new I(b),I.precision,I.rounding):(J=!1,I.modulo==9?(y=N(b,u.abs(),0,3,1),y.s*=u.s):y=N(b,u,0,I.modulo,1),y=y.times(u),J=!0,b.minus(y))},s.naturalExponential=s.exp=function(){return Re(this)},s.naturalLogarithm=s.ln=function(){return Ge(this)},s.negated=s.neg=function(){var u=new this.constructor(this);return u.s=-u.s,q(u)},s.plus=s.add=function(u){var y,b,I,R,n,i,l,v,d,T,M=this,C=M.constructor;if(u=new C(u),!M.d||!u.d)return!M.s||!u.s?u=new C(NaN):M.d||(u=new C(u.d||M.s===u.s?M:NaN)),u;if(M.s!=u.s)return u.s=-u.s,M.minus(u);if(d=M.d,T=u.d,l=C.precision,v=C.rounding,!d[0]||!T[0])return T[0]||(u=new C(M)),J?q(u,l,v):u;if(n=Ae(M.e/he),I=Ae(u.e/he),d=d.slice(),R=n-I,R){for(R<0?(b=d,R=-R,i=T.length):(b=T,I=n,i=d.length),n=Math.ceil(l/he),i=n>i?n+1:i+1,R>i&&(R=i,b.length=1),b.reverse();R--;)b.push(0);b.reverse()}for(i=d.length,R=T.length,i-R<0&&(R=i,b=T,T=d,d=b),y=0;R;)y=(d[--R]=d[R]+T[R]+y)/Ie|0,d[R]%=Ie;for(y&&(d.unshift(y),++I),i=d.length;d[--i]==0;)d.pop();return u.d=d,u.e=D(d,I),J?q(u,l,v):u},s.precision=s.sd=function(u){var y,b=this;if(u!==void 0&&u!==!!u&&u!==1&&u!==0)throw Error(Me+u);return b.d?(y=te(b.d),u&&b.e+1>y&&(y=b.e+1)):y=NaN,y},s.round=function(){var u=this,y=u.constructor;return q(new y(u),u.e+1,y.rounding)},s.sine=s.sin=function(){var u,y,b=this,I=b.constructor;return b.isFinite()?b.isZero()?new I(b):(u=I.precision,y=I.rounding,I.precision=u+Math.max(b.e,b.sd())+he,I.rounding=1,b=De(I,Q(I,b)),I.precision=u,I.rounding=y,q(V>2?b.neg():b,u,y,!0)):new I(NaN)},s.squareRoot=s.sqrt=function(){var u,y,b,I,R,n,i=this,l=i.d,v=i.e,d=i.s,T=i.constructor;if(d!==1||!l||!l[0])return new T(!d||d<0&&(!l||l[0])?NaN:l?i:1/0);for(J=!1,d=Math.sqrt(+i),d==0||d==1/0?(y=c(l),(y.length+v)%2==0&&(y+="0"),d=Math.sqrt(y),v=Ae((v+1)/2)-(v<0||v%2),d==1/0?y="5e"+v:(y=d.toExponential(),y=y.slice(0,y.indexOf("e")+1)+v),I=new T(y)):I=new T(d.toString()),b=(v=T.precision)+3;;)if(n=I,I=n.plus(N(i,n,b+2,1)).times(.5),c(n.d).slice(0,b)===(y=c(I.d)).slice(0,b))if(y=y.slice(b-3,b+1),y=="9999"||!R&&y=="4999"){if(!R&&(q(n,v+1,0),n.times(n).eq(i))){I=n;break}b+=4,R=1}else{(!+y||!+y.slice(1)&&y.charAt(0)=="5")&&(q(I,v+1,1),u=!I.times(I).eq(i));break}return J=!0,q(I,v,T.rounding,u)},s.tangent=s.tan=function(){var u,y,b=this,I=b.constructor;return b.isFinite()?b.isZero()?new I(b):(u=I.precision,y=I.rounding,I.precision=u+10,I.rounding=1,b=b.sin(),b.s=1,b=N(b,new I(1).minus(b.times(b)).sqrt(),u+10,0),I.precision=u,I.rounding=y,q(V==2||V==4?b.neg():b,u,y,!0)):new I(NaN)},s.times=s.mul=function(u){var y,b,I,R,n,i,l,v,d,T=this,M=T.constructor,C=T.d,X=(u=new M(u)).d;if(u.s*=T.s,!C||!C[0]||!X||!X[0])return new M(!u.s||C&&!C[0]&&!X||X&&!X[0]&&!C?NaN:!C||!X?u.s/0:u.s*0);for(b=Ae(T.e/he)+Ae(u.e/he),v=C.length,d=X.length,v<d&&(n=C,C=X,X=n,i=v,v=d,d=i),n=[],i=v+d,I=i;I--;)n.push(0);for(I=d;--I>=0;){for(y=0,R=v+I;R>I;)l=n[R]+X[I]*C[R-I-1]+y,n[R--]=l%Ie|0,y=l/Ie|0;n[R]=(n[R]+y)%Ie|0}for(;!n[--i];)n.pop();return y?++b:n.shift(),u.d=n,u.e=D(n,b),J?q(u,M.precision,M.rounding):u},s.toBinary=function(u,y){return j(this,2,u,y)},s.toDecimalPlaces=s.toDP=function(u,y){var b=this,I=b.constructor;return b=new I(b),u===void 0?b:(S(u,0,e),y===void 0?y=I.rounding:S(y,0,8),q(b,u+b.e+1,y))},s.toExponential=function(u,y){var b,I=this,R=I.constructor;return u===void 0?b=P(I,!0):(S(u,0,e),y===void 0?y=R.rounding:S(y,0,8),I=q(new R(I),u+1,y),b=P(I,!0,u+1)),I.isNeg()&&!I.isZero()?"-"+b:b},s.toFixed=function(u,y){var b,I,R=this,n=R.constructor;return u===void 0?b=P(R):(S(u,0,e),y===void 0?y=n.rounding:S(y,0,8),I=q(new n(R),u+R.e+1,y),b=P(I,!1,u+I.e+1)),R.isNeg()&&!R.isZero()?"-"+b:b},s.toFraction=function(u){var y,b,I,R,n,i,l,v,d,T,M,C,X=this,se=X.d,ue=X.constructor;if(!se)return new ue(X);if(d=b=new ue(1),I=v=new ue(0),y=new ue(I),n=y.e=te(se)-X.e-1,i=n%he,y.d[0]=a(10,i<0?he+i:i),u==null)u=n>0?y:d;else{if(l=new ue(u),!l.isInt()||l.lt(d))throw Error(Me+l);u=l.gt(y)?n>0?y:d:l}for(J=!1,l=new ue(c(se)),T=ue.precision,ue.precision=n=se.length*he*2;M=N(l,y,0,1,1),R=b.plus(M.times(I)),R.cmp(u)!=1;)b=I,I=R,R=d,d=v.plus(M.times(R)),v=R,R=y,y=l.minus(M.times(R)),l=R;return R=N(u.minus(b),I,0,1,1),v=v.plus(R.times(d)),b=b.plus(R.times(I)),v.s=d.s=X.s,C=N(d,I,n,1).minus(X).abs().cmp(N(v,b,n,1).minus(X).abs())<1?[d,I]:[v,b],ue.precision=T,J=!0,C},s.toHexadecimal=s.toHex=function(u,y){return j(this,16,u,y)},s.toNearest=function(u,y){var b=this,I=b.constructor;if(b=new I(b),u==null){if(!b.d)return b;u=new I(1),y=I.rounding}else{if(u=new I(u),y===void 0?y=I.rounding:S(y,0,8),!b.d)return u.s?b:u;if(!u.d)return u.s&&(u.s=b.s),u}return u.d[0]?(J=!1,b=N(b,u,0,y,1).times(u),J=!0,q(b)):(u.s=b.s,b=u),b},s.toNumber=function(){return+this},s.toOctal=function(u,y){return j(this,8,u,y)},s.toPower=s.pow=function(u){var y,b,I,R,n,i,l=this,v=l.constructor,d=+(u=new v(u));if(!l.d||!u.d||!l.d[0]||!u.d[0])return new v(a(+l,d));if(l=new v(l),l.eq(1))return l;if(I=v.precision,n=v.rounding,u.eq(1))return q(l,I,n);if(y=Ae(u.e/he),y>=u.d.length-1&&(b=d<0?-d:d)<=Ce)return R=de(v,l,b,I),u.s<0?new v(1).div(R):q(R,I,n);if(i=l.s,i<0){if(y<u.d.length-1)return new v(NaN);if((u.d[y]&1)==0&&(i=1),l.e==0&&l.d[0]==1&&l.d.length==1)return l.s=i,l}return b=a(+l,d),y=b==0||!isFinite(b)?Ae(d*(Math.log("0."+c(l.d))/Math.LN10+l.e+1)):new v(b+"").e,y>v.maxE+1||y<v.minE-1?new v(y>0?i/0:0):(J=!1,v.rounding=l.s=1,b=Math.min(12,(y+"").length),R=Re(u.times(Ge(l,I+b)),I),R.d&&(R=q(R,I+5,1),O(R.d,I,n)&&(y=I+10,R=q(Re(u.times(Ge(l,y+b)),y),y+5,1),+c(R.d).slice(I+1,I+15)+1==1e14&&(R=q(R,I+1,0)))),R.s=i,J=!0,v.rounding=n,q(R,I,n))},s.toPrecision=function(u,y){var b,I=this,R=I.constructor;return u===void 0?b=P(I,I.e<=R.toExpNeg||I.e>=R.toExpPos):(S(u,1,e),y===void 0?y=R.rounding:S(y,0,8),I=q(new R(I),u,y),b=P(I,u<=I.e||I.e<=R.toExpNeg,u)),I.isNeg()&&!I.isZero()?"-"+b:b},s.toSignificantDigits=s.toSD=function(u,y){var b=this,I=b.constructor;return u===void 0?(u=I.precision,y=I.rounding):(S(u,1,e),y===void 0?y=I.rounding:S(y,0,8)),q(new I(b),u,y)},s.toString=function(){var u=this,y=u.constructor,b=P(u,u.e<=y.toExpNeg||u.e>=y.toExpPos);return u.isNeg()&&!u.isZero()?"-"+b:b},s.truncated=s.trunc=function(){return q(new this.constructor(this),this.e+1,1)},s.valueOf=s.toJSON=function(){var u=this,y=u.constructor,b=P(u,u.e<=y.toExpNeg||u.e>=y.toExpPos);return u.isNeg()?"-"+b:b};function c(u){var y,b,I,R=u.length-1,n="",i=u[0];if(R>0){for(n+=i,y=1;y<R;y++)I=u[y]+"",b=he-I.length,b&&(n+=ce(b)),n+=I;i=u[y],I=i+"",b=he-I.length,b&&(n+=ce(b))}else if(i===0)return"0";for(;i%10===0;)i/=10;return n+i}function S(u,y,b){if(u!==~~u||u<y||u>b)throw Error(Me+u)}function O(u,y,b,I){var R,n,i,l;for(n=u[0];n>=10;n/=10)--y;return--y<0?(y+=he,R=0):(R=Math.ceil((y+1)/he),y%=he),n=a(10,he-y),l=u[R]%n|0,I==null?y<3?(y==0?l=l/100|0:y==1&&(l=l/10|0),i=b<4&&l==99999||b>3&&l==49999||l==5e4||l==0):i=(b<4&&l+1==n||b>3&&l+1==n/2)&&(u[R+1]/n/100|0)==a(10,y-2)-1||(l==n/2||l==0)&&(u[R+1]/n/100|0)==0:y<4?(y==0?l=l/1e3|0:y==1?l=l/100|0:y==2&&(l=l/10|0),i=(I||b<4)&&l==9999||!I&&b>3&&l==4999):i=((I||b<4)&&l+1==n||!I&&b>3&&l+1==n/2)&&(u[R+1]/n/1e3|0)==a(10,y-3)-1,i}function p(u,y,b){for(var I,R=[0],n,i=0,l=u.length;i<l;){for(n=R.length;n--;)R[n]*=y;for(R[0]+=o.indexOf(u.charAt(i++)),I=0;I<R.length;I++)R[I]>b-1&&(R[I+1]===void 0&&(R[I+1]=0),R[I+1]+=R[I]/b|0,R[I]%=b)}return R.reverse()}function h(u,y){var b,I,R;if(y.isZero())return y;I=y.d.length,I<32?(b=Math.ceil(I/3),R=(1/Be(4,b)).toString()):(b=16,R="2.3283064365386962890625e-10"),u.precision+=b,y=Xe(u,1,y.times(R),new u(1));for(var n=b;n--;){var i=y.times(y);y=i.times(i).minus(i).times(8).plus(1)}return u.precision-=b,y}var N=(function(){function u(I,R,n){var i,l=0,v=I.length;for(I=I.slice();v--;)i=I[v]*R+l,I[v]=i%n|0,l=i/n|0;return l&&I.unshift(l),I}function y(I,R,n,i){var l,v;if(n!=i)v=n>i?1:-1;else for(l=v=0;l<n;l++)if(I[l]!=R[l]){v=I[l]>R[l]?1:-1;break}return v}function b(I,R,n,i){for(var l=0;n--;)I[n]-=l,l=I[n]<R[n]?1:0,I[n]=l*i+I[n]-R[n];for(;!I[0]&&I.length>1;)I.shift()}return function(I,R,n,i,l,v){var d,T,M,C,X,se,ue,_e,Pe,be,Ze,st,It,Je,xe,Ke,ze,Ye,at,dt,ht=I.constructor,nt=I.s==R.s?1:-1,it=I.d,rt=R.d;if(!it||!it[0]||!rt||!rt[0])return new ht(!I.s||!R.s||(it?rt&&it[0]==rt[0]:!rt)?NaN:it&&it[0]==0||!rt?nt*0:nt/0);for(v?(X=1,T=I.e-R.e):(v=Ie,X=he,T=Ae(I.e/X)-Ae(R.e/X)),at=rt.length,ze=it.length,Pe=new ht(nt),be=Pe.d=[],M=0;rt[M]==(it[M]||0);M++);if(rt[M]>(it[M]||0)&&T--,n==null?(Je=n=ht.precision,i=ht.rounding):l?Je=n+(I.e-R.e)+1:Je=n,Je<0)be.push(1),se=!0;else{if(Je=Je/X+2|0,M=0,at==1){for(C=0,rt=rt[0],Je++;(M<ze||C)&&Je--;M++)xe=C*v+(it[M]||0),be[M]=xe/rt|0,C=xe%rt|0;se=C||M<ze}else{for(C=v/(rt[0]+1)|0,C>1&&(rt=u(rt,C,v),it=u(it,C,v),at=rt.length,ze=it.length),Ke=at,Ze=it.slice(0,at),st=Ze.length;st<at;)Ze[st++]=0;dt=rt.slice(),dt.unshift(0),Ye=rt[0],rt[1]>=v/2&&++Ye;do C=0,d=y(rt,Ze,at,st),d<0?(It=Ze[0],at!=st&&(It=It*v+(Ze[1]||0)),C=It/Ye|0,C>1?(C>=v&&(C=v-1),ue=u(rt,C,v),_e=ue.length,st=Ze.length,d=y(ue,Ze,_e,st),d==1&&(C--,b(ue,at<_e?dt:rt,_e,v))):(C==0&&(d=C=1),ue=rt.slice()),_e=ue.length,_e<st&&ue.unshift(0),b(Ze,ue,st,v),d==-1&&(st=Ze.length,d=y(rt,Ze,at,st),d<1&&(C++,b(Ze,at<st?dt:rt,st,v))),st=Ze.length):d===0&&(C++,Ze=[0]),be[M++]=C,d&&Ze[0]?Ze[st++]=it[Ke]||0:(Ze=[it[Ke]],st=1);while((Ke++<ze||Ze[0]!==void 0)&&Je--);se=Ze[0]!==void 0}be[0]||be.shift()}if(X==1)Pe.e=T,k=se;else{for(M=1,C=be[0];C>=10;C/=10)M++;Pe.e=M+T*X-1,q(Pe,l?n+Pe.e+1:n,i,se)}return Pe}})();function q(u,y,b,I){var R,n,i,l,v,d,T,M,C,X=u.constructor;e:if(y!=null){if(M=u.d,!M)return u;for(R=1,l=M[0];l>=10;l/=10)R++;if(n=y-R,n<0)n+=he,i=y,T=M[C=0],v=T/a(10,R-i-1)%10|0;else if(C=Math.ceil((n+1)/he),l=M.length,C>=l)if(I){for(;l++<=C;)M.push(0);T=v=0,R=1,n%=he,i=n-he+1}else break e;else{for(T=l=M[C],R=1;l>=10;l/=10)R++;n%=he,i=n-he+R,v=i<0?0:T/a(10,R-i-1)%10|0}if(I=I||y<0||M[C+1]!==void 0||(i<0?T:T%a(10,R-i-1)),d=b<4?(v||I)&&(b==0||b==(u.s<0?3:2)):v>5||v==5&&(b==4||I||b==6&&(n>0?i>0?T/a(10,R-i):0:M[C-1])%10&1||b==(u.s<0?8:7)),y<1||!M[0])return M.length=0,d?(y-=u.e+1,M[0]=a(10,(he-y%he)%he),u.e=-y||0):M[0]=u.e=0,u;if(n==0?(M.length=C,l=1,C--):(M.length=C+1,l=a(10,he-n),M[C]=i>0?(T/a(10,R-i)%a(10,i)|0)*l:0),d)for(;;)if(C==0){for(n=1,i=M[0];i>=10;i/=10)n++;for(i=M[0]+=l,l=1;i>=10;i/=10)l++;n!=l&&(u.e++,M[0]==Ie&&(M[0]=1));break}else{if(M[C]+=l,M[C]!=Ie)break;M[C--]=0,l=1}for(n=M.length;M[--n]===0;)M.pop()}return J&&(u.e>X.maxE?(u.d=null,u.e=NaN):u.e<X.minE&&(u.e=0,u.d=[0])),u}function P(u,y,b){if(!u.isFinite())return et(u);var I,R=u.e,n=c(u.d),i=n.length;return y?(b&&(I=b-i)>0?n=n.charAt(0)+"."+n.slice(1)+ce(I):i>1&&(n=n.charAt(0)+"."+n.slice(1)),n=n+(u.e<0?"e":"e+")+u.e):R<0?(n="0."+ce(-R-1)+n,b&&(I=b-i)>0&&(n+=ce(I))):R>=i?(n+=ce(R+1-i),b&&(I=b-R-1)>0&&(n=n+"."+ce(I))):((I=R+1)<i&&(n=n.slice(0,I)+"."+n.slice(I)),b&&(I=b-i)>0&&(R+1===i&&(n+="."),n+=ce(I))),n}function D(u,y){var b=u[0];for(y*=he;b>=10;b/=10)y++;return y}function K(u,y,b){if(y>we)throw J=!0,b&&(u.precision=b),Error($e);return q(new u(g),y,1,!0)}function z(u,y,b){if(y>fe)throw Error($e);return q(new u(E),y,b,!0)}function te(u){var y=u.length-1,b=y*he+1;if(y=u[y],y){for(;y%10==0;y/=10)b--;for(y=u[0];y>=10;y/=10)b++}return b}function ce(u){for(var y="";u--;)y+="0";return y}function de(u,y,b,I){var R,n=new u(1),i=Math.ceil(I/he+4);for(J=!1;;){if(b%2&&(n=n.times(y),G(n.d,i)&&(R=!0)),b=Ae(b/2),b===0){b=n.d.length-1,R&&n.d[b]===0&&++n.d[b];break}y=y.times(y),G(y.d,i)}return J=!0,n}function Se(u){return u.d[u.d.length-1]&1}function Ue(u,y,b){for(var I,R,n=new u(y[0]),i=0;++i<y.length;){if(R=new u(y[i]),!R.s){n=R;break}I=n.cmp(R),(I===b||I===0&&n.s===b)&&(n=R)}return n}function Re(u,y){var b,I,R,n,i,l,v,d=0,T=0,M=0,C=u.constructor,X=C.rounding,se=C.precision;if(!u.d||!u.d[0]||u.e>17)return new C(u.d?u.d[0]?u.s<0?0:1/0:1:u.s?u.s<0?0:u:NaN);for(y==null?(J=!1,v=se):v=y,l=new C(.03125);u.e>-2;)u=u.times(l),M+=5;for(I=Math.log(a(2,M))/Math.LN10*2+5|0,v+=I,b=n=i=new C(1),C.precision=v;;){if(n=q(n.times(u),v,1),b=b.times(++T),l=i.plus(N(n,b,v,1)),c(l.d).slice(0,v)===c(i.d).slice(0,v)){for(R=M;R--;)i=q(i.times(i),v,1);if(y==null)if(d<3&&O(i.d,v-I,X,d))C.precision=v+=10,b=n=l=new C(1),T=0,d++;else return q(i,C.precision=se,X,J=!0);else return C.precision=se,i}i=l}}function Ge(u,y){var b,I,R,n,i,l,v,d,T,M,C,X=1,se=10,ue=u,_e=ue.d,Pe=ue.constructor,be=Pe.rounding,Ze=Pe.precision;if(ue.s<0||!_e||!_e[0]||!ue.e&&_e[0]==1&&_e.length==1)return new Pe(_e&&!_e[0]?-1/0:ue.s!=1?NaN:_e?0:ue);if(y==null?(J=!1,T=Ze):T=y,Pe.precision=T+=se,b=c(_e),I=b.charAt(0),Math.abs(n=ue.e)<15e14){for(;I<7&&I!=1||I==1&&b.charAt(1)>3;)ue=ue.times(u),b=c(ue.d),I=b.charAt(0),X++;n=ue.e,I>1?(ue=new Pe("0."+b),n++):ue=new Pe(I+"."+b.slice(1))}else return d=K(Pe,T+2,Ze).times(n+""),ue=Ge(new Pe(I+"."+b.slice(1)),T-se).plus(d),Pe.precision=Ze,y==null?q(ue,Ze,be,J=!0):ue;for(M=ue,v=i=ue=N(ue.minus(1),ue.plus(1),T,1),C=q(ue.times(ue),T,1),R=3;;){if(i=q(i.times(C),T,1),d=v.plus(N(i,new Pe(R),T,1)),c(d.d).slice(0,T)===c(v.d).slice(0,T))if(v=v.times(2),n!==0&&(v=v.plus(K(Pe,T+2,Ze).times(n+""))),v=N(v,new Pe(X),T,1),y==null)if(O(v.d,T-se,be,l))Pe.precision=T+=se,d=i=ue=N(M.minus(1),M.plus(1),T,1),C=q(ue.times(ue),T,1),R=l=1;else return q(v,Pe.precision=Ze,be,J=!0);else return Pe.precision=Ze,v;v=d,R+=2}}function et(u){return String(u.s*u.s/0)}function qe(u,y){var b,I,R;for((b=y.indexOf("."))>-1&&(y=y.replace(".","")),(I=y.search(/e/i))>0?(b<0&&(b=I),b+=+y.slice(I+1),y=y.substring(0,I)):b<0&&(b=y.length),I=0;y.charCodeAt(I)===48;I++);for(R=y.length;y.charCodeAt(R-1)===48;--R);if(y=y.slice(I,R),y){if(R-=I,u.e=b=b-I-1,u.d=[],I=(b+1)%he,b<0&&(I+=he),I<R){for(I&&u.d.push(+y.slice(0,I)),R-=he;I<R;)u.d.push(+y.slice(I,I+=he));y=y.slice(I),I=he-y.length}else I-=R;for(;I--;)y+="0";u.d.push(+y),J&&(u.e>u.constructor.maxE?(u.d=null,u.e=NaN):u.e<u.constructor.minE&&(u.e=0,u.d=[0]))}else u.e=0,u.d=[0];return u}function Fe(u,y){var b,I,R,n,i,l,v,d,T;if(y.indexOf("_")>-1){if(y=y.replace(/(\d)_(?=\d)/g,"$1"),ye.test(y))return qe(u,y)}else if(y==="Infinity"||y==="NaN")return+y||(u.s=NaN),u.e=NaN,u.d=null,u;if(ve.test(y))b=16,y=y.toLowerCase();else if(ae.test(y))b=2;else if(Ne.test(y))b=8;else throw Error(Me+y);for(n=y.search(/p/i),n>0?(v=+y.slice(n+1),y=y.substring(2,n)):y=y.slice(2),n=y.indexOf("."),i=n>=0,I=u.constructor,i&&(y=y.replace(".",""),l=y.length,n=l-n,R=de(I,new I(b),n,n*2)),d=p(y,b,Ie),T=d.length-1,n=T;d[n]===0;--n)d.pop();return n<0?new I(u.s*0):(u.e=D(d,T),u.d=d,J=!1,i&&(u=N(u,R,l*4)),v&&(u=u.times(Math.abs(v)<54?a(2,v):A.pow(2,v))),J=!0,u)}function De(u,y){var b,I=y.d.length;if(I<3)return y.isZero()?y:Xe(u,2,y,y);b=1.4*Math.sqrt(I),b=b>16?16:b|0,y=y.times(1/Be(5,b)),y=Xe(u,2,y,y);for(var R,n=new u(5),i=new u(16),l=new u(20);b--;)R=y.times(y),y=y.times(n.plus(R.times(i.times(R).minus(l))));return y}function Xe(u,y,b,I,R){var n,i,l,v,d=1,T=u.precision,M=Math.ceil(T/he);for(J=!1,v=b.times(b),l=new u(I);;){if(i=N(l.times(v),new u(y++*y++),T,1),l=R?I.plus(i):I.minus(i),I=N(i.times(v),new u(y++*y++),T,1),i=l.plus(I),i.d[M]!==void 0){for(n=M;i.d[n]===l.d[n]&&n--;);if(n==-1)break}n=l,l=I,I=i,i=n,d++}return J=!0,i.d.length=M+1,i}function Be(u,y){for(var b=u;--y;)b*=u;return b}function Q(u,y){var b,I=y.s<0,R=z(u,u.precision,1),n=R.times(.5);if(y=y.abs(),y.lte(n))return V=I?4:1,y;if(b=y.divToInt(R),b.isZero())V=I?3:2;else{if(y=y.minus(b.times(R)),y.lte(n))return V=Se(b)?I?2:3:I?4:1,y;V=Se(b)?I?1:4:I?3:2}return y.minus(R).abs()}function j(u,y,b,I){var R,n,i,l,v,d,T,M,C,X=u.constructor,se=b!==void 0;if(se?(S(b,1,e),I===void 0?I=X.rounding:S(I,0,8)):(b=X.precision,I=X.rounding),!u.isFinite())T=et(u);else{for(T=P(u),i=T.indexOf("."),se?(R=2,y==16?b=b*4-3:y==8&&(b=b*3-2)):R=y,i>=0&&(T=T.replace(".",""),C=new X(1),C.e=T.length-i,C.d=p(P(C),10,R),C.e=C.d.length),M=p(T,10,R),n=v=M.length;M[--v]==0;)M.pop();if(!M[0])T=se?"0p+0":"0";else{if(i<0?n--:(u=new X(u),u.d=M,u.e=n,u=N(u,C,b,I,0,R),M=u.d,n=u.e,d=k),i=M[b],l=R/2,d=d||M[b+1]!==void 0,d=I<4?(i!==void 0||d)&&(I===0||I===(u.s<0?3:2)):i>l||i===l&&(I===4||d||I===6&&M[b-1]&1||I===(u.s<0?8:7)),M.length=b,d)for(;++M[--b]>R-1;)M[b]=0,b||(++n,M.unshift(1));for(v=M.length;!M[v-1];--v);for(i=0,T="";i<v;i++)T+=o.charAt(M[i]);if(se){if(v>1)if(y==16||y==8){for(i=y==16?4:3,--v;v%i;v++)T+="0";for(M=p(T,R,y),v=M.length;!M[v-1];--v);for(i=1,T="1.";i<v;i++)T+=o.charAt(M[i])}else T=T.charAt(0)+"."+T.slice(1);T=T+(n<0?"p":"p+")+n}else if(n<0){for(;++n;)T="0"+T;T="0."+T}else if(++n>v)for(n-=v;n--;)T+="0";else n<v&&(T=T.slice(0,n)+"."+T.slice(n))}T=(y==16?"0x":y==2?"0b":y==8?"0o":"")+T}return u.s<0?"-"+T:T}function G(u,y){if(u.length>y)return u.length=y,!0}function F(u){return new this(u).abs()}function ee(u){return new this(u).acos()}function _(u){return new this(u).acosh()}function U(u,y){return new this(u).plus(y)}function m(u){return new this(u).asin()}function f(u){return new this(u).asinh()}function $(u){return new this(u).atan()}function w(u){return new this(u).atanh()}function x(u,y){u=new this(u),y=new this(y);var b,I=this.precision,R=this.rounding,n=I+4;return!u.s||!y.s?b=new this(NaN):!u.d&&!y.d?(b=z(this,n,1).times(y.s>0?.25:.75),b.s=u.s):!y.d||u.isZero()?(b=y.s<0?z(this,I,R):new this(0),b.s=u.s):!u.d||y.isZero()?(b=z(this,n,1).times(.5),b.s=u.s):y.s<0?(this.precision=n,this.rounding=1,b=this.atan(N(u,y,n,1)),y=z(this,n,1),this.precision=I,this.rounding=R,b=u.s<0?b.minus(y):b.plus(y)):b=this.atan(N(u,y,n,1)),b}function B(u){return new this(u).cbrt()}function Z(u){return q(u=new this(u),u.e+1,2)}function Y(u,y,b){return new this(u).clamp(y,b)}function ie(u){if(!u||typeof u!="object")throw Error(me+"Object expected");var y,b,I,R=u.defaults===!0,n=["precis