//  [javascript]
module.exports=function(e){var r={};function n(t){if(r[t])return r[t].exports;var i=r[t]={i:t,l:!1,exports:{}};return e[t].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var i in e)n.d(t,i,function(r){return e[r]}.bind(null,i));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=0)}([function(e,r,n){n(1)(n(3).readFileSync("/dev/stdin","UTF-8"))},function(e,r,n){var t=n(2);e.exports=function(e){var r=e.split("\n"),n=Number(r[0]),i=r[1].split(" ").map(function(e){return Number(e)});i.sort(function(e,r){return e-r});for(var o=new t(0),u=0;u<n;u++){var f=3*n-2*(u+1);o=o.plus(i[f])}console.log(o.toString())}},function(e,r,n){var t;!function(i){"use strict";var o,u=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,f=Math.ceil,s=Math.floor,l="[BigNumber Error] ",c=l+"Number primitive has more than 15 significant digits: ",a=1e14,h=14,p=9007199254740991,g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,w=1e9;function m(e){var r=0|e;return e>0||e===r?r:r-1}function v(e){for(var r,n,t=1,i=e.length,o=e[0]+"";t<i;){for(r=e[t++]+"",n=h-r.length;n--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function b(e,r){var n,t,i=e.c,o=r.c,u=e.s,f=r.s,s=e.e,l=r.e;if(!u||!f)return null;if(n=i&&!i[0],t=o&&!o[0],n||t)return n?t?0:-f:u;if(u!=f)return u;if(n=u<0,t=s==l,!i||!o)return t?0:!i^n?1:-1;if(!t)return s>l^n?1:-1;for(f=(s=i.length)<(l=o.length)?s:l,u=0;u<f;u++)if(i[u]!=o[u])return i[u]>o[u]^n?1:-1;return s==l?0:s>l^n?1:-1}function y(e,r,n,t){if(e<r||e>n||e!==s(e))throw Error(l+(t||"Argument")+("number"==typeof e?e<r||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function O(e){var r=e.c.length-1;return m(e.e/h)==r&&e.c[r]%2!=0}function N(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(r<0?"e":"e+")+r}function E(e,r,n){var t,i;if(r<0){for(i=n+".";++r;i+=n);e=i+e}else if(++r>(t=e.length)){for(i=n,r-=t;--r;i+=n);e+=i}else r<t&&(e=e.slice(0,r)+"."+e.slice(r));return e}(o=function e(r){var n,t,i,o,A,S,_,x,P,R=q.prototype={constructor:q,toString:null,valueOf:null},D=new q(1),B=20,L=4,T=-7,U=21,M=-1e7,I=1e7,C=!1,j=1,F=0,G={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},k="0123456789abcdefghijklmnopqrstuvwxyz";function q(e,r){var n,o,f,l,a,g,d,w,m=this;if(!(m instanceof q))return new q(e,r);if(null==r){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>I?m.c=m.e=null:e.e<M?m.c=[m.e=0]:(m.e=e.e,m.c=e.c.slice()));if((g="number"==typeof e)&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,a=e;a>=10;a/=10,l++);return void(l>I?m.c=m.e=null:(m.e=l,m.c=[e]))}w=String(e)}else{if(!u.test(w=String(e)))return i(m,w,g);m.s=45==w.charCodeAt(0)?(w=w.slice(1),-1):1}(l=w.indexOf("."))>-1&&(w=w.replace(".","")),(a=w.search(/e/i))>0?(l<0&&(l=a),l+=+w.slice(a+1),w=w.substring(0,a)):l<0&&(l=w.length)}else{if(y(r,2,k.length,"Base"),10==r)return V(m=new q(e),B+m.e+1,L);if(w=String(e),g="number"==typeof e){if(0*e!=0)return i(m,w,g,r);if(m.s=1/e<0?(w=w.slice(1),-1):1,q.DEBUG&&w.replace(/^0\.0*|\./,"").length>15)throw Error(c+e)}else m.s=45===w.charCodeAt(0)?(w=w.slice(1),-1):1;for(n=k.slice(0,r),l=a=0,d=w.length;a<d;a++)if(n.indexOf(o=w.charAt(a))<0){if("."==o){if(a>l){l=d;continue}}else if(!f&&(w==w.toUpperCase()&&(w=w.toLowerCase())||w==w.toLowerCase()&&(w=w.toUpperCase()))){f=!0,a=-1,l=0;continue}return i(m,String(e),g,r)}g=!1,(l=(w=t(w,r,10,m.s)).indexOf("."))>-1?w=w.replace(".",""):l=w.length}for(a=0;48===w.charCodeAt(a);a++);for(d=w.length;48===w.charCodeAt(--d););if(w=w.slice(a,++d)){if(d-=a,g&&q.DEBUG&&d>15&&(e>p||e!==s(e)))throw Error(c+m.s*e);if((l=l-a-1)>I)m.c=m.e=null;else if(l<M)m.c=[m.e=0];else{if(m.e=l,m.c=[],a=(l+1)%h,l<0&&(a+=h),a<d){for(a&&m.c.push(+w.slice(0,a)),d-=h;a<d;)m.c.push(+w.slice(a,a+=h));a=h-(w=w.slice(a)).length}else a-=d;for(;a--;w+="0");m.c.push(+w)}}else m.c=[m.e=0]}function $(e,r,n,t){var i,o,u,f,s;if(null==n?n=L:y(n,0,8),!e.c)return e.toString();if(i=e.c[0],u=e.e,null==r)s=v(e.c),s=1==t||2==t&&(u<=T||u>=U)?N(s,u):E(s,u,"0");else if(o=(e=V(new q(e),r,n)).e,f=(s=v(e.c)).length,1==t||2==t&&(r<=o||o<=T)){for(;f<r;s+="0",f++);s=N(s,o)}else if(r-=u,s=E(s,o,"0"),o+1>f){if(--r>0)for(s+=".";r--;s+="0");}else if((r+=o-f)>0)for(o+1==f&&(s+=".");r--;s+="0");return e.s<0&&i?"-"+s:s}function z(e,r){for(var n,t=1,i=new q(e[0]);t<e.length;t++){if(!(n=new q(e[t])).s){i=n;break}r.call(i,n)&&(i=n)}return i}function H(e,r,n){for(var t=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,t++);return(n=t+n*h-1)>I?e.c=e.e=null:n<M?e.c=[e.e=0]:(e.e=n,e.c=r),e}function V(e,r,n,t){var i,o,u,l,c,p,d,w=e.c,m=g;if(w){e:{for(i=1,l=w[0];l>=10;l/=10,i++);if((o=r-i)<0)o+=h,u=r,d=(c=w[p=0])/m[i-u-1]%10|0;else if((p=f((o+1)/h))>=w.length){if(!t)break e;for(;w.length<=p;w.push(0));c=d=0,i=1,u=(o%=h)-h+1}else{for(c=l=w[p],i=1;l>=10;l/=10,i++);d=(u=(o%=h)-h+i)<0?0:c/m[i-u-1]%10|0}if(t=t||r<0||null!=w[p+1]||(u<0?c:c%m[i-u-1]),t=n<4?(d||t)&&(0==n||n==(e.s<0?3:2)):d>5||5==d&&(4==n||t||6==n&&(o>0?u>0?c/m[i-u]:0:w[p-1])%10&1||n==(e.s<0?8:7)),r<1||!w[0])return w.length=0,t?(r-=e.e+1,w[0]=m[(h-r%h)%h],e.e=-r||0):w[0]=e.e=0,e;if(0==o?(w.length=p,l=1,p--):(w.length=p+1,l=m[h-o],w[p]=u>0?s(c/m[i-u]%m[u])*l:0),t)for(;;){if(0==p){for(o=1,u=w[0];u>=10;u/=10,o++);for(u=w[0]+=l,l=1;u>=10;u/=10,l++);o!=l&&(e.e++,w[0]==a&&(w[0]=1));break}if(w[p]+=l,w[p]!=a)break;w[p--]=0,l=1}for(o=w.length;0===w[--o];w.pop());}e.e>I?e.c=e.e=null:e.e<M&&(e.c=[e.e=0])}return e}function W(e){var r,n=e.e;return null===n?e.toString():(r=v(e.c),r=n<=T||n>=U?N(r,n):E(r,n,"0"),e.s<0?"-"+r:r)}return q.clone=e,q.ROUND_UP=0,q.ROUND_DOWN=1,q.ROUND_CEIL=2,q.ROUND_FLOOR=3,q.ROUND_HALF_UP=4,q.ROUND_HALF_DOWN=5,q.ROUND_HALF_EVEN=6,q.ROUND_HALF_CEIL=7,q.ROUND_HALF_FLOOR=8,q.EUCLID=9,q.config=q.set=function(e){var r,n;if(null!=e){if("object"!=typeof e)throw Error(l+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(y(n=e[r],0,w,r),B=n),e.hasOwnProperty(r="ROUNDING_MODE")&&(y(n=e[r],0,8,r),L=n),e.hasOwnProperty(r="EXPONENTIAL_AT")&&((n=e[r])&&n.pop?(y(n[0],-w,0,r),y(n[1],0,w,r),T=n[0],U=n[1]):(y(n,-w,w,r),T=-(U=n<0?-n:n))),e.hasOwnProperty(r="RANGE"))if((n=e[r])&&n.pop)y(n[0],-w,-1,r),y(n[1],1,w,r),M=n[0],I=n[1];else{if(y(n,-w,w,r),!n)throw Error(l+r+" cannot be zero: "+n);M=-(I=n<0?-n:n)}if(e.hasOwnProperty(r="CRYPTO")){if((n=e[r])!==!!n)throw Error(l+r+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw C=!n,Error(l+"crypto unavailable");C=n}else C=n}if(e.hasOwnProperty(r="MODULO_MODE")&&(y(n=e[r],0,9,r),j=n),e.hasOwnProperty(r="POW_PRECISION")&&(y(n=e[r],0,w,r),F=n),e.hasOwnProperty(r="FORMAT")){if("object"!=typeof(n=e[r]))throw Error(l+r+" not an object: "+n);G=n}if(e.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(n=e[r])||/^.$|[+-.\s]|(.).*\1/.test(n))throw Error(l+r+" invalid: "+n);k=n}}return{DECIMAL_PLACES:B,ROUNDING_MODE:L,EXPONENTIAL_AT:[T,U],RANGE:[M,I],CRYPTO:C,MODULO_MODE:j,POW_PRECISION:F,FORMAT:G,ALPHABET:k}},q.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!q.DEBUG)return!0;var r,n,t=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(t)){if((1===o||-1===o)&&i>=-w&&i<=w&&i===s(i)){if(0===t[0]){if(0===i&&1===t.length)return!0;break e}if((r=(i+1)%h)<1&&(r+=h),String(t[0]).length==r){for(r=0;r<t.length;r++)if((n=t[r])<0||n>=a||n!==s(n))break e;if(0!==n)return!0}}}else if(null===t&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(l+"Invalid BigNumber: "+e)},q.maximum=q.max=function(){return z(arguments,R.lt)},q.minimum=q.min=function(){return z(arguments,R.gt)},q.random=(o=9007199254740992*Math.random()&2097151?function(){return s(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var r,n,t,i,u,c=0,a=[],p=new q(D);if(null==e?e=B:y(e,0,w),i=f(e/h),C)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(i*=2));c<i;)(u=131072*r[c]+(r[c+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),r[c]=n[0],r[c+1]=n[1]):(a.push(u%1e14),c+=2);c=i/2}else{if(!crypto.randomBytes)throw C=!1,Error(l+"crypto unavailable");for(r=crypto.randomBytes(i*=7);c<i;)(u=281474976710656*(31&r[c])+1099511627776*r[c+1]+4294967296*r[c+2]+16777216*r[c+3]+(r[c+4]<<16)+(r[c+5]<<8)+r[c+6])>=9e15?crypto.randomBytes(7).copy(r,c):(a.push(u%1e14),c+=7);c=i/7}if(!C)for(;c<i;)(u=o())<9e15&&(a[c++]=u%1e14);for(i=a[--c],e%=h,i&&e&&(u=g[h-e],a[c]=s(i/u)*u);0===a[c];a.pop(),c--);if(c<0)a=[t=0];else{for(t=-1;0===a[0];a.splice(0,1),t-=h);for(c=1,u=a[0];u>=10;u/=10,c++);c<h&&(t-=h-c)}return p.e=t,p.c=a,p}),q.sum=function(){for(var e=1,r=arguments,n=new q(r[0]);e<r.length;)n=n.plus(r[e++]);return n},t=function(){function e(e,r,n,t){for(var i,o,u=[0],f=0,s=e.length;f<s;){for(o=u.length;o--;u[o]*=r);for(u[0]+=t.indexOf(e.charAt(f++)),i=0;i<u.length;i++)u[i]>n-1&&(null==u[i+1]&&(u[i+1]=0),u[i+1]+=u[i]/n|0,u[i]%=n)}return u.reverse()}return function(r,t,i,o,u){var f,s,l,c,a,h,p,g,d=r.indexOf("."),w=B,m=L;for(d>=0&&(c=F,F=0,r=r.replace(".",""),h=(g=new q(t)).pow(r.length-d),F=c,g.c=e(E(v(h.c),h.e,"0"),10,i,"0123456789"),g.e=g.c.length),l=c=(p=e(r,t,i,u?(f=k,"0123456789"):(f="0123456789",k))).length;0==p[--c];p.pop());if(!p[0])return f.charAt(0);if(d<0?--l:(h.c=p,h.e=l,h.s=o,p=(h=n(h,g,w,m,i)).c,a=h.r,l=h.e),d=p[s=l+w+1],c=i/2,a=a||s<0||null!=p[s+1],a=m<4?(null!=d||a)&&(0==m||m==(h.s<0?3:2)):d>c||d==c&&(4==m||a||6==m&&1&p[s-1]||m==(h.s<0?8:7)),s<1||!p[0])r=a?E(f.charAt(1),-w,f.charAt(0)):f.charAt(0);else{if(p.length=s,a)for(--i;++p[--s]>i;)p[s]=0,s||(++l,p=[1].concat(p));for(c=p.length;!p[--c];);for(d=0,r="";d<=c;r+=f.charAt(p[d++]));r=E(r,l,f.charAt(0))}return r}}(),n=function(){function e(e,r,n){var t,i,o,u,f=0,s=e.length,l=r%d,c=r/d|0;for(e=e.slice();s--;)f=((i=l*(o=e[s]%d)+(t=c*o+(u=e[s]/d|0)*l)%d*d+f)/n|0)+(t/d|0)+c*u,e[s]=i%n;return f&&(e=[f].concat(e)),e}function r(e,r,n,t){var i,o;if(n!=t)o=n>t?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=r[i]){o=e[i]>r[i]?1:-1;break}return o}function n(e,r,n,t){for(var i=0;n--;)e[n]-=i,i=e[n]<r[n]?1:0,e[n]=i*t+e[n]-r[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(t,i,o,u,f){var l,c,p,g,d,w,v,b,y,O,N,E,A,S,_,x,P,R=t.s==i.s?1:-1,D=t.c,B=i.c;if(!(D&&D[0]&&B&&B[0]))return new q(t.s&&i.s&&(D?!B||D[0]!=B[0]:B)?D&&0==D[0]||!B?0*R:R/0:NaN);for(y=(b=new q(R)).c=[],R=o+(c=t.e-i.e)+1,f||(f=a,c=m(t.e/h)-m(i.e/h),R=R/h|0),p=0;B[p]==(D[p]||0);p++);if(B[p]>(D[p]||0)&&c--,R<0)y.push(1),g=!0;else{for(S=D.length,x=B.length,p=0,R+=2,(d=s(f/(B[0]+1)))>1&&(B=e(B,d,f),D=e(D,d,f),x=B.length,S=D.length),A=x,N=(O=D.slice(0,x)).length;N<x;O[N++]=0);P=B.slice(),P=[0].concat(P),_=B[0],B[1]>=f/2&&_++;do{if(d=0,(l=r(B,O,x,N))<0){if(E=O[0],x!=N&&(E=E*f+(O[1]||0)),(d=s(E/_))>1)for(d>=f&&(d=f-1),v=(w=e(B,d,f)).length,N=O.length;1==r(w,O,v,N);)d--,n(w,x<v?P:B,v,f),v=w.length,l=1;else 0==d&&(l=d=1),v=(w=B.slice()).length;if(v<N&&(w=[0].concat(w)),n(O,w,N,f),N=O.length,-1==l)for(;r(B,O,x,N)<1;)d++,n(O,x<N?P:B,N,f),N=O.length}else 0===l&&(d++,O=[0]);y[p++]=d,O[0]?O[N++]=D[A]||0:(O=[D[A]],N=1)}while((A++<S||null!=O[0])&&R--);g=null!=O[0],y[0]||y.splice(0,1)}if(f==a){for(p=1,R=y[0];R>=10;R/=10,p++);V(b,o+(b.e=p+c*h-1)+1,u,g)}else b.e=c,b.r=+g;return b}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,S=/^([^.]+)\.$/,_=/^\.([^.]+)$/,x=/^-?(Infinity|NaN)$/,P=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,r,n,t){var i,o=n?r:r.replace(P,"");if(x.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(A,function(e,r,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,t&&t!=i?e:r}),t&&(i=t,o=o.replace(S,"$1").replace(_,"0.$1")),r!=o))return new q(o,i);if(q.DEBUG)throw Error(l+"Not a"+(t?" base "+t:"")+" number: "+r);e.s=null}e.c=e.e=null},R.absoluteValue=R.abs=function(){var e=new q(this);return e.s<0&&(e.s=1),e},R.comparedTo=function(e,r){return b(this,new q(e,r))},R.decimalPlaces=R.dp=function(e,r){var n,t,i,o=this;if(null!=e)return y(e,0,w),null==r?r=L:y(r,0,8),V(new q(o),e+o.e+1,r);if(!(n=o.c))return null;if(t=((i=n.length-1)-m(this.e/h))*h,i=n[i])for(;i%10==0;i/=10,t--);return t<0&&(t=0),t},R.dividedBy=R.div=function(e,r){return n(this,new q(e,r),B,L)},R.dividedToIntegerBy=R.idiv=function(e,r){return n(this,new q(e,r),0,1)},R.exponentiatedBy=R.pow=function(e,r){var n,t,i,o,u,c,a,p,g=this;if((e=new q(e)).c&&!e.isInteger())throw Error(l+"Exponent not an integer: "+W(e));if(null!=r&&(r=new q(r)),u=e.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!e.c||!e.c[0])return p=new q(Math.pow(+W(g),u?2-O(e):+W(e))),r?p.mod(r):p;if(c=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new q(NaN);(t=!c&&g.isInteger()&&r.isInteger())&&(g=g.mod(r))}else{if(e.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||u&&g.c[1]>=24e7:g.c[0]<8e13||u&&g.c[0]<=9999975e7)))return o=g.s<0&&O(e)?-0:0,g.e>-1&&(o=1/o),new q(c?1/o:o);F&&(o=f(F/h+2))}for(u?(n=new q(.5),c&&(e.s=1),a=O(e)):a=(i=Math.abs(+W(e)))%2,p=new q(D);;){if(a){if(!(p=p.times(g)).c)break;o?p.c.length>o&&(p.c.length=o):t&&(p=p.mod(r))}if(i){if(0===(i=s(i/2)))break;a=i%2}else if(V(e=e.times(n),e.e+1,1),e.e>14)a=O(e);else{if(0==(i=+W(e)))break;a=i%2}g=g.times(g),o?g.c&&g.c.length>o&&(g.c.length=o):t&&(g=g.mod(r))}return t?p:(c&&(p=D.div(p)),r?p.mod(r):o?V(p,F,L,void 0):p)},R.integerValue=function(e){var r=new q(this);return null==e?e=L:y(e,0,8),V(r,r.e+1,e)},R.isEqualTo=R.eq=function(e,r){return 0===b(this,new q(e,r))},R.isFinite=function(){return!!this.c},R.isGreaterThan=R.gt=function(e,r){return b(this,new q(e,r))>0},R.isGreaterThanOrEqualTo=R.gte=function(e,r){return 1===(r=b(this,new q(e,r)))||0===r},R.isInteger=function(){return!!this.c&&m(this.e/h)>this.c.length-2},R.isLessThan=R.lt=function(e,r){return b(this,new q(e,r))<0},R.isLessThanOrEqualTo=R.lte=function(e,r){return-1===(r=b(this,new q(e,r)))||0===r},R.isNaN=function(){return!this.s},R.isNegative=function(){return this.s<0},R.isPositive=function(){return this.s>0},R.isZero=function(){return!!this.c&&0==this.c[0]},R.minus=function(e,r){var n,t,i,o,u=this,f=u.s;if(r=(e=new q(e,r)).s,!f||!r)return new q(NaN);if(f!=r)return e.s=-r,u.plus(e);var s=u.e/h,l=e.e/h,c=u.c,p=e.c;if(!s||!l){if(!c||!p)return c?(e.s=-r,e):new q(p?u:NaN);if(!c[0]||!p[0])return p[0]?(e.s=-r,e):new q(c[0]?u:3==L?-0:0)}if(s=m(s),l=m(l),c=c.slice(),f=s-l){for((o=f<0)?(f=-f,i=c):(l=s,i=p),i.reverse(),r=f;r--;i.push(0));i.reverse()}else for(t=(o=(f=c.length)<(r=p.length))?f:r,f=r=0;r<t;r++)if(c[r]!=p[r]){o=c[r]<p[r];break}if(o&&(i=c,c=p,p=i,e.s=-e.s),(r=(t=p.length)-(n=c.length))>0)for(;r--;c[n++]=0);for(r=a-1;t>f;){if(c[--t]<p[t]){for(n=t;n&&!c[--n];c[n]=r);--c[n],c[t]+=a}c[t]-=p[t]}for(;0==c[0];c.splice(0,1),--l);return c[0]?H(e,c,l):(e.s=3==L?-1:1,e.c=[e.e=0],e)},R.modulo=R.mod=function(e,r){var t,i,o=this;return e=new q(e,r),!o.c||!e.s||e.c&&!e.c[0]?new q(NaN):!e.c||o.c&&!o.c[0]?new q(o):(9==j?(i=e.s,e.s=1,t=n(o,e,0,3),e.s=i,t.s*=i):t=n(o,e,0,j),(e=o.minus(t.times(e))).c[0]||1!=j||(e.s=o.s),e)},R.multipliedBy=R.times=function(e,r){var n,t,i,o,u,f,s,l,c,p,g,w,v,b,y,O=this,N=O.c,E=(e=new q(e,r)).c;if(!(N&&E&&N[0]&&E[0]))return!O.s||!e.s||N&&!N[0]&&!E||E&&!E[0]&&!N?e.c=e.e=e.s=null:(e.s*=O.s,N&&E?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=m(O.e/h)+m(e.e/h),e.s*=O.s,(s=N.length)<(p=E.length)&&(v=N,N=E,E=v,i=s,s=p,p=i),i=s+p,v=[];i--;v.push(0));for(b=a,y=d,i=p;--i>=0;){for(n=0,g=E[i]%y,w=E[i]/y|0,o=i+(u=s);o>i;)n=((l=g*(l=N[--u]%y)+(f=w*l+(c=N[u]/y|0)*g)%y*y+v[o]+n)/b|0)+(f/y|0)+w*c,v[o--]=l%b;v[o]=n}return n?++t:v.splice(0,1),H(e,v,t)},R.negated=function(){var e=new q(this);return e.s=-e.s||null,e},R.plus=function(e,r){var n,t=this,i=t.s;if(r=(e=new q(e,r)).s,!i||!r)return new q(NaN);if(i!=r)return e.s=-r,t.minus(e);var o=t.e/h,u=e.e/h,f=t.c,s=e.c;if(!o||!u){if(!f||!s)return new q(i/0);if(!f[0]||!s[0])return s[0]?e:new q(f[0]?t:0*i)}if(o=m(o),u=m(u),f=f.slice(),i=o-u){for(i>0?(u=o,n=s):(i=-i,n=f),n.reverse();i--;n.push(0));n.reverse()}for((i=f.length)-(r=s.length)<0&&(n=s,s=f,f=n,r=i),i=0;r;)i=(f[--r]=f[r]+s[r]+i)/a|0,f[r]=a===f[r]?0:f[r]%a;return i&&(f=[i].concat(f),++u),H(e,f,u)},R.precision=R.sd=function(e,r){var n,t,i,o=this;if(null!=e&&e!==!!e)return y(e,1,w),null==r?r=L:y(r,0,8),V(new q(o),e,r);if(!(n=o.c))return null;if(t=(i=n.length-1)*h+1,i=n[i]){for(;i%10==0;i/=10,t--);for(i=n[0];i>=10;i/=10,t++);}return e&&o.e+1>t&&(t=o.e+1),t},R.shiftedBy=function(e){return y(e,-p,p),this.times("1e"+e)},R.squareRoot=R.sqrt=function(){var e,r,t,i,o,u=this,f=u.c,s=u.s,l=u.e,c=B+4,a=new q("0.5");if(1!==s||!f||!f[0])return new q(!s||s<0&&(!f||f[0])?NaN:f?u:1/0);if(0==(s=Math.sqrt(+W(u)))||s==1/0?(((r=v(f)).length+l)%2==0&&(r+="0"),s=Math.sqrt(+r),l=m((l+1)/2)-(l<0||l%2),t=new q(r=s==1/0?"1e"+l:(r=s.toExponential()).slice(0,r.indexOf("e")+1)+l)):t=new q(s+""),t.c[0])for((s=(l=t.e)+c)<3&&(s=0);;)if(o=t,t=a.times(o.plus(n(u,o,c,1))),v(o.c).slice(0,s)===(r=v(t.c)).slice(0,s)){if(t.e<l&&--s,"9999"!=(r=r.slice(s-3,s+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(V(t,t.e+B+2,1),e=!t.times(t).eq(u));break}if(!i&&(V(o,o.e+B+2,0),o.times(o).eq(u))){t=o;break}c+=4,s+=4,i=1}return V(t,t.e+B+1,L,e)},R.toExponential=function(e,r){return null!=e&&(y(e,0,w),e++),$(this,e,r,1)},R.toFixed=function(e,r){return null!=e&&(y(e,0,w),e=e+this.e+1),$(this,e,r)},R.toFormat=function(e,r,n){var t,i=this;if(null==n)null!=e&&r&&"object"==typeof r?(n=r,r=null):e&&"object"==typeof e?(n=e,e=r=null):n=G;else if("object"!=typeof n)throw Error(l+"Argument not an object: "+n);if(t=i.toFixed(e,r),i.c){var o,u=t.split("."),f=+n.groupSize,s=+n.secondaryGroupSize,c=n.groupSeparator||"",a=u[0],h=u[1],p=i.s<0,g=p?a.slice(1):a,d=g.length;if(s&&(o=f,f=s,s=o,d-=o),f>0&&d>0){for(o=d%f||f,a=g.substr(0,o);o<d;o+=f)a+=c+g.substr(o,f);s>0&&(a+=c+g.slice(o)),p&&(a="-"+a)}t=h?a+(n.decimalSeparator||"")+((s=+n.fractionGroupSize)?h.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):h):a}return(n.prefix||"")+t+(n.suffix||"")},R.toFraction=function(e){var r,t,i,o,u,f,s,c,a,p,d,w,m=this,b=m.c;if(null!=e&&(!(s=new q(e)).isInteger()&&(s.c||1!==s.s)||s.lt(D)))throw Error(l+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+W(s));if(!b)return new q(m);for(r=new q(D),a=t=new q(D),i=c=new q(D),w=v(b),u=r.e=w.length-m.e-1,r.c[0]=g[(f=u%h)<0?h+f:f],e=!e||s.comparedTo(r)>0?u>0?r:a:s,f=I,I=1/0,s=new q(w),c.c[0]=0;p=n(s,r,0,1),1!=(o=t.plus(p.times(i))).comparedTo(e);)t=i,i=o,a=c.plus(p.times(o=a)),c=o,r=s.minus(p.times(o=r)),s=o;return o=n(e.minus(t),i,0,1),c=c.plus(o.times(a)),t=t.plus(o.times(i)),c.s=a.s=m.s,d=n(a,i,u*=2,L).minus(m).abs().comparedTo(n(c,t,u,L).minus(m).abs())<1?[a,i]:[c,t],I=f,d},R.toNumber=function(){return+W(this)},R.toPrecision=function(e,r){return null!=e&&y(e,1,w),$(this,e,r,2)},R.toString=function(e){var r,n=this,i=n.s,o=n.e;return null===o?i?(r="Infinity",i<0&&(r="-"+r)):r="NaN":(null==e?r=o<=T||o>=U?N(v(n.c),o):E(v(n.c),o,"0"):10===e?r=E(v((n=V(new q(n),B+o+1,L)).c),n.e,"0"):(y(e,2,k.length,"Base"),r=t(E(v(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(r="-"+r)),r},R.valueOf=R.toJSON=function(){return W(this)},R._isBigNumber=!0,null!=r&&q.set(r),q}()).default=o.BigNumber=o,void 0===(t=function(){return o}.call(r,n,r,e))||(e.exports=t)}()},function(e,r){e.exports=require("fs")}]);