Problem:
Score: 400 points

Problem Statement

We have N integers A_1, A_2, ..., A_N.

There are \frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-th number in that list?

Constraints

All values in input are integers.

2 \leq N \leq 2 \times 10^5

1 \leq K \leq \frac{N(N-1)}{2}

-10^9 \leq A_i \leq 10^9\ (1 \leq i \leq N)

Input

Input is given from Standard Input in the following format:

N K
A_1 A_2 \dots A_N

Output

Print the answer.

Sample Input 1

4 3
3 3 -4 -2

Sample Output 1

-6

There are six ways to form a pair. The products of those pairs are 9, -12, -6, -12, -6, 8.

Sorting those numbers in ascending order, we have -12, -12, -6, -6, 8, 9. The third number in this list is -6.

Sample Input 2

10 40
5 4 3 2 -1 0 0 0 0 0

Sample Output 2

6

Sample Input 3

30 413
-170202098 -268409015 537203564 983211703 21608710 -443999067 -937727165 -97596546 -372334013 398994917 -972141167 798607104 -949068442 -959948616 37909651 0 886627544 -20098238 0 -948955241 0 -214720580 277222296 -18897162 834475626 0 -425610555 110117526 663621752 0

Sample Output 3

448283280358331064

Solution in JavaScript (node.js v5.12) (judge verdict: Time Limit Exceeded)

/*!
 * path: atcoder/abc155/d
 * URL: https://github.com/koukimetal/procomvis/tree/master/src/contest/atcoder/abc155/d
 */!function(t){var e={};function r(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=e,r.d=function(t,e,o){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(o,n,function(e){return t[e]}.bind(null,n));return o},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};e.__esModule=!0;var n=o(r(1)),i=r(2);n.default.readFile("/dev/stdin","utf8",(function(t,e){!function(t){var e=new i.Solver,r=e.parse(t),o=e.solve(r);e.print(o)}(e)}))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var o,n=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};e.__esModule=!0;var u=r(3),a=r(4),p=i(r(5)),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.solve=function(t){var e=t.N,r=t.K,o=t.A;o.sort((function(t,e){return t-e}));for(var n=new Array(e),i=0;i<e;i++)n[i]=p.default(o[i]);var u=0,a=0,s=0;for(i=0;i<e;i++)o[i]<0?u++:o[i]>0?a++:s++;for(var l=u*a,f=s*(a+u)+s*(s-1)/2,v=p.default(2),c=p.default("-1000000000000000005"),h=p.default("1000000000000000005");h.minus(c).gt(p.default.one);){var y=h.plus(c).divide(v),g=0;if(y.lt(p.default.zero))for(i=0;i<e&&!(o[i]>=0);i++){for(var d=u+s-1,m=e;m-d>1;){var b=(d+m)/2|0;n[i].multiply(n[b]).lt(y)?m=b:d=b}g+=e-m}else if(y.gt(p.default.zero)){g+=l+f;for(i=0;i<e;i++)if(o[i]<0){for(d=i,m=u;m-d>1;){b=(d+m)/2|0;n[i].multiply(n[b]).lt(y)?m=b:d=b}g+=u-m}else if(o[i]>0){for(d=i,m=e;m-d>1;){b=(d+m)/2|0;n[i].multiply(n[b]).lt(y)?d=b:m=b}g+=d-i}}else g=l;g<r?c=y:h=y}return{answer:c}},e.prototype.parse=function(t){for(var e=a.getSpaceIterator(t,(function(t){return parseInt(t)})),r=e.next().value,o=e.next().value,n=[],i=0;i<r;i++)n.push(e.next().value);return{N:r,K:o,A:n}},e.prototype.print=function(t){console.log(t.answer.toString())},e}(u.SolverBase);e.Solver=s},function(t,e,r){"use strict";e.__esModule=!0;var o=function(){};e.SolverBase=o},function(t,e,r){"use strict";var o=this&&this.__generator||function(t,e){var r,o,n,i,u={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,o&&(n=2&i[0]?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,o=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(n=(n=u.trys).length>0&&n[n.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]<n[3])){u.label=i[1];break}if(6===i[0]&&u.label<n[1]){u.label=n[1],n=i;break}if(n&&u.label<n[2]){u.label=n[2],u.ops.push(i);break}n[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],o=0}finally{r=n=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};e.__esModule=!0,e.getSpaceIterator=function(t,e){var r,n;return o(this,(function(o){switch(o.label){case 0:r=0,n=t.split(/\s+/).map((function(t){return e(t)})),o.label=1;case 1:return r<n.length?[4,n[r]]:[3,4];case 2:o.sent(),o.label=3;case 3:return r++,[3,1];case 4:return[2,void 0]}}))}},function(t,e,r){(function(t){var o,n=function(t){"use strict";var e=9007199254740992,r=l(e),o="function"==typeof BigInt;function i(t,e,r,o){return void 0===t?i[0]:void 0!==e&&(10!=+e||r)?U(t,e,r,o):K(t)}function u(t,e){this.value=t,this.sign=e,this.isSmall=!1}function a(t){this.value=t,this.sign=t<0,this.isSmall=!0}function p(t){this.value=t}function s(t){return-e<t&&t<e}function l(t){return t<1e7?[t]:t<1e14?[t%1e7,Math.floor(t/1e7)]:[t%1e7,Math.floor(t/1e7)%1e7,Math.floor(t/1e14)]}function f(t){v(t);var e=t.length;if(e<4&&_(t,r)<0)switch(e){case 0:return 0;case 1:return t[0];case 2:return t[0]+1e7*t[1];default:return t[0]+1e7*(t[1]+1e7*t[2])}return t}function v(t){for(var e=t.length;0===t[--e];);t.length=e+1}function c(t){for(var e=new Array(t),r=-1;++r<t;)e[r]=0;return e}function h(t){return t>0?Math.floor(t):Math.ceil(t)}function y(t,e){var r,o,n=t.length,i=e.length,u=new Array(n),a=0;for(o=0;o<i;o++)a=(r=t[o]+e[o]+a)>=1e7?1:0,u[o]=r-1e7*a;for(;o<n;)a=1e7===(r=t[o]+a)?1:0,u[o++]=r-1e7*a;return a>0&&u.push(a),u}function g(t,e){return t.length>=e.length?y(t,e):y(e,t)}function d(t,e){var r,o,n=t.length,i=new Array(n);for(o=0;o<n;o++)r=t[o]-1e7+e,e=Math.floor(r/1e7),i[o]=r-1e7*e,e+=1;for(;e>0;)i[o++]=e%1e7,e=Math.floor(e/1e7);return i}function m(t,e){var r,o,n=t.length,i=e.length,u=new Array(n),a=0;for(r=0;r<i;r++)(o=t[r]-a-e[r])<0?(o+=1e7,a=1):a=0,u[r]=o;for(r=i;r<n;r++){if(!((o=t[r]-a)<0)){u[r++]=o;break}o+=1e7,u[r]=o}for(;r<n;r++)u[r]=t[r];return v(u),u}function b(t,e,r){var o,n,i=t.length,p=new Array(i),s=-e;for(o=0;o<i;o++)n=t[o]+s,s=Math.floor(n/1e7),n%=1e7,p[o]=n<0?n+1e7:n;return"number"==typeof(p=f(p))?(r&&(p=-p),new a(p)):new u(p,r)}function w(t,e){var r,o,n,i,u=t.length,a=e.length,p=c(u+a);for(n=0;n<u;++n){i=t[n];for(var s=0;s<a;++s)r=i*e[s]+p[n+s],o=Math.floor(r/1e7),p[n+s]=r-1e7*o,p[n+s+1]+=o}return v(p),p}function S(t,e){var r,o,n=t.length,i=new Array(n),u=0;for(o=0;o<n;o++)r=t[o]*e+u,u=Math.floor(r/1e7),i[o]=r-1e7*u;for(;u>0;)i[o++]=u%1e7,u=Math.floor(u/1e7);return i}function M(t,e){for(var r=[];e-- >0;)r.push(0);return r.concat(t)}function q(t,e,r){return new u(t<1e7?S(e,t):w(e,l(t)),r)}function N(t){var e,r,o,n,i=t.length,u=c(i+i);for(o=0;o<i;o++){r=0-(n=t[o])*n;for(var a=o;a<i;a++)e=n*t[a]*2+u[o+a]+r,r=Math.floor(e/1e7),u[o+a]=e-1e7*r;u[o+i]=r}return v(u),u}function O(t,e){var r,o,n,i,u=t.length,a=c(u);for(n=0,r=u-1;r>=0;--r)n=(i=1e7*n+t[r])-(o=h(i/e))*e,a[r]=0|o;return[a,0|n]}function E(t,e){var r,n=K(e);if(o)return[new p(t.value/n.value),new p(t.value%n.value)];var s,y=t.value,g=n.value;if(0===g)throw new Error("Cannot divide by zero");if(t.isSmall)return n.isSmall?[new a(h(y/g)),new a(y%g)]:[i[0],t];if(n.isSmall){if(1===g)return[t,i[0]];if(-1==g)return[t.negate(),i[0]];var d=Math.abs(g);if(d<1e7){s=f((r=O(y,d))[0]);var b=r[1];return t.sign&&(b=-b),"number"==typeof s?(t.sign!==n.sign&&(s=-s),[new a(s),new a(b)]):[new u(s,t.sign!==n.sign),new a(b)]}g=l(d)}var w=_(y,g);if(-1===w)return[i[0],t];if(0===w)return[i[t.sign===n.sign?1:-1],i[0]];s=(r=y.length+g.length<=200?function(t,e){var r,o,n,i,u,a,p,s=t.length,l=e.length,v=c(e.length),h=e[l-1],y=Math.ceil(1e7/(2*h)),g=S(t,y),d=S(e,y);for(g.length<=s&&g.push(0),d.push(0),h=d[l-1],o=s-l;o>=0;o--){for(r=1e7-1,g[o+l]!==h&&(r=Math.floor((1e7*g[o+l]+g[o+l-1])/h)),n=0,i=0,a=d.length,u=0;u<a;u++)n+=r*d[u],p=Math.floor(n/1e7),i+=g[o+u]-(n-1e7*p),n=p,i<0?(g[o+u]=i+1e7,i=-1):(g[o+u]=i,i=0);for(;0!==i;){for(r-=1,n=0,u=0;u<a;u++)(n+=g[o+u]-1e7+d[u])<0?(g[o+u]=n+1e7,n=0):(g[o+u]=n,n=1);i+=n}v[o]=r}return g=O(g,y)[0],[f(v),f(g)]}(y,g):function(t,e){for(var r,o,n,i,u,a=t.length,p=e.length,s=[],l=[];a;)if(l.unshift(t[--a]),v(l),_(l,e)<0)s.push(0);else{n=1e7*l[(o=l.length)-1]+l[o-2],i=1e7*e[p-1]+e[p-2],o>p&&(n=1e7*(n+1)),r=Math.ceil(n/i);do{if(_(u=S(e,r),l)<=0)break;r--}while(r);s.push(r),l=m(l,u)}return s.reverse(),[f(s),f(l)]}(y,g))[0];var M=t.sign!==n.sign,q=r[1],N=t.sign;return"number"==typeof s?(M&&(s=-s),s=new a(s)):s=new u(s,M),"number"==typeof q?(N&&(q=-q),q=new a(q)):q=new u(q,N),[s,q]}function _(t,e){if(t.length!==e.length)return t.length>e.length?1:-1;for(var r=t.length-1;r>=0;r--)if(t[r]!==e[r])return t[r]>e[r]?1:-1;return 0}function P(t){var e=t.abs();return!e.isUnit()&&(!!(e.equals(2)||e.equals(3)||e.equals(5))||!(e.isEven()||e.isDivisibleBy(3)||e.isDivisibleBy(5))&&(!!e.lesser(49)||void 0))}function x(t,e){for(var r,o,i,u=t.prev(),a=u,p=0;a.isEven();)a=a.divide(2),p++;t:for(o=0;o<e.length;o++)if(!t.lesser(e[o])&&!(i=n(e[o]).modPow(a,t)).isUnit()&&!i.equals(u)){for(r=p-1;0!=r;r--){if((i=i.square().mod(t)).isUnit())return!1;if(i.equals(u))continue t}return!1}return!0}u.prototype=Object.create(i.prototype),a.prototype=Object.create(i.prototype),p.prototype=Object.create(i.prototype),u.prototype.add=function(t){var e=K(t);if(this.sign!==e.sign)return this.subtract(e.negate());var r=this.value,o=e.value;return e.isSmall?new u(d(r,Math.abs(o)),this.sign):new u(g(r,o),this.sign)},u.prototype.plus=u.prototype.add,a.prototype.add=function(t){var e=K(t),r=this.value;if(r<0!==e.sign)return this.subtract(e.negate());var o=e.value;if(e.isSmall){if(s(r+o))return new a(r+o);o=l(Math.abs(o))}return new u(d(o,Math.abs(r)),r<0)},a.prototype.plus=a.prototype.add,p.prototype.add=function(t){return new p(this.value+K(t).value)},p.prototype.plus=p.prototype.add,u.prototype.subtract=function(t){var e=K(t);if(this.sign!==e.sign)return this.add(e.negate());var r=this.value,o=e.value;return e.isSmall?b(r,Math.abs(o),this.sign):function(t,e,r){var o;return _(t,e)>=0?o=m(t,e):(o=m(e,t),r=!r),"number"==typeof(o=f(o))?(r&&(o=-o),new a(o)):new u(o,r)}(r,o,this.sign)},u.prototype.minus=u.prototype.subtract,a.prototype.subtract=function(t){var e=K(t),r=this.value;if(r<0!==e.sign)return this.add(e.negate());var o=e.value;return e.isSmall?new a(r-o):b(o,Math.abs(r),r>=0)},a.prototype.minus=a.prototype.subtract,p.prototype.subtract=function(t){return new p(this.value-K(t).value)},p.prototype.minus=p.prototype.subtract,u.prototype.negate=function(){return new u(this.value,!this.sign)},a.prototype.negate=function(){var t=this.sign,e=new a(-this.value);return e.sign=!t,e},p.prototype.negate=function(){return new p(-this.value)},u.prototype.abs=function(){return new u(this.value,!1)},a.prototype.abs=function(){return new a(Math.abs(this.value))},p.prototype.abs=function(){return new p(this.value>=0?this.value:-this.value)},u.prototype.multiply=function(t){var e,r,o,n=K(t),a=this.value,p=n.value,s=this.sign!==n.sign;if(n.isSmall){if(0===p)return i[0];if(1===p)return this;if(-1===p)return this.negate();if((e=Math.abs(p))<1e7)return new u(S(a,e),s);p=l(e)}return r=a.length,o=p.length,new u(-.012*r-.012*o+15e-6*r*o>0?function t(e,r){var o=Math.max(e.length,r.length);if(o<=30)return w(e,r);o=Math.ceil(o/2);var n=e.slice(o),i=e.slice(0,o),u=r.slice(o),a=r.slice(0,o),p=t(i,a),s=t(n,u),l=t(g(i,n),g(a,u)),f=g(g(p,M(m(m(l,p),s),o)),M(s,2*o));return v(f),f}(a,p):w(a,p),s)},u.prototype.times=u.prototype.multiply,a.prototype._multiplyBySmall=function(t){return s(t.value*this.value)?new a(t.value*this.value):q(Math.abs(t.value),l(Math.abs(this.value)),this.sign!==t.sign)},u.prototype._multiplyBySmall=function(t){return 0===t.value?i[0]:1===t.value?this:-1===t.value?this.negate():q(Math.abs(t.value),this.value,this.sign!==t.sign)},a.prototype.multiply=function(t){return K(t)._multiplyBySmall(this)},a.prototype.times=a.prototype.multiply,p.prototype.multiply=function(t){return new p(this.value*K(t).value)},p.prototype.times=p.prototype.multiply,u.prototype.square=function(){return new u(N(this.value),!1)},a.prototype.square=function(){var t=this.value*this.value;return s(t)?new a(t):new u(N(l(Math.abs(this.value))),!1)},p.prototype.square=function(t){return new p(this.value*this.value)},u.prototype.divmod=function(t){var e=E(this,t);return{quotient:e[0],remainder:e[1]}},p.prototype.divmod=a.prototype.divmod=u.prototype.divmod,u.prototype.divide=function(t){return E(this,t)[0]},p.prototype.over=p.prototype.divide=function(t){return new p(this.value/K(t).value)},a.prototype.over=a.prototype.divide=u.prototype.over=u.prototype.divide,u.prototype.mod=function(t){return E(this,t)[1]},p.prototype.mod=p.prototype.remainder=function(t){return new p(this.value%K(t).value)},a.prototype.remainder=a.prototype.mod=u.prototype.remainder=u.prototype.mod,u.prototype.pow=function(t){var e,r,o,n=K(t),u=this.value,p=n.value;if(0===p)return i[1];if(0===u)return i[0];if(1===u)return i[1];if(-1===u)return n.isEven()?i[1]:i[-1];if(n.sign)return i[0];if(!n.isSmall)throw new Error("The exponent "+n.toString()+" is too large.");if(this.isSmall&&s(e=Math.pow(u,p)))return new a(h(e));for(r=this,o=i[1];!0&p&&(o=o.times(r),--p),0!==p;)p/=2,r=r.square();return o},a.prototype.pow=u.prototype.pow,p.prototype.pow=function(t){var e=K(t),r=this.value,o=e.value,n=BigInt(0),u=BigInt(1),a=BigInt(2);if(o===n)return i[1];if(r===n)return i[0];if(r===u)return i[1];if(r===BigInt(-1))return e.isEven()?i[1]:i[-1];if(e.isNegative())return new p(n);for(var s=this,l=i[1];(o&u)===u&&(l=l.times(s),--o),o!==n;)o/=a,s=s.square();return l},u.prototype.modPow=function(t,e){if(t=K(t),(e=K(e)).isZero())throw new Error("Cannot take modPow with modulus 0");var r=i[1],o=this.mod(e);for(t.isNegative()&&(t=t.multiply(i[-1]),o=o.modInv(e));t.isPositive();){if(o.isZero())return i[0];t.isOdd()&&(r=r.multiply(o).mod(e)),t=t.divide(2),o=o.square().mod(e)}return r},p.prototype.modPow=a.prototype.modPow=u.prototype.modPow,u.prototype.compareAbs=function(t){var e=K(t),r=this.value,o=e.value;return e.isSmall?1:_(r,o)},a.prototype.compareAbs=function(t){var e=K(t),r=Math.abs(this.value),o=e.value;return e.isSmall?r===(o=Math.abs(o))?0:r>o?1:-1:-1},p.prototype.compareAbs=function(t){var e=this.value,r=K(t).value;return(e=e>=0?e:-e)===(r=r>=0?r:-r)?0:e>r?1:-1},u.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=K(t),r=this.value,o=e.value;return this.sign!==e.sign?e.sign?1:-1:e.isSmall?this.sign?-1:1:_(r,o)*(this.sign?-1:1)},u.prototype.compareTo=u.prototype.compare,a.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=K(t),r=this.value,o=e.value;return e.isSmall?r==o?0:r>o?1:-1:r<0!==e.sign?r<0?-1:1:r<0?1:-1},a.prototype.compareTo=a.prototype.compare,p.prototype.compare=function(t){if(t===1/0)return-1;if(t===-1/0)return 1;var e=this.value,r=K(t).value;return e===r?0:e>r?1:-1},p.prototype.compareTo=p.prototype.compare,u.prototype.equals=function(t){return 0===this.compare(t)},p.prototype.eq=p.prototype.equals=a.prototype.eq=a.prototype.equals=u.prototype.eq=u.prototype.equals,u.prototype.notEquals=function(t){return 0!==this.compare(t)},p.prototype.neq=p.prototype.notEquals=a.prototype.neq=a.prototype.notEquals=u.prototype.neq=u.prototype.notEquals,u.prototype.greater=function(t){return this.compare(t)>0},p.prototype.gt=p.prototype.greater=a.prototype.gt=a.prototype.greater=u.prototype.gt=u.prototype.greater,u.prototype.lesser=function(t){return this.compare(t)<0},p.prototype.lt=p.prototype.lesser=a.prototype.lt=a.prototype.lesser=u.prototype.lt=u.prototype.lesser,u.prototype.greaterOrEquals=function(t){return this.compare(t)>=0},p.prototype.geq=p.prototype.greaterOrEquals=a.prototype.geq=a.prototype.greaterOrEquals=u.prototype.geq=u.prototype.greaterOrEquals,u.prototype.lesserOrEquals=function(t){return this.compare(t)<=0},p.prototype.leq=p.prototype.lesserOrEquals=a.prototype.leq=a.prototype.lesserOrEquals=u.prototype.leq=u.prototype.lesserOrEquals,u.prototype.isEven=function(){return 0==(1&this.value[0])},a.prototype.isEven=function(){return 0==(1&this.value)},p.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},u.prototype.isOdd=function(){return 1==(1&this.value[0])},a.prototype.isOdd=function(){return 1==(1&this.value)},p.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},u.prototype.isPositive=function(){return!this.sign},a.prototype.isPositive=function(){return this.value>0},p.prototype.isPositive=a.prototype.isPositive,u.prototype.isNegative=function(){return this.sign},a.prototype.isNegative=function(){return this.value<0},p.prototype.isNegative=a.prototype.isNegative,u.prototype.isUnit=function(){return!1},a.prototype.isUnit=function(){return 1===Math.abs(this.value)},p.prototype.isUnit=function(){return this.abs().value===BigInt(1)},u.prototype.isZero=function(){return!1},a.prototype.isZero=function(){return 0===this.value},p.prototype.isZero=function(){return this.value===BigInt(0)},u.prototype.isDivisibleBy=function(t){var e=K(t);return!e.isZero()&&(!!e.isUnit()||(0===e.compareAbs(2)?this.isEven():this.mod(e).isZero()))},p.prototype.isDivisibleBy=a.prototype.isDivisibleBy=u.prototype.isDivisibleBy,u.prototype.isPrime=function(t){var e=P(this);if(void 0!==e)return e;var r=this.abs(),o=r.bitLength();if(o<=64)return x(r,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var i=Math.log(2)*o.toJSNumber(),u=Math.ceil(!0===t?2*Math.pow(i,2):i),a=[],p=0;p<u;p++)a.push(n(p+2));return x(r,a)},p.prototype.isPrime=a.prototype.isPrime=u.prototype.isPrime,u.prototype.isProbablePrime=function(t,e){var r=P(this);if(void 0!==r)return r;for(var o=this.abs(),i=void 0===t?5:t,u=[],a=0;a<i;a++)u.push(n.randBetween(2,o.minus(2),e));return x(o,u)},p.prototype.isProbablePrime=a.prototype.isProbablePrime=u.prototype.isProbablePrime,u.prototype.modInv=function(t){for(var e,r,o,i=n.zero,u=n.one,a=K(t),p=this.abs();!p.isZero();)e=a.divide(p),r=i,o=a,i=u,a=p,u=r.subtract(e.multiply(u)),p=o.subtract(e.multiply(p));if(!a.isUnit())throw new Error(this.toString()+" and "+t.toString()+" are not co-prime");return-1===i.compare(0)&&(i=i.add(t)),this.isNegative()?i.negate():i},p.prototype.modInv=a.prototype.modInv=u.prototype.modInv,u.prototype.next=function(){var t=this.value;return this.sign?b(t,1,this.sign):new u(d(t,1),this.sign)},a.prototype.next=function(){var t=this.value;return t+1<e?new a(t+1):new u(r,!1)},p.prototype.next=function(){return new p(this.value+BigInt(1))},u.prototype.prev=function(){var t=this.value;return this.sign?new u(d(t,1),!0):b(t,1,this.sign)},a.prototype.prev=function(){var t=this.value;return t-1>-e?new a(t-1):new u(r,!0)},p.prototype.prev=function(){return new p(this.value-BigInt(1))};for(var I=[1];2*I[I.length-1]<=1e7;)I.push(2*I[I.length-1]);var B=I.length,A=I[B-1];function j(t){return Math.abs(t)<=1e7}function Z(t,e,r){e=K(e);for(var o=t.isNegative(),i=e.isNegative(),u=o?t.not():t,a=i?e.not():e,p=0,s=0,l=null,f=null,v=[];!u.isZero()||!a.isZero();)p=(l=E(u,A))[1].toJSNumber(),o&&(p=A-1-p),s=(f=E(a,A))[1].toJSNumber(),i&&(s=A-1-s),u=l[0],a=f[0],v.push(r(p,s));for(var c=0!==r(o?1:0,i?1:0)?n(-1):n(0),h=v.length-1;h>=0;h-=1)c=c.multiply(A).add(n(v[h]));return c}u.prototype.shiftLeft=function(t){var e=K(t).toJSNumber();if(!j(e))throw new Error(String(e)+" is too large for shifting.");if(e<0)return this.shiftRight(-e);var r=this;if(r.isZero())return r;for(;e>=B;)r=r.multiply(A),e-=B-1;return r.multiply(I[e])},p.prototype.shiftLeft=a.prototype.shiftLeft=u.prototype.shiftLeft,u.prototype.shiftRight=function(t){var e,r=K(t).toJSNumber();if(!j(r))throw new Error(String(r)+" is too large for shifting.");if(r<0)return this.shiftLeft(-r);for(var o=this;r>=B;){if(o.isZero()||o.isNegative()&&o.isUnit())return o;o=(e=E(o,A))[1].isNegative()?e[0].prev():e[0],r-=B-1}return(e=E(o,I[r]))[1].isNegative()?e[0].prev():e[0]},p.prototype.shiftRight=a.prototype.shiftRight=u.prototype.shiftRight,u.prototype.not=function(){return this.negate().prev()},p.prototype.not=a.prototype.not=u.prototype.not,u.prototype.and=function(t){return Z(this,t,(function(t,e){return t&e}))},p.prototype.and=a.prototype.and=u.prototype.and,u.prototype.or=function(t){return Z(this,t,(function(t,e){return t|e}))},p.prototype.or=a.prototype.or=u.prototype.or,u.prototype.xor=function(t){return Z(this,t,(function(t,e){return t^e}))},p.prototype.xor=a.prototype.xor=u.prototype.xor;function J(t){var e=t.value,r="number"==typeof e?e|1<<30:"bigint"==typeof e?e|BigInt(1<<30):e[0]+1e7*e[1]|1073758208;return r&-r}function L(t,e){return t=K(t),e=K(e),t.greater(e)?t:e}function k(t,e){return t=K(t),e=K(e),t.lesser(e)?t:e}function T(t,e){if(t=K(t).abs(),e=K(e).abs(),t.equals(e))return t;if(t.isZero())return e;if(e.isZero())return t;for(var r,o,n=i[1];t.isEven()&&e.isEven();)r=k(J(t),J(e)),t=t.divide(r),e=e.divide(r),n=n.multiply(r);for(;t.isEven();)t=t.divide(J(t));do{for(;e.isEven();)e=e.divide(J(e));t.greater(e)&&(o=e,e=t,t=o),e=e.subtract(t)}while(!e.isZero());return n.isUnit()?t:t.multiply(n)}u.prototype.bitLength=function(){var t=this;return t.compareTo(n(0))<0&&(t=t.negate().subtract(n(1))),0===t.compareTo(n(0))?n(0):n(function t(e,r){if(r.compareTo(e)<=0){var o=t(e,r.square(r)),i=o.p,u=o.e,a=i.multiply(r);return a.compareTo(e)<=0?{p:a,e:2*u+1}:{p:i,e:2*u}}return{p:n(1),e:0}}(t,n(2)).e).add(n(1))},p.prototype.bitLength=a.prototype.bitLength=u.prototype.bitLength;var U=function(t,e,r,o){r=r||"0123456789abcdefghijklmnopqrstuvwxyz",t=String(t),o||(t=t.toLowerCase(),r=r.toLowerCase());var n,i=t.length,u=Math.abs(e),a={};for(n=0;n<r.length;n++)a[r[n]]=n;for(n=0;n<i;n++){if("-"!==(l=t[n])&&(l in a&&a[l]>=u)){if("1"===l&&1===u)continue;throw new Error(l+" is not a valid digit in base "+e+".")}}e=K(e);var p=[],s="-"===t[0];for(n=s?1:0;n<t.length;n++){var l;if((l=t[n])in a)p.push(K(a[l]));else{if("<"!==l)throw new Error(l+" is not a valid character");var f=n;do{n++}while(">"!==t[n]&&n<t.length);p.push(K(t.slice(f+1,n)))}}return z(p,e,s)};function z(t,e,r){var o,n=i[0],u=i[1];for(o=t.length-1;o>=0;o--)n=n.add(t[o].times(u)),u=u.times(e);return r?n.negate():n}function D(t,e){if((e=n(e)).isZero()){if(t.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(e.equals(-1)){if(t.isZero())return{value:[0],isNegative:!1};if(t.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-t.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var r=Array.apply(null,Array(t.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return r.unshift([1]),{value:[].concat.apply([],r),isNegative:!1}}var o=!1;if(t.isNegative()&&e.isPositive()&&(o=!0,t=t.abs()),e.isUnit())return t.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(t.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:o};for(var i,u=[],a=t;a.isNegative()||a.compareAbs(e)>=0;){i=a.divmod(e),a=i.quotient;var p=i.remainder;p.isNegative()&&(p=e.minus(p).abs(),a=a.next()),u.push(p.toJSNumber())}return u.push(a.toJSNumber()),{value:u.reverse(),isNegative:o}}function C(t,e,r){var o=D(t,e);return(o.isNegative?"-":"")+o.value.map((function(t){return function(t,e){return t<(e=e||"0123456789abcdefghijklmnopqrstuvwxyz").length?e[t]:"<"+t+">"}(t,r)})).join("")}function R(t){if(s(+t)){var e=+t;if(e===h(e))return o?new p(BigInt(e)):new a(e);throw new Error("Invalid integer: "+t)}var r="-"===t[0];r&&(t=t.slice(1));var n=t.split(/e/i);if(n.length>2)throw new Error("Invalid integer: "+n.join("e"));if(2===n.length){var i=n[1];if("+"===i[0]&&(i=i.slice(1)),(i=+i)!==h(i)||!s(i))throw new Error("Invalid integer: "+i+" is not a valid exponent.");var l=n[0],f=l.indexOf(".");if(f>=0&&(i-=l.length-f-1,l=l.slice(0,f)+l.slice(f+1)),i<0)throw new Error("Cannot include negative exponent part for integers");t=l+=new Array(i+1).join("0")}if(!/^([0-9][0-9]*)$/.test(t))throw new Error("Invalid integer: "+t);if(o)return new p(BigInt(r?"-"+t:t));for(var c=[],y=t.length,g=y-7;y>0;)c.push(+t.slice(g,y)),(g-=7)<0&&(g=0),y-=7;return v(c),new u(c,r)}function K(t){return"number"==typeof t?function(t){if(o)return new p(BigInt(t));if(s(t)){if(t!==h(t))throw new Error(t+" is not an integer.");return new a(t)}return R(t.toString())}(t):"string"==typeof t?R(t):"bigint"==typeof t?new p(t):t}u.prototype.toArray=function(t){return D(this,t)},a.prototype.toArray=function(t){return D(this,t)},p.prototype.toArray=function(t){return D(this,t)},u.prototype.toString=function(t,e){if(void 0===t&&(t=10),10!==t)return C(this,t,e);for(var r,o=this.value,n=o.length,i=String(o[--n]);--n>=0;)r=String(o[n]),i+="0000000".slice(r.length)+r;return(this.sign?"-":"")+i},a.prototype.toString=function(t,e){return void 0===t&&(t=10),10!=t?C(this,t,e):String(this.value)},p.prototype.toString=a.prototype.toString,p.prototype.toJSON=u.prototype.toJSON=a.prototype.toJSON=function(){return this.toString()},u.prototype.valueOf=function(){return parseInt(this.toString(),10)},u.prototype.toJSNumber=u.prototype.valueOf,a.prototype.valueOf=function(){return this.value},a.prototype.toJSNumber=a.prototype.valueOf,p.prototype.valueOf=p.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};for(var F=0;F<1e3;F++)i[F]=K(F),F>0&&(i[-F]=K(-F));return i.one=i[1],i.zero=i[0],i.minusOne=i[-1],i.max=L,i.min=k,i.gcd=T,i.lcm=function(t,e){return t=K(t).abs(),e=K(e).abs(),t.divide(T(t,e)).multiply(e)},i.isInstance=function(t){return t instanceof u||t instanceof a||t instanceof p},i.randBetween=function(t,e,r){t=K(t),e=K(e);var o=r||Math.random,n=k(t,e),u=L(t,e).subtract(n).add(1);if(u.isSmall)return n.add(Math.floor(o()*u));for(var a=D(u,1e7).value,p=[],s=!0,l=0;l<a.length;l++){var f=s?a[l]:1e7,v=h(o()*f);p.push(v),v<f&&(s=!1)}return n.add(i.fromArray(p,1e7,!1))},i.fromArray=function(t,e,r){return z(t.map(K),K(e||10),r)},i}();t.hasOwnProperty("exports")&&(t.exports=n),void 0===(o=function(){return n}.call(e,r,e,t))||(t.exports=o)}).call(this,r(6)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}}]);