Problem:
Score : 300 points

Problem Statement

Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.

There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.

What is the minimum amount of money with which he can buy M cans of energy drinks?

It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.

Constraints

All values in input are integers.

1 \leq N, M \leq 10^5

1 \leq A_i \leq 10^9

1 \leq B_i \leq 10^5

B_1 + ... + B_N \geq M

Input

Input is given from Standard Input in the following format:

N M
A_1 B_1
A_2 B_2
\vdots
A_N B_N

Output

Print the minimum amount of money with which Takahashi can buy M cans of energy drinks.

Sample Input 1

2 5
4 9
2 4

Sample Output 1

12

With 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.

Sample Input 2

4 30
6 18
2 5
3 10
7 9

Sample Output 2

130

Sample Input 3

1 100000
1000000000 100000

Sample Output 3

100000000000000

The output may not fit into a 32-bit integer type.

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

var PS={};(function(exports){"use strict";exports.arrayApply=function(fs){return function(xs){var l=fs.length;var k=xs.length;var result=new Array(l*k);var n=0;for(var i=0;i<l;i++){var f=fs[i];for(var j=0;j<k;j++){result[n++]=f(xs[j])}}return result}}})(PS["Control.Apply"]=PS["Control.Apply"]||{});(function(exports){"use strict";var Semigroupoid=function(compose){this.compose=compose};var semigroupoidFn=new Semigroupoid(function(f){return function(g){return function(x){return f(g(x))}}});var compose=function(dict){return dict.compose};exports["compose"]=compose;exports["Semigroupoid"]=Semigroupoid;exports["semigroupoidFn"]=semigroupoidFn})(PS["Control.Semigroupoid"]=PS["Control.Semigroupoid"]||{});(function(exports){"use strict";var Control_Semigroupoid=PS["Control.Semigroupoid"];var Category=function(Semigroupoid0,identity){this.Semigroupoid0=Semigroupoid0;this.identity=identity};var identity=function(dict){return dict.identity};var categoryFn=new Category(function(){return Control_Semigroupoid.semigroupoidFn},function(x){return x});exports["Category"]=Category;exports["identity"]=identity;exports["categoryFn"]=categoryFn})(PS["Control.Category"]=PS["Control.Category"]||{});(function(exports){"use strict";var otherwise=true;exports["otherwise"]=otherwise})(PS["Data.Boolean"]=PS["Data.Boolean"]||{});(function(exports){"use strict";exports.refEq=function(r1){return function(r2){return r1===r2}}})(PS["Data.Eq"]=PS["Data.Eq"]||{});(function(exports){"use strict";exports.boolConj=function(b1){return function(b2){return b1&&b2}};exports.boolDisj=function(b1){return function(b2){return b1||b2}};exports.boolNot=function(b){return!b}})(PS["Data.HeytingAlgebra"]=PS["Data.HeytingAlgebra"]||{});(function(exports){"use strict";exports.unit={}})(PS["Data.Unit"]=PS["Data.Unit"]||{});(function(exports){"use strict";exports.showNumberImpl=function(n){var str=n.toString();return isNaN(str+".0")?str:str+".0"}})(PS["Data.Show"]=PS["Data.Show"]||{});(function(exports){"use strict";var $foreign=PS["Data.Show"];var Data_Symbol=PS["Data.Symbol"];var Record_Unsafe=PS["Record.Unsafe"];var Type_Data_RowList=PS["Type.Data.RowList"];var Show=function(show){this.show=show};var showNumber=new Show($foreign.showNumberImpl);var show=function(dict){return dict.show};exports["Show"]=Show;exports["show"]=show;exports["showNumber"]=showNumber})(PS["Data.Show"]=PS["Data.Show"]||{});(function(exports){"use strict";var $foreign=PS["Data.Unit"];var Data_Show=PS["Data.Show"];exports["unit"]=$foreign.unit})(PS["Data.Unit"]=PS["Data.Unit"]||{});(function(exports){"use strict";var $foreign=PS["Data.HeytingAlgebra"];var Data_Symbol=PS["Data.Symbol"];var Data_Unit=PS["Data.Unit"];var Record_Unsafe=PS["Record.Unsafe"];var Type_Data_Row=PS["Type.Data.Row"];var Type_Data_RowList=PS["Type.Data.RowList"];var HeytingAlgebra=function(conj,disj,ff,implies,not,tt){this.conj=conj;this.disj=disj;this.ff=ff;this.implies=implies;this.not=not;this.tt=tt};var tt=function(dict){return dict.tt};var not=function(dict){return dict.not};var implies=function(dict){return dict.implies};var ff=function(dict){return dict.ff};var disj=function(dict){return dict.disj};var heytingAlgebraBoolean=new HeytingAlgebra($foreign.boolConj,$foreign.boolDisj,false,function(a){return function(b){return disj(heytingAlgebraBoolean)(not(heytingAlgebraBoolean)(a))(b)}},$foreign.boolNot,true);var conj=function(dict){return dict.conj};exports["HeytingAlgebra"]=HeytingAlgebra;exports["tt"]=tt;exports["ff"]=ff;exports["implies"]=implies;exports["conj"]=conj;exports["disj"]=disj;exports["not"]=not;exports["heytingAlgebraBoolean"]=heytingAlgebraBoolean})(PS["Data.HeytingAlgebra"]=PS["Data.HeytingAlgebra"]||{});(function(exports){"use strict";var $foreign=PS["Data.Eq"];var Data_HeytingAlgebra=PS["Data.HeytingAlgebra"];var Data_Symbol=PS["Data.Symbol"];var Data_Unit=PS["Data.Unit"];var Data_Void=PS["Data.Void"];var Record_Unsafe=PS["Record.Unsafe"];var Type_Data_RowList=PS["Type.Data.RowList"];var Eq=function(eq){this.eq=eq};var Eq1=function(eq1){this.eq1=eq1};var eqInt=new Eq($foreign.refEq);var eqChar=new Eq($foreign.refEq);var eq1=function(dict){return dict.eq1};var eq=function(dict){return dict.eq};exports["Eq"]=Eq;exports["eq"]=eq;exports["Eq1"]=Eq1;exports["eq1"]=eq1;exports["eqInt"]=eqInt;exports["eqChar"]=eqChar})(PS["Data.Eq"]=PS["Data.Eq"]||{});(function(exports){"use strict";exports.unsafeCompareImpl=function(lt){return function(eq){return function(gt){return function(x){return function(y){return x<y?lt:x===y?eq:gt}}}}}})(PS["Data.Ord.Unsafe"]=PS["Data.Ord.Unsafe"]||{});(function(exports){"use strict";exports.concatString=function(s1){return function(s2){return s1+s2}}})(PS["Data.Semigroup"]=PS["Data.Semigroup"]||{});(function(exports){"use strict";var $foreign=PS["Data.Semigroup"];var Data_Symbol=PS["Data.Symbol"];var Data_Unit=PS["Data.Unit"];var Data_Void=PS["Data.Void"];var Record_Unsafe=PS["Record.Unsafe"];var Type_Data_RowList=PS["Type.Data.RowList"];var Semigroup=function(append){this.append=append};var semigroupString=new Semigroup($foreign.concatString);var append=function(dict){return dict.append};exports["Semigroup"]=Semigroup;exports["append"]=append;exports["semigroupString"]=semigroupString})(PS["Data.Semigroup"]=PS["Data.Semigroup"]||{});(function(exports){"use strict";var Data_Eq=PS["Data.Eq"];var Data_Semigroup=PS["Data.Semigroup"];var Data_Show=PS["Data.Show"];var LT=function(){function LT(){}LT.value=new LT;return LT}();var GT=function(){function GT(){}GT.value=new GT;return GT}();var EQ=function(){function EQ(){}EQ.value=new EQ;return EQ}();exports["LT"]=LT;exports["GT"]=GT;exports["EQ"]=EQ})(PS["Data.Ordering"]=PS["Data.Ordering"]||{});(function(exports){"use strict";var $foreign=PS["Data.Ord.Unsafe"];var Data_Ordering=PS["Data.Ordering"];var unsafeCompare=$foreign.unsafeCompareImpl(Data_Ordering.LT.value)(Data_Ordering.EQ.value)(Data_Ordering.GT.value);exports["unsafeCompare"]=unsafeCompare})(PS["Data.Ord.Unsafe"]=PS["Data.Ord.Unsafe"]||{});(function(exports){"use strict";var $foreign=PS["Data.Semiring"];var Data_Symbol=PS["Data.Symbol"];var Data_Unit=PS["Data.Unit"];var Record_Unsafe=PS["Record.Unsafe"];var Type_Data_Row=PS["Type.Data.Row"];var Type_Data_RowList=PS["Type.Data.RowList"];var Semiring=function(add,mul,one,zero){this.add=add;this.mul=mul;this.one=one;this.zero=zero};var zero=function(dict){return dict.zero};var one=function(dict){return dict.one};var mul=function(dict){return dict.mul};var add=function(dict){return dict.add};exports["Semiring"]=Semiring;exports["add"]=add;exports["zero"]=zero;exports["mul"]=mul;exports["one"]=one})(PS["Data.Semiring"]=PS["Data.Semiring"]||{});(function(exports){"use strict";var $foreign=PS["Data.Ring"];var Data_Semiring=PS["Data.Semiring"];var Data_Symbol=PS["Data.Symbol"];var Data_Unit=PS["Data.Unit"];var Record_Unsafe=PS["Record.Unsafe"];var Type_Data_RowList=PS["Type.Data.RowList"];var Ring=function(Semiring0,sub){this.Semiring0=Semiring0;this.sub=sub};var sub=function(dict){return dict.sub};exports["Ring"]=Ring;exports["sub"]=sub})(PS["Data.Ring"]=PS["Data.Ring"]||{});(function(exports){"use strict";var $foreign=PS["Data.Ord"];var Data_Eq=PS["Data.Eq"];var Data_Ord_Unsafe=PS["Data.Ord.Unsafe"];var Data_Ordering=PS["Data.Ordering"];var Data_Ring=PS["Data.Ring"];var Data_Semiring=PS["Data.Semiring"];var Data_Symbol=PS["Data.Symbol"];var Data_Unit=PS["Data.Unit"];var Data_Void=PS["Data.Void"];var Record_Unsafe=PS["Record.Unsafe"];var Type_Data_RowList=PS["Type.Data.RowList"];var Ord=function(Eq0,compare){this.Eq0=Eq0;this.compare=compare};var Ord1=function(Eq10,compare1){this.Eq10=Eq10;this.compare1=compare1};var ordInt=new Ord(function(){return Data_Eq.eqInt},Data_Ord_Unsafe.unsafeCompare);var ordChar=new Ord(function(){return Data_Eq.eqChar},Data_Ord_Unsafe.unsafeCompare);var compare1=function(dict){return dict.compare1};var compare=function(dict){return dict.compare};var comparing=function(dictOrd){return function(f){return function(x){return function(y){return compare(dictOrd)(f(x))(f(y))}}}};var greaterThan=function(dictOrd){return function(a1){return function(a2){var v=compare(dictOrd)(a1)(a2);if(v instanceof Data_Ordering.GT){return true}return false}}};var lessThan=function(dictOrd){return function(a1){return function(a2){var v=compare(dictOrd)(a1)(a2);if(v instanceof Data_Ordering.LT){return true}return false}}};var max=function(dictOrd){return function(x){return function(y){var v=compare(dictOrd)(x)(y);if(v instanceof Data_Ordering.LT){return y}if(v instanceof Data_Ordering.EQ){return x}if(v instanceof Data_Ordering.GT){return x}throw new Error("Failed pattern match at Data.Ord (line 128, column 3 - line 131, column 12): "+[v.constructor.name])}}};var min=function(dictOrd){return function(x){return function(y){var v=compare(dictOrd)(x)(y);if(v instanceof Data_Ordering.LT){return x}if(v instanceof Data_Ordering.EQ){return x}if(v instanceof Data_Ordering.GT){return y}throw new Error("Failed pattern match at Data.Ord (line 119, column 3 - line 122, column 12): "+[v.constructor.name])}}};exports["Ord"]=Ord;exports["compare"]=compare;exports["Ord1"]=Ord1;exports["compare1"]=compare1;exports["lessThan"]=lessThan;exports["greaterThan"]=greaterThan;exports["comparing"]=comparing;exports["min"]=min;exports["max"]=max;exports["ordInt"]=ordInt;exports["ordChar"]=ordChar})(PS["Data.Ord"]=PS["Data.Ord"]||{});(function(exports){"use strict";var Control_Category=PS["Control.Category"];var Data_Boolean=PS["Data.Boolean"];var Data_Ord=PS["Data.Ord"];var Data_Ring=PS["Data.Ring"];var flip=function(f){return function(b){return function(a){return f(a)(b)}}};var $$const=function(a){return function(v){return a}};exports["flip"]=flip;exports["const"]=$$const})(PS["Data.Function"]=PS["Data.Function"]||{});(function(exports){"use strict";exports.arrayMap=function(f){return function(arr){var l=arr.length;var result=new Array(l);for(var i=0;i<l;i++){result[i]=f(arr[i])}return result}}})(PS["Data.Functor"]=PS["Data.Functor"]||{});(function(exports){"use strict";var $foreign=PS["Data.Functor"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Function=PS["Data.Function"];var Data_Unit=PS["Data.Unit"];var Functor=function(map){this.map=map};var map=function(dict){return dict.map};var functorFn=new Functor(Control_Semigroupoid.compose(Control_Semigroupoid.semigroupoidFn));var functorArray=new Functor($foreign.arrayMap);exports["Functor"]=Functor;exports["map"]=map;exports["functorFn"]=functorFn;exports["functorArray"]=functorArray})(PS["Data.Functor"]=PS["Data.Functor"]||{});(function(exports){"use strict";var $foreign=PS["Control.Apply"];var Control_Category=PS["Control.Category"];var Data_Function=PS["Data.Function"];var Data_Functor=PS["Data.Functor"];var Apply=function(Functor0,apply){this.Functor0=Functor0;this.apply=apply};var applyArray=new Apply(function(){return Data_Functor.functorArray},$foreign.arrayApply);var apply=function(dict){return dict.apply};exports["Apply"]=Apply;exports["apply"]=apply;exports["applyArray"]=applyArray})(PS["Control.Apply"]=PS["Control.Apply"]||{});(function(exports){"use strict";var Control_Apply=PS["Control.Apply"];var Data_Functor=PS["Data.Functor"];var Data_Unit=PS["Data.Unit"];var Applicative=function(Apply0,pure){this.Apply0=Apply0;this.pure=pure};var pure=function(dict){return dict.pure};exports["Applicative"]=Applicative;exports["pure"]=pure})(PS["Control.Applicative"]=PS["Control.Applicative"]||{});(function(exports){"use strict";exports.arrayBind=function(arr){return function(f){var result=[];for(var i=0,l=arr.length;i<l;i++){Array.prototype.push.apply(result,f(arr[i]))}return result}}})(PS["Control.Bind"]=PS["Control.Bind"]||{});(function(exports){"use strict";var $foreign=PS["Control.Bind"];var Control_Applicative=PS["Control.Applicative"];var Control_Apply=PS["Control.Apply"];var Control_Category=PS["Control.Category"];var Data_Function=PS["Data.Function"];var Data_Functor=PS["Data.Functor"];var Data_Unit=PS["Data.Unit"];var Bind=function(Apply0,bind){this.Apply0=Apply0;this.bind=bind};var Discard=function(discard){this.discard=discard};var discard=function(dict){return dict.discard};var bindArray=new Bind(function(){return Control_Apply.applyArray},$foreign.arrayBind);var bind=function(dict){return dict.bind};var discardUnit=new Discard(function(dictBind){return bind(dictBind)});exports["Bind"]=Bind;exports["bind"]=bind;exports["Discard"]=Discard;exports["discard"]=discard;exports["bindArray"]=bindArray;exports["discardUnit"]=discardUnit})(PS["Control.Bind"]=PS["Control.Bind"]||{});(function(exports){"use strict";exports.topInt=2147483647;exports.bottomInt=-2147483648;exports.topChar=String.fromCharCode(65535);exports.bottomChar=String.fromCharCode(0)})(PS["Data.Bounded"]=PS["Data.Bounded"]||{});(function(exports){"use strict";var $foreign=PS["Data.Bounded"];var Data_Ord=PS["Data.Ord"];var Data_Ordering=PS["Data.Ordering"];var Data_Unit=PS["Data.Unit"];var Bounded=function(Ord0,bottom,top){this.Ord0=Ord0;this.bottom=bottom;this.top=top};var top=function(dict){return dict.top};var boundedInt=new Bounded(function(){return Data_Ord.ordInt},$foreign.bottomInt,$foreign.topInt);var boundedChar=new Bounded(function(){return Data_Ord.ordChar},$foreign.bottomChar,$foreign.topChar);var bottom=function(dict){return dict.bottom};exports["Bounded"]=Bounded;exports["bottom"]=bottom;exports["top"]=top;exports["boundedInt"]=boundedInt;exports["boundedChar"]=boundedChar})(PS["Data.Bounded"]=PS["Data.Bounded"]||{});(function(exports){"use strict";exports.foldrArray=function(f){return function(init){return function(xs){var acc=init;var len=xs.length;for(var i=len-1;i>=0;i--){acc=f(xs[i])(acc)}return acc}}};exports.foldlArray=function(f){return function(init){return function(xs){var acc=init;var len=xs.length;for(var i=0;i<len;i++){acc=f(acc)(xs[i])}return acc}}}})(PS["Data.Foldable"]=PS["Data.Foldable"]||{});(function(exports){"use strict";var Data_Boolean=PS["Data.Boolean"];var Data_Eq=PS["Data.Eq"];var Data_EuclideanRing=PS["Data.EuclideanRing"];var Data_Ord=PS["Data.Ord"];var Data_Ordering=PS["Data.Ordering"];var Data_Semigroup=PS["Data.Semigroup"];var Data_Symbol=PS["Data.Symbol"];var Data_Unit=PS["Data.Unit"];var Record_Unsafe=PS["Record.Unsafe"];var Type_Data_RowList=PS["Type.Data.RowList"];var Monoid=function(Semigroup0,mempty){this.Semigroup0=Semigroup0;this.mempty=mempty};var monoidString=new Monoid(function(){return Data_Semigroup.semigroupString},"");var mempty=function(dict){return dict.mempty};exports["Monoid"]=Monoid;exports["mempty"]=mempty;exports["monoidString"]=monoidString})(PS["Data.Monoid"]=PS["Data.Monoid"]||{});(function(exports){"use strict";var Control_Alt=PS["Control.Alt"];var Control_Alternative=PS["Control.Alternative"];var Control_Applicative=PS["Control.Applicative"];var Control_Apply=PS["Control.Apply"];var Control_Bind=PS["Control.Bind"];var Control_Category=PS["Control.Category"];var Control_Extend=PS["Control.Extend"];var Control_Monad=PS["Control.Monad"];var Control_MonadZero=PS["Control.MonadZero"];var Control_Plus=PS["Control.Plus"];var Data_Bounded=PS["Data.Bounded"];var Data_Eq=PS["Data.Eq"];var Data_Function=PS["Data.Function"];var Data_Functor=PS["Data.Functor"];var Data_Functor_Invariant=PS["Data.Functor.Invariant"];var Data_Monoid=PS["Data.Monoid"];var Data_Ord=PS["Data.Ord"];var Data_Ordering=PS["Data.Ordering"];var Data_Semigroup=PS["Data.Semigroup"];var Data_Show=PS["Data.Show"];var Data_Unit=PS["Data.Unit"];var Prelude=PS["Prelude"];var Nothing=function(){function Nothing(){}Nothing.value=new Nothing;return Nothing}();var Just=function(){function Just(value0){this.value0=value0}Just.create=function(value0){return new Just(value0)};return Just}();var maybe=function(v){return function(v1){return function(v2){if(v2 instanceof Nothing){return v}if(v2 instanceof Just){return v1(v2.value0)}throw new Error("Failed pattern match at Data.Maybe (line 217, column 1 - line 217, column 51): "+[v.constructor.name,v1.constructor.name,v2.constructor.name])}}};var isJust=maybe(false)(Data_Function["const"](true));var functorMaybe=new Data_Functor.Functor(function(v){return function(v1){if(v1 instanceof Just){return new Just(v(v1.value0))}return Nothing.value}});var fromMaybe=function(a){return maybe(a)(Control_Category.identity(Control_Category.categoryFn))};var fromJust=function(dictPartial){return function(v){if(v instanceof Just){return v.value0}throw new Error("Failed pattern match at Data.Maybe (line 268, column 1 - line 268, column 46): "+[v.constructor.name])}};var applyMaybe=new Control_Apply.Apply(function(){return functorMaybe},function(v){return function(v1){if(v instanceof Just){return Data_Functor.map(functorMaybe)(v.value0)(v1)}if(v instanceof Nothing){return Nothing.value}throw new Error("Failed pattern match at Data.Maybe (line 67, column 1 - line 67, column 35): "+[v.constructor.name,v1.constructor.name])}});var bindMaybe=new Control_Bind.Bind(function(){return applyMaybe},function(v){return function(v1){if(v instanceof Just){return v1(v.value0)}if(v instanceof Nothing){return Nothing.value}throw new Error("Failed pattern match at Data.Maybe (line 125, column 1 - line 125, column 33): "+[v.constructor.name,v1.constructor.name])}});var applicativeMaybe=new Control_Applicative.Applicative(function(){return applyMaybe},Just.create);exports["Nothing"]=Nothing;exports["Just"]=Just;exports["maybe"]=maybe;exports["fromMaybe"]=fromMaybe;exports["isJust"]=isJust;exports["fromJust"]=fromJust;exports["functorMaybe"]=functorMaybe;exports["applyMaybe"]=applyMaybe;exports["applicativeMaybe"]=applicativeMaybe;exports["bindMaybe"]=bindMaybe})(PS["Data.Maybe"]=PS["Data.Maybe"]||{});(function(exports){"use strict";var Control_Applicative=PS["Control.Applicative"];var Control_Apply=PS["Control.Apply"];var Control_Bind=PS["Control.Bind"];var Control_Monad=PS["Control.Monad"];var Data_Bounded=PS["Data.Bounded"];var Data_Eq=PS["Data.Eq"];var Data_Functor=PS["Data.Functor"];var Data_HeytingAlgebra=PS["Data.HeytingAlgebra"];var Data_Monoid=PS["Data.Monoid"];var Data_Ord=PS["Data.Ord"];var Data_Semigroup=PS["Data.Semigroup"];var Data_Semiring=PS["Data.Semiring"];var Data_Show=PS["Data.Show"];var Prelude=PS["Prelude"];var Conj=function(x){return x};var semigroupConj=function(dictHeytingAlgebra){return new Data_Semigroup.Semigroup(function(v){return function(v1){return Data_HeytingAlgebra.conj(dictHeytingAlgebra)(v)(v1)}})};var monoidConj=function(dictHeytingAlgebra){return new Data_Monoid.Monoid(function(){return semigroupConj(dictHeytingAlgebra)},Data_HeytingAlgebra.tt(dictHeytingAlgebra))};exports["Conj"]=Conj;exports["semigroupConj"]=semigroupConj;exports["monoidConj"]=monoidConj})(PS["Data.Monoid.Conj"]=PS["Data.Monoid.Conj"]||{});(function(exports){"use strict";var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Function=PS["Data.Function"];var Data_Functor=PS["Data.Functor"];var Data_Monoid_Additive=PS["Data.Monoid.Additive"];var Data_Monoid_Conj=PS["Data.Monoid.Conj"];var Data_Monoid_Disj=PS["Data.Monoid.Disj"];var Data_Monoid_Dual=PS["Data.Monoid.Dual"];var Data_Monoid_Endo=PS["Data.Monoid.Endo"];var Data_Monoid_Multiplicative=PS["Data.Monoid.Multiplicative"];var Data_Semigroup_First=PS["Data.Semigroup.First"];var Data_Semigroup_Last=PS["Data.Semigroup.Last"];var Prelude=PS["Prelude"];var Newtype=function(unwrap,wrap){this.unwrap=unwrap;this.wrap=wrap};var wrap=function(dict){return dict.wrap};var unwrap=function(dict){return dict.unwrap};var newtypeConj=new Newtype(function(v){return v},Data_Monoid_Conj.Conj);var alaF=function(dictFunctor){return function(dictFunctor1){return function(dictNewtype){return function(dictNewtype1){return function(v){return function(f){return function($80){return Data_Functor.map(dictFunctor1)(unwrap(dictNewtype1))(f(Data_Functor.map(dictFunctor)(wrap(dictNewtype))($80)))}}}}}}};exports["unwrap"]=unwrap;exports["wrap"]=wrap;exports["Newtype"]=Newtype;exports["alaF"]=alaF;exports["newtypeConj"]=newtypeConj})(PS["Data.Newtype"]=PS["Data.Newtype"]||{});(function(exports){"use strict";var $foreign=PS["Data.Foldable"];var Control_Alt=PS["Control.Alt"];var Control_Applicative=PS["Control.Applicative"];var Control_Apply=PS["Control.Apply"];var Control_Bind=PS["Control.Bind"];var Control_Category=PS["Control.Category"];var Control_Plus=PS["Control.Plus"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Eq=PS["Data.Eq"];var Data_Function=PS["Data.Function"];var Data_Functor=PS["Data.Functor"];var Data_HeytingAlgebra=PS["Data.HeytingAlgebra"];var Data_Maybe=PS["Data.Maybe"];var Data_Maybe_First=PS["Data.Maybe.First"];var Data_Maybe_Last=PS["Data.Maybe.Last"];var Data_Monoid=PS["Data.Monoid"];var Data_Monoid_Additive=PS["Data.Monoid.Additive"];var Data_Monoid_Conj=PS["Data.Monoid.Conj"];var Data_Monoid_Disj=PS["Data.Monoid.Disj"];var Data_Monoid_Dual=PS["Data.Monoid.Dual"];var Data_Monoid_Endo=PS["Data.Monoid.Endo"];var Data_Monoid_Multiplicative=PS["Data.Monoid.Multiplicative"];var Data_Newtype=PS["Data.Newtype"];var Data_Ord=PS["Data.Ord"];var Data_Ordering=PS["Data.Ordering"];var Data_Semigroup=PS["Data.Semigroup"];var Data_Semiring=PS["Data.Semiring"];var Data_Unit=PS["Data.Unit"];var Prelude=PS["Prelude"];var Foldable=function(foldMap,foldl,foldr){this.foldMap=foldMap;this.foldl=foldl;this.foldr=foldr};var foldr=function(dict){return dict.foldr};var foldl=function(dict){return dict.foldl};var foldMapDefaultR=function(dictFoldable){return function(dictMonoid){return function(f){return foldr(dictFoldable)(function(x){return function(acc){return Data_Semigroup.append(dictMonoid.Semigroup0())(f(x))(acc)}})(Data_Monoid.mempty(dictMonoid))}}};var foldableArray=new Foldable(function(dictMonoid){return foldMapDefaultR(foldableArray)(dictMonoid)},$foreign.foldlArray,$foreign.foldrArray);var foldMap=function(dict){return dict.foldMap};var all=function(dictFoldable){return function(dictHeytingAlgebra){return Data_Newtype.alaF(Data_Functor.functorFn)(Data_Functor.functorFn)(Data_Newtype.newtypeConj)(Data_Newtype.newtypeConj)(Data_Monoid_Conj.Conj)(foldMap(dictFoldable)(Data_Monoid_Conj.monoidConj(dictHeytingAlgebra)))}};exports["Foldable"]=Foldable;exports["foldr"]=foldr;exports["foldl"]=foldl;exports["foldMap"]=foldMap;exports["foldMapDefaultR"]=foldMapDefaultR;exports["all"]=all;exports["foldableArray"]=foldableArray})(PS["Data.Foldable"]=PS["Data.Foldable"]||{});(function(exports){"use strict";var Control_Alt=PS["Control.Alt"];var Control_Applicative=PS["Control.Applicative"];var Control_Apply=PS["Control.Apply"];var Control_Bind=PS["Control.Bind"];var Control_Extend=PS["Control.Extend"];var Control_Monad=PS["Control.Monad"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Bifoldable=PS["Data.Bifoldable"];var Data_Bifunctor=PS["Data.Bifunctor"];var Data_Bitraversable=PS["Data.Bitraversable"];var Data_Bounded=PS["Data.Bounded"];var Data_Eq=PS["Data.Eq"];var Data_Foldable=PS["Data.Foldable"];var Data_FoldableWithIndex=PS["Data.FoldableWithIndex"];var Data_Function=PS["Data.Function"];var Data_Functor=PS["Data.Functor"];var Data_Functor_Invariant=PS["Data.Functor.Invariant"];var Data_FunctorWithIndex=PS["Data.FunctorWithIndex"];var Data_Maybe=PS["Data.Maybe"];var Data_Monoid=PS["Data.Monoid"];var Data_Ord=PS["Data.Ord"];var Data_Ordering=PS["Data.Ordering"];var Data_Semigroup=PS["Data.Semigroup"];var Data_Show=PS["Data.Show"];var Data_Traversable=PS["Data.Traversable"];var Data_TraversableWithIndex=PS["Data.TraversableWithIndex"];var Data_Unit=PS["Data.Unit"];var Prelude=PS["Prelude"];var Left=function(){function Left(value0){this.value0=value0}Left.create=function(value0){return new Left(value0)};return Left}();var Right=function(){function Right(value0){this.value0=value0}Right.create=function(value0){return new Right(value0)};return Right}();var note=function(a){return Data_Maybe.maybe(new Left(a))(Right.create)};var functorEither=new Data_Functor.Functor(function(f){return function(m){if(m instanceof Left){return new Left(m.value0)}if(m instanceof Right){return new Right(f(m.value0))}throw new Error("Failed pattern match at Data.Either (line 38, column 8 - line 38, column 52): "+[m.constructor.name])}});var either=function(v){return function(v1){return function(v2){if(v2 instanceof Left){return v(v2.value0)}if(v2 instanceof Right){return v1(v2.value0)}throw new Error("Failed pattern match at Data.Either (line 238, column 1 - line 238, column 64): "+[v.constructor.name,v1.constructor.name,v2.constructor.name])}}};var applyEither=new Control_Apply.Apply(function(){return functorEither},function(v){return function(v1){if(v instanceof Left){return new Left(v.value0)}if(v instanceof Right){return Data_Functor.map(functorEither)(v.value0)(v1)}throw new Error("Failed pattern match at Data.Either (line 82, column 1 - line 82, column 41): "+[v.constructor.name,v1.constructor.name])}});var bindEither=new Control_Bind.Bind(function(){return applyEither},either(function(e){return function(v){return new Left(e)}})(function(a){return function(f){return f(a)}}));var applicativeEither=new Control_Applicative.Applicative(function(){return applyEither},Right.create);exports["Left"]=Left;exports["Right"]=Right;exports["either"]=either;exports["note"]=note;exports["functorEither"]=functorEither;exports["applyEither"]=applyEither;exports["applicativeEither"]=applicativeEither;exports["bindEither"]=bindEither})(PS["Data.Either"]=PS["Data.Either"]||{});(function(exports){"use strict";exports.unsafePartial=function(f){return f()}})(PS["Partial.Unsafe"]=PS["Partial.Unsafe"]||{});(function(exports){"use strict";exports.crashWith=function(){return function(msg){throw new Error(msg)}}})(PS["Partial"]=PS["Partial"]||{});(function(exports){"use strict";var $foreign=PS["Partial"];exports["crashWith"]=$foreign.crashWith})(PS["Partial"]=PS["Partial"]||{});(function(exports){"use strict";var $foreign=PS["Partial.Unsafe"];var Partial=PS["Partial"];var unsafeCrashWith=function(msg){return $foreign.unsafePartial(function(dictPartial){return Partial.crashWith(dictPartial)(msg)})};exports["unsafeCrashWith"]=unsafeCrashWith})(PS["Partial.Unsafe"]=PS["Partial.Unsafe"]||{});(function(exports){"use strict";var Control_Applicative=PS["Control.Applicative"];var Control_Bind=PS["Control.Bind"];var Control_Monad=PS["Control.Monad"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Bifunctor=PS["Data.Bifunctor"];var Data_Either=PS["Data.Either"];var Data_Functor=PS["Data.Functor"];var Data_Identity=PS["Data.Identity"];var Data_Maybe=PS["Data.Maybe"];var Data_Unit=PS["Data.Unit"];var Effect=PS["Effect"];var Effect_Ref=PS["Effect.Ref"];var Partial_Unsafe=PS["Partial.Unsafe"];var Prelude=PS["Prelude"];var Loop=function(){function Loop(value0){this.value0=value0}Loop.create=function(value0){return new Loop(value0)};return Loop}();var Done=function(){function Done(value0){this.value0=value0}Done.create=function(value0){return new Done(value0)};return Done}();var tailRec=function(f){var go=function($copy_v){var $tco_done=false;var $tco_result;function $tco_loop(v){if(v instanceof Loop){$copy_v=f(v.value0);return}if(v instanceof Done){$tco_done=true;return v.value0}throw new Error("Failed pattern match at Control.Monad.Rec.Class (line 91, column 3 - line 91, column 25): "+[v.constructor.name])}while(!$tco_done){$tco_result=$tco_loop($copy_v)}return $tco_result};return function($53){return go(f($53))}};exports["Loop"]=Loop;exports["Done"]=Done;exports["tailRec"]=tailRec})(PS["Control.Monad.Rec.Class"]=PS["Control.Monad.Rec.Class"]||{});(function(exports){"use strict";exports.length=function(xs){return xs.length};exports.indexImpl=function(just){return function(nothing){return function(xs){return function(i){return i<0||i>=xs.length?nothing:just(xs[i])}}}};exports.sortImpl=function(f){return function(l){return l.slice().sort(function(x,y){return f(x)(y)})}};exports.slice=function(s){return function(e){return function(l){return l.slice(s,e)}}}})(PS["Data.Array"]=PS["Data.Array"]||{});(function(exports){"use strict";var Control_Applicative=PS["Control.Applicative"];var Control_Apply=PS["Control.Apply"];var Control_Biapplicative=PS["Control.Biapplicative"];var Control_Biapply=PS["Control.Biapply"];var Control_Bind=PS["Control.Bind"];var Control_Comonad=PS["Control.Comonad"];var Control_Extend=PS["Control.Extend"];var Control_Lazy=PS["Control.Lazy"];var Control_Monad=PS["Control.Monad"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Bifoldable=PS["Data.Bifoldable"];var Data_Bifunctor=PS["Data.Bifunctor"];var Data_Bitraversable=PS["Data.Bitraversable"];var Data_BooleanAlgebra=PS["Data.BooleanAlgebra"];var Data_Bounded=PS["Data.Bounded"];var Data_CommutativeRing=PS["Data.CommutativeRing"];var Data_Distributive=PS["Data.Distributive"];var Data_Eq=PS["Data.Eq"];var Data_Foldable=PS["Data.Foldable"];var Data_FoldableWithIndex=PS["Data.FoldableWithIndex"];var Data_Function=PS["Data.Function"];var Data_Functor=PS["Data.Functor"];var Data_Functor_Invariant=PS["Data.Functor.Invariant"];var Data_FunctorWithIndex=PS["Data.FunctorWithIndex"];var Data_HeytingAlgebra=PS["Data.HeytingAlgebra"];var Data_Maybe=PS["Data.Maybe"];var Data_Maybe_First=PS["Data.Maybe.First"];var Data_Monoid=PS["Data.Monoid"];var Data_Newtype=PS["Data.Newtype"];var Data_Ord=PS["Data.Ord"];var Data_Ordering=PS["Data.Ordering"];var Data_Ring=PS["Data.Ring"];var Data_Semigroup=PS["Data.Semigroup"];var Data_Semigroup_Foldable=PS["Data.Semigroup.Foldable"];var Data_Semigroup_Traversable=PS["Data.Semigroup.Traversable"];var Data_Semiring=PS["Data.Semiring"];var Data_Show=PS["Data.Show"];var Data_Traversable=PS["Data.Traversable"];var Data_TraversableWithIndex=PS["Data.TraversableWithIndex"];var Data_Unit=PS["Data.Unit"];var Prelude=PS["Prelude"];var Type_Equality=PS["Type.Equality"];var Tuple=function(){function Tuple(value0,value1){this.value0=value0;this.value1=value1}Tuple.create=function(value0){return function(value1){return new Tuple(value0,value1)}};return Tuple}();var snd=function(v){return v.value1};var fst=function(v){return v.value0};exports["Tuple"]=Tuple;exports["fst"]=fst;exports["snd"]=snd})(PS["Data.Tuple"]=PS["Data.Tuple"]||{});(function(exports){"use strict";var $foreign=PS["Data.Unfoldable1"];var Data_Boolean=PS["Data.Boolean"];var Data_Eq=PS["Data.Eq"];var Data_Maybe=PS["Data.Maybe"];var Data_Ord=PS["Data.Ord"];var Data_Ring=PS["Data.Ring"];var Data_Semigroup_Traversable=PS["Data.Semigroup.Traversable"];var Data_Semiring=PS["Data.Semiring"];var Data_Tuple=PS["Data.Tuple"];var Partial_Unsafe=PS["Partial.Unsafe"];var Prelude=PS["Prelude"];var Unfoldable1=function(unfoldr1){this.unfoldr1=unfoldr1};var unfoldr1=function(dict){return dict.unfoldr1};exports["Unfoldable1"]=Unfoldable1;exports["unfoldr1"]=unfoldr1})(PS["Data.Unfoldable1"]=PS["Data.Unfoldable1"]||{});(function(exports){"use strict";var $foreign=PS["Data.Unfoldable"];var Data_Function=PS["Data.Function"];var Data_Functor=PS["Data.Functor"];var Data_Maybe=PS["Data.Maybe"];var Data_Ord=PS["Data.Ord"];var Data_Ring=PS["Data.Ring"];var Data_Traversable=PS["Data.Traversable"];var Data_Tuple=PS["Data.Tuple"];var Data_Unfoldable1=PS["Data.Unfoldable1"];var Data_Unit=PS["Data.Unit"];var Partial_Unsafe=PS["Partial.Unsafe"];var Prelude=PS["Prelude"];var Unfoldable=function(Unfoldable10,unfoldr){this.Unfoldable10=Unfoldable10;this.unfoldr=unfoldr};var unfoldr=function(dict){return dict.unfoldr};var replicate=function(dictUnfoldable){return function(n){return function(v){var step=function(i){var $7=i<=0;if($7){return Data_Maybe.Nothing.value}return new Data_Maybe.Just(new Data_Tuple.Tuple(v,i-1|0))};return unfoldr(dictUnfoldable)(step)(n)}}};exports["Unfoldable"]=Unfoldable;exports["unfoldr"]=unfoldr;exports["replicate"]=replicate})(PS["Data.Unfoldable"]=PS["Data.Unfoldable"]||{});(function(exports){"use strict";exports.unsafeCoerce=function(x){return x}})(PS["Unsafe.Coerce"]=PS["Unsafe.Coerce"]||{});(function(exports){"use strict";var $foreign=PS["Unsafe.Coerce"];exports["unsafeCoerce"]=$foreign.unsafeCoerce})(PS["Unsafe.Coerce"]=PS["Unsafe.Coerce"]||{});(function(exports){"use strict";var $foreign=PS["Data.Array"];var Control_Alt=PS["Control.Alt"];var Control_Alternative=PS["Control.Alternative"];var Control_Applicative=PS["Control.Applicative"];var Control_Apply=PS["Control.Apply"];var Control_Bind=PS["Control.Bind"];var Control_Category=PS["Control.Category"];var Control_Lazy=PS["Control.Lazy"];var Control_Monad_Rec_Class=PS["Control.Monad.Rec.Class"];var Control_Monad_ST=PS["Control.Monad.ST"];var Control_Monad_ST_Internal=PS["Control.Monad.ST.Internal"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Array_NonEmpty_Internal=PS["Data.Array.NonEmpty.Internal"];var Data_Array_ST=PS["Data.Array.ST"];var Data_Array_ST_Iterator=PS["Data.Array.ST.Iterator"];var Data_Boolean=PS["Data.Boolean"];var Data_Eq=PS["Data.Eq"];var Data_Foldable=PS["Data.Foldable"];var Data_Function=PS["Data.Function"];var Data_Functor=PS["Data.Functor"];var Data_HeytingAlgebra=PS["Data.HeytingAlgebra"];var Data_Maybe=PS["Data.Maybe"];var Data_Ord=PS["Data.Ord"];var Data_Ordering=PS["Data.Ordering"];var Data_Ring=PS["Data.Ring"];var Data_Semigroup=PS["Data.Semigroup"];var Data_Semiring=PS["Data.Semiring"];var Data_Traversable=PS["Data.Traversable"];var Data_Tuple=PS["Data.Tuple"];var Data_Unfoldable=PS["Data.Unfoldable"];var Partial_Unsafe=PS["Partial.Unsafe"];var Prelude=PS["Prelude"];var Unsafe_Coerce=PS["Unsafe.Coerce"];var sortBy=function(comp){return function(xs){var comp$prime=function(x){return function(y){var v=comp(x)(y);if(v instanceof Data_Ordering.GT){return 1}if(v instanceof Data_Ordering.EQ){return 0}if(v instanceof Data_Ordering.LT){return-1|0}throw new Error("Failed pattern match at Data.Array (line 702, column 15 - line 707, column 1): "+[v.constructor.name])}};return $foreign.sortImpl(comp$prime)(xs)}};var sortWith=function(dictOrd){return function(f){return sortBy(Data_Ord.comparing(dictOrd)(f))}};var singleton=function(a){return[a]};var index=$foreign.indexImpl(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);var concatMap=Data_Function.flip(Control_Bind.bind(Control_Bind.bindArray));var mapMaybe=function(f){return concatMap(function($114){return Data_Maybe.maybe([])(singleton)(f($114))})};exports["singleton"]=singleton;exports["index"]=index;exports["concatMap"]=concatMap;exports["mapMaybe"]=mapMaybe;exports["sortBy"]=sortBy;exports["sortWith"]=sortWith;exports["length"]=$foreign.length})(PS["Data.Array"]=PS["Data.Array"]||{});(function(exports){"use strict";exports.toCharCode=function(c){return c.charCodeAt(0)};exports.fromCharCode=function(c){return String.fromCharCode(c)}})(PS["Data.Enum"]=PS["Data.Enum"]||{});(function(exports){"use strict";var $foreign=PS["Data.Enum"];var Control_Apply=PS["Control.Apply"];var Control_Bind=PS["Control.Bind"];var Control_MonadPlus=PS["Control.MonadPlus"];var Control_MonadZero=PS["Control.MonadZero"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Boolean=PS["Data.Boolean"];var Data_Bounded=PS["Data.Bounded"];var Data_Either=PS["Data.Either"];var Data_Eq=PS["Data.Eq"];var Data_Function=PS["Data.Function"];var Data_Functor=PS["Data.Functor"];var Data_HeytingAlgebra=PS["Data.HeytingAlgebra"];var Data_Maybe=PS["Data.Maybe"];var Data_Newtype=PS["Data.Newtype"];var Data_Ord=PS["Data.Ord"];var Data_Ordering=PS["Data.Ordering"];var Data_Ring=PS["Data.Ring"];var Data_Semigroup=PS["Data.Semigroup"];var Data_Semiring=PS["Data.Semiring"];var Data_Show=PS["Data.Show"];var Data_Tuple=PS["Data.Tuple"];var Data_Unfoldable=PS["Data.Unfoldable"];var Data_Unfoldable1=PS["Data.Unfoldable1"];var Data_Unit=PS["Data.Unit"];var Partial_Unsafe=PS["Partial.Unsafe"];var Prelude=PS["Prelude"];var Enum=function(Ord0,pred,succ){this.Ord0=Ord0;this.pred=pred;this.succ=succ};var BoundedEnum=function(Bounded0,Enum1,cardinality,fromEnum,toEnum){this.Bounded0=Bounded0;this.Enum1=Enum1;this.cardinality=cardinality;this.fromEnum=fromEnum;this.toEnum=toEnum};var toEnum=function(dict){return dict.toEnum};var succ=function(dict){return dict.succ};var pred=function(dict){return dict.pred};var fromEnum=function(dict){return dict.fromEnum};var defaultSucc=function(toEnum$prime){return function(fromEnum$prime){return function(a){return toEnum$prime(fromEnum$prime(a)+1|0)}}};var defaultPred=function(toEnum$prime){return function(fromEnum$prime){return function(a){return toEnum$prime(fromEnum$prime(a)-1|0)}}};var charToEnum=function(v){if(v>=Data_Bounded.bottom(Data_Bounded.boundedInt)&&v<=Data_Bounded.top(Data_Bounded.boundedInt)){return new Data_Maybe.Just($foreign.fromCharCode(v))}return Data_Maybe.Nothing.value};var enumChar=new Enum(function(){return Data_Ord.ordChar},defaultPred(charToEnum)($foreign.toCharCode),defaultSucc(charToEnum)($foreign.toCharCode));var cardinality=function(dict){return dict.cardinality};var boundedEnumChar=new BoundedEnum(function(){return Data_Bounded.boundedChar},function(){return enumChar},$foreign.toCharCode(Data_Bounded.top(Data_Bounded.boundedChar))-$foreign.toCharCode(Data_Bounded.bottom(Data_Bounded.boundedChar))|0,$foreign.toCharCode,charToEnum);exports["Enum"]=Enum;exports["succ"]=succ;exports["pred"]=pred;exports["BoundedEnum"]=BoundedEnum;exports["cardinality"]=cardinality;exports["toEnum"]=toEnum;exports["fromEnum"]=fromEnum;exports["defaultSucc"]=defaultSucc;exports["defaultPred"]=defaultPred;exports["enumChar"]=enumChar;exports["boundedEnumChar"]=boundedEnumChar})(PS["Data.Enum"]=PS["Data.Enum"]||{});(function(exports){"use strict";var Data_Enum=PS["Data.Enum"];var Data_Maybe=PS["Data.Maybe"];var toCharCode=Data_Enum.fromEnum(Data_Enum.boundedEnumChar);var fromCharCode=Data_Enum.toEnum(Data_Enum.boundedEnumChar);exports["toCharCode"]=toCharCode;exports["fromCharCode"]=fromCharCode})(PS["Data.Char"]=PS["Data.Char"]||{});(function(exports){"use strict";var Data_Boolean=PS["Data.Boolean"];var Data_Char=PS["Data.Char"];var Data_Eq=PS["Data.Eq"];var Data_Function=PS["Data.Function"];var Data_Generic_Rep=PS["Data.Generic.Rep"];var Data_HeytingAlgebra=PS["Data.HeytingAlgebra"];var Data_Maybe=PS["Data.Maybe"];var Data_Ord=PS["Data.Ord"];var Data_Ring=PS["Data.Ring"];var Data_Semigroup=PS["Data.Semigroup"];var Data_Semiring=PS["Data.Semiring"];var Data_Show=PS["Data.Show"];var Partial_Unsafe=PS["Partial.Unsafe"];var Prelude=PS["Prelude"];var Digit=function(x){return x};var toInt=function(v){return v};var toChar=function(v){return Data_Maybe.fromJust()(Data_Char.fromCharCode(v+48|0))};var fromInt=function(c){if(0<=c&&c<=9){return new Data_Maybe.Just(c)}if(Data_Boolean.otherwise){return Data_Maybe.Nothing.value}throw new Error("Failed pattern match at Data.Digit (line 27, column 1 - line 27, column 30): "+[c.constructor.name])};var fromChar=function(c){var code=Data_Char.toCharCode(c);var $16=code>=48&&code<=57;if($16){return new Data_Maybe.Just(Digit(code-48|0))}return Data_Maybe.Nothing.value};var eqDigit=new Data_Eq.Eq(function(v){return function(v1){return v===v1}});var ordDigit=new Data_Ord.Ord(function(){return eqDigit},function(v){return function(v1){return Data_Ord.compare(Data_Ord.ordInt)(v)(v1)}});var _zero=0;var _one=1;exports["fromInt"]=fromInt;exports["toInt"]=toInt;exports["fromChar"]=fromChar;exports["toChar"]=toChar;exports["_zero"]=_zero;exports["_one"]=_one;exports["eqDigit"]=eqDigit;exports["ordDigit"]=ordDigit})(PS["Data.Digit"]=PS["Data.Digit"]||{});(function(exports){"use strict";exports.fromNumberImpl=function(just){return function(nothing){return function(n){return(n|0)===n?just(n):nothing}}};exports.toNumber=function(n){return n};exports.fromStringAsImpl=function(just){return function(nothing){return function(radix){var digits;if(radix<11){digits="[0-"+(radix-1).toString()+"]"}else if(radix===11){digits="[0-9a]"}else{digits="[0-9a-"+String.fromCharCode(86+radix)+"]"}var pattern=new RegExp("^[\\+\\-]?"+digits+"+$","i");return function(s){if(pattern.test(s)){var i=parseInt(s,radix);return(i|0)===i?just(i):nothing}else{return nothing}}}}}})(PS["Data.Int"]=PS["Data.Int"]||{});(function(exports){"use strict";exports.infinity=Infinity;exports.readFloat=parseFloat})(PS["Global"]=PS["Global"]||{});(function(exports){"use strict";var $foreign=PS["Global"];exports["infinity"]=$foreign.infinity;exports["readFloat"]=$foreign.readFloat})(PS["Global"]=PS["Global"]||{});(function(exports){"use strict";exports.round=Math.round})(PS["Math"]=PS["Math"]||{});(function(exports){"use strict";var $foreign=PS["Math"];exports["round"]=$foreign.round})(PS["Math"]=PS["Math"]||{});(function(exports){"use strict";var $foreign=PS["Data.Int"];var Control_Category=PS["Control.Category"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Boolean=PS["Data.Boolean"];var Data_Bounded=PS["Data.Bounded"];var Data_CommutativeRing=PS["Data.CommutativeRing"];var Data_DivisionRing=PS["Data.DivisionRing"];var Data_Eq=PS["Data.Eq"];var Data_EuclideanRing=PS["Data.EuclideanRing"];var Data_HeytingAlgebra=PS["Data.HeytingAlgebra"];var Data_Int_Bits=PS["Data.Int.Bits"];var Data_Maybe=PS["Data.Maybe"];var Data_Ord=PS["Data.Ord"];var Data_Ordering=PS["Data.Ordering"];var Data_Ring=PS["Data.Ring"];var Data_Semiring=PS["Data.Semiring"];var Data_Show=PS["Data.Show"];var Global=PS["Global"];var $$Math=PS["Math"];var Prelude=PS["Prelude"];var fromStringAs=$foreign.fromStringAsImpl(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);var fromString=fromStringAs(10);var fromNumber=$foreign.fromNumberImpl(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);var unsafeClamp=function(x){if(x===Global.infinity){return 0}if(x===-Global.infinity){return 0}if(x>=$foreign.toNumber(Data_Bounded.top(Data_Bounded.boundedInt))){return Data_Bounded.top(Data_Bounded.boundedInt)}if(x<=$foreign.toNumber(Data_Bounded.bottom(Data_Bounded.boundedInt))){return Data_Bounded.bottom(Data_Bounded.boundedInt)}if(Data_Boolean.otherwise){return Data_Maybe.fromMaybe(0)(fromNumber(x))}throw new Error("Failed pattern match at Data.Int (line 66, column 1 - line 66, column 29): "+[x.constructor.name])};var round=function($23){return unsafeClamp($$Math.round($23))};exports["fromNumber"]=fromNumber;exports["round"]=round;exports["fromString"]=fromString;exports["fromStringAs"]=fromStringAs;exports["toNumber"]=$foreign.toNumber})(PS["Data.Int"]=PS["Data.Int"]||{});(function(exports){"use strict";var Control_Alt=PS["Control.Alt"];var Control_Alternative=PS["Control.Alternative"];var Control_Applicative=PS["Control.Applicative"];var Control_Apply=PS["Control.Apply"];var Control_Bind=PS["Control.Bind"];var Control_Category=PS["Control.Category"];var Control_Comonad=PS["Control.Comonad"];var Control_Extend=PS["Control.Extend"];var Control_Monad=PS["Control.Monad"];var Control_MonadPlus=PS["Control.MonadPlus"];var Control_MonadZero=PS["Control.MonadZero"];var Control_Plus=PS["Control.Plus"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Eq=PS["Data.Eq"];var Data_Foldable=PS["Data.Foldable"];var Data_FoldableWithIndex=PS["Data.FoldableWithIndex"];var Data_Function=PS["Data.Function"];var Data_Functor=PS["Data.Functor"];var Data_FunctorWithIndex=PS["Data.FunctorWithIndex"];var Data_HeytingAlgebra=PS["Data.HeytingAlgebra"];var Data_Maybe=PS["Data.Maybe"];var Data_Monoid=PS["Data.Monoid"];var Data_Newtype=PS["Data.Newtype"];var Data_NonEmpty=PS["Data.NonEmpty"];var Data_Ord=PS["Data.Ord"];var Data_Ordering=PS["Data.Ordering"];var Data_Ring=PS["Data.Ring"];var Data_Semigroup=PS["Data.Semigroup"];var Data_Semigroup_Foldable=PS["Data.Semigroup.Foldable"];var Data_Semigroup_Traversable=PS["Data.Semigroup.Traversable"];var Data_Semiring=PS["Data.Semiring"];var Data_Show=PS["Data.Show"];var Data_Traversable=PS["Data.Traversable"];var Data_TraversableWithIndex=PS["Data.TraversableWithIndex"];var Data_Tuple=PS["Data.Tuple"];var Data_Unfoldable=PS["Data.Unfoldable"];var Data_Unfoldable1=PS["Data.Unfoldable1"];var Prelude=PS["Prelude"];var Nil=function(){function Nil(){}Nil.value=new Nil;return Nil}();var Cons=function(){function Cons(value0,value1){this.value0=value0;this.value1=value1}Cons.create=function(value0){return function(value1){return new Cons(value0,value1)}};return Cons}();var foldableList=new Data_Foldable.Foldable(function(dictMonoid){return function(f){return Data_Foldable.foldl(foldableList)(function(acc){return function($174){return Data_Semigroup.append(dictMonoid.Semigroup0())(acc)(f($174))}})(Data_Monoid.mempty(dictMonoid))}},function(f){var go=function($copy_b){return function($copy_v){var $tco_var_b=$copy_b;var $tco_done=false;var $tco_result;function $tco_loop(b,v){if(v instanceof Nil){$tco_done=true;return b}if(v instanceof Cons){$tco_var_b=f(b)(v.value0);$copy_v=v.value1;return}throw new Error("Failed pattern match at Data.List.Types (line 81, column 12 - line 83, column 30): "+[v.constructor.name])}while(!$tco_done){$tco_result=$tco_loop($tco_var_b,$copy_v)}return $tco_result}};return go},function(f){return function(b){var rev=Data_Foldable.foldl(foldableList)(Data_Function.flip(Cons.create))(Nil.value);return function($175){return Data_Foldable.foldl(foldableList)(Data_Function.flip(f))(b)(rev($175))}}});var functorList=new Data_Functor.Functor(function(f){return Data_Foldable.foldr(foldableList)(function(x){return function(acc){return new Cons(f(x),acc)}})(Nil.value)});var semigroupList=new Data_Semigroup.Semigroup(function(xs){return function(ys){return Data_Foldable.foldr(foldableList)(Cons.create)(ys)(xs)}});var monoidList=new Data_Monoid.Monoid(function(){return semigroupList},Nil.value);var unfoldable1List=new Data_Unfoldable1.Unfoldable1(function(f){return function(b){var go=function($copy_source){return function($copy_memo){var $tco_var_source=$copy_source;var $tco_done=false;var $tco_result;function $tco_loop(source,memo){var v=f(source);if(v.value1 instanceof Data_Maybe.Just){$tco_var_source=v.value1.value0;$copy_memo=new Cons(v.value0,memo);return}if(v.value1 instanceof Data_Maybe.Nothing){$tco_done=true;return Data_Foldable.foldl(foldableList)(Data_Function.flip(Cons.create))(Nil.value)(new Cons(v.value0,memo))}throw new Error("Failed pattern match at Data.List.Types (line 105, column 22 - line 107, column 61): "+[v.constructor.name])}while(!$tco_done){$tco_result=$tco_loop($tco_var_source,$copy_memo)}return $tco_result}};return go(b)(Nil.value)}});var unfoldableList=new Data_Unfoldable.Unfoldable(function(){return unfoldable1List},function(f){return function(b){var go=function($copy_source){return function($copy_memo){var $tco_var_source=$copy_source;var $tco_done=false;var $tco_result;function $tco_loop(source,memo){var v=f(source);if(v instanceof Data_Maybe.Nothing){$tco_done=true;return Data_Foldable.foldl(foldableList)(Data_Function.flip(Cons.create))(Nil.value)(memo)}if(v instanceof Data_Maybe.Just){$tco_var_source=v.value0.value1;$copy_memo=new Cons(v.value0.value0,memo);return}throw new Error("Failed pattern match at Data.List.Types (line 112, column 22 - line 114, column 52): "+[v.constructor.name])}while(!$tco_done){$tco_result=$tco_loop($tco_var_source,$copy_memo)}return $tco_result}};return go(b)(Nil.value)}});var eq1List=new Data_Eq.Eq1(function(dictEq){return function(xs){return function(ys){var go=function($copy_v){return function($copy_v1){return function($copy_v2){var $tco_var_v=$copy_v;var $tco_var_v1=$copy_v1;var $tco_done=false;var $tco_result;function $tco_loop(v,v1,v2){if(!v2){$tco_done=true;return false}if(v instanceof Nil&&v1 instanceof Nil){$tco_done=true;return v2}if(v instanceof Cons&&v1 instanceof Cons){$tco_var_v=v.value1;$tco_var_v1=v1.value1;$copy_v2=v2&&Data_Eq.eq(dictEq)(v1.value0)(v.value0);return}$tco_done=true;return false}while(!$tco_done){$tco_result=$tco_loop($tco_var_v,$tco_var_v1,$copy_v2)}return $tco_result}}};return go(xs)(ys)(true)}}});var eqList=function(dictEq){return new Data_Eq.Eq(Data_Eq.eq1(eq1List)(dictEq))};var ord1List=new Data_Ord.Ord1(function(){return eq1List},function(dictOrd){return function(xs){return function(ys){var go=function($copy_v){return function($copy_v1){var $tco_var_v=$copy_v;var $tco_done=false;var $tco_result;function $tco_loop(v,v1){if(v instanceof Nil&&v1 instanceof Nil){$tco_done=true;return Data_Ordering.EQ.value}if(v instanceof Nil){$tco_done=true;return Data_Ordering.LT.value}if(v1 instanceof Nil){$tco_done=true;return Data_Ordering.GT.value}if(v instanceof Cons&&v1 instanceof Cons){var v2=Data_Ord.compare(dictOrd)(v.value0)(v1.value0);if(v2 instanceof Data_Ordering.EQ){$tco_var_v=v.value1;$copy_v1=v1.value1;return}$tco_done=true;return v2}throw new Error("Failed pattern match at Data.List.Types (line 55, column 5 - line 55, column 20): "+[v.constructor.name,v1.constructor.name])}while(!$tco_done){$tco_result=$tco_loop($tco_var_v,$copy_v1)}return $tco_result}};return go(xs)(ys)}}});var ordList=function(dictOrd){return new Data_Ord.Ord(function(){return eqList(dictOrd.Eq0())},Data_Ord.compare1(ord1List)(dictOrd))};var applyList=new Control_Apply.Apply(function(){return functorList},function(v){return function(v1){if(v instanceof Nil){return Nil.value}if(v instanceof Cons){return Data_Semigroup.append(semigroupList)(Data_Functor.map(functorList)(v.value0)(v1))(Control_Apply.apply(applyList)(v.value1)(v1))}throw new Error("Failed pattern match at Data.List.Types (line 127, column 1 - line 127, column 33): "+[v.constructor.name,v1.constructor.name])}});var applicativeList=new Control_Applicative.Applicative(function(){return applyList},function(a){return new Cons(a,Nil.value)});exports["Nil"]=Nil;exports["Cons"]=Cons;exports["eqList"]=eqList;exports["eq1List"]=eq1List;exports["ordList"]=ordList;exports["ord1List"]=ord1List;exports["semigroupList"]=semigroupList;exports["monoidList"]=monoidList;exports["functorList"]=functorList;exports["foldableList"]=foldableList;exports["unfoldable1List"]=unfoldable1List;exports["unfoldableList"]=unfoldableList;exports["applyList"]=applyList;exports["applicativeList"]=applicativeList})(PS["Data.List.Types"]=PS["Data.List.Types"]||{});(function(exports){"use strict";var Control_Alt=PS["Control.Alt"];var Control_Alternative=PS["Control.Alternative"];var Control_Applicative=PS["Control.Applicative"];var Control_Apply=PS["Control.Apply"];var Control_Bind=PS["Control.Bind"];var Control_Category=PS["Control.Category"];var Control_Lazy=PS["Control.Lazy"];var Control_Monad_Rec_Class=PS["Control.Monad.Rec.Class"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Bifunctor=PS["Data.Bifunctor"];var Data_Boolean=PS["Data.Boolean"];var Data_Eq=PS["Data.Eq"];var Data_Foldable=PS["Data.Foldable"];var Data_Function=PS["Data.Function"];var Data_Functor=PS["Data.Functor"];var Data_FunctorWithIndex=PS["Data.FunctorWithIndex"];var Data_HeytingAlgebra=PS["Data.HeytingAlgebra"];var Data_List_Types=PS["Data.List.Types"];var Data_Maybe=PS["Data.Maybe"];var Data_Newtype=PS["Data.Newtype"];var Data_NonEmpty=PS["Data.NonEmpty"];var Data_Ord=PS["Data.Ord"];var Data_Ordering=PS["Data.Ordering"];var Data_Ring=PS["Data.Ring"];var Data_Semigroup=PS["Data.Semigroup"];var Data_Semiring=PS["Data.Semiring"];var Data_Show=PS["Data.Show"];var Data_Traversable=PS["Data.Traversable"];var Data_Tuple=PS["Data.Tuple"];var Data_Unfoldable=PS["Data.Unfoldable"];var Data_Unit=PS["Data.Unit"];var Prelude=PS["Prelude"];var uncons=function(v){if(v instanceof Data_List_Types.Nil){return Data_Maybe.Nothing.value}if(v instanceof Data_List_Types.Cons){return new Data_Maybe.Just({head:v.value0,tail:v.value1})}throw new Error("Failed pattern match at Data.List (line 259, column 1 - line 259, column 66): "+[v.constructor.name])};var span=function(v){return function(v1){if(v1 instanceof Data_List_Types.Cons&&v(v1.value0)){var v2=span(v)(v1.value1);return{init:new Data_List_Types.Cons(v1.value0,v2.init),rest:v2.rest}}return{init:Data_List_Types.Nil.value,rest:v1}}};var reverse=function(){var go=function($copy_acc){return function($copy_v){var $tco_var_acc=$copy_acc;var $tco_done=false;var $tco_result;function $tco_loop(acc,v){if(v instanceof Data_List_Types.Nil){$tco_done=true;return acc}if(v instanceof Data_List_Types.Cons){$tco_var_acc=new Data_List_Types.Cons(v.value0,acc);$copy_v=v.value1;return}throw new Error("Failed pattern match at Data.List (line 368, column 3 - line 368, column 19): "+[acc.constructor.name,v.constructor.name])}while(!$tco_done){$tco_result=$tco_loop($tco_var_acc,$copy_v)}return $tco_result}};return go(Data_List_Types.Nil.value)}();var take=function(){var go=function($copy_acc){return function($copy_v){return function($copy_v1){var $tco_var_acc=$copy_acc;var $tco_var_v=$copy_v;var $tco_done=false;var $tco_result;function $tco_loop(acc,v,v1){if(v<1){$tco_done=true;return reverse(acc)}if(v1 instanceof Data_List_Types.Nil){$tco_done=true;return reverse(acc)}if(v1 instanceof Data_List_Types.Cons){$tco_var_acc=new Data_List_Types.Cons(v1.value0,acc);$tco_var_v=v-1|0;$copy_v1=v1.value1;return}throw new Error("Failed pattern match at Data.List (line 520, column 3 - line 520, column 35): "+[acc.constructor.name,v.constructor.name,v1.constructor.name])}while(!$tco_done){$tco_result=$tco_loop($tco_var_acc,$tco_var_v,$copy_v1)}return $tco_result}}};return go(Data_List_Types.Nil.value)}();var takeWhile=function(p){var go=function($copy_acc){return function($copy_v){var $tco_var_acc=$copy_acc;var $tco_done=false;var $tco_result;function $tco_loop(acc,v){if(v instanceof Data_List_Types.Cons&&p(v.value0)){$tco_var_acc=new Data_List_Types.Cons(v.value0,acc);$copy_v=v.value1;return}$tco_done=true;return reverse(acc)}while(!$tco_done){$tco_result=$tco_loop($tco_var_acc,$copy_v)}return $tco_result}};return go(Data_List_Types.Nil.value)};var unsnoc=function(lst){var go=function($copy_v){return function($copy_acc){var $tco_var_v=$copy_v;var $tco_done=false;var $tco_result;function $tco_loop(v,acc){if(v instanceof Data_List_Types.Nil){$tco_done=true;return Data_Maybe.Nothing.value}if(v instanceof Data_List_Types.Cons&&v.value1 instanceof Data_List_Types.Nil){$tco_done=true;return new Data_Maybe.Just({revInit:acc,last:v.value0})}if(v instanceof Data_List_Types.Cons){$tco_var_v=v.value1;$copy_acc=new Data_List_Types.Cons(v.value0,acc);return}throw new Error("Failed pattern match at Data.List (line 270, column 3 - line 270, column 23): "+[v.constructor.name,acc.constructor.name])}while(!$tco_done){$tco_result=$tco_loop($tco_var_v,$copy_acc)}return $tco_result}};return Data_Functor.map(Data_Maybe.functorMaybe)(function(h){return{init:reverse(h.revInit),last:h.last}})(go(lst)(Data_List_Types.Nil.value))};var zipWith=function(f){return function(xs){return function(ys){var go=function($copy_v){return function($copy_v1){return function($copy_acc){var $tco_var_v=$copy_v;var $tco_var_v1=$copy_v1;var $tco_done=false;var $tco_result;function $tco_loop(v,v1,acc){if(v instanceof Data_List_Types.Nil){$tco_done=true;return acc}if(v1 instanceof Data_List_Types.Nil){$tco_done=true;return acc}if(v instanceof Data_List_Types.Cons&&v1 instanceof Data_List_Types.Cons){$tco_var_v=v.value1;$tco_var_v1=v1.value1;$copy_acc=new Data_List_Types.Cons(f(v.value0)(v1.value0),acc);return}throw new Error("Failed pattern match at Data.List (line 718, column 3 - line 718, column 21): "+[v.constructor.name,v1.constructor.name,acc.constructor.name])}while(!$tco_done){$tco_result=$tco_loop($tco_var_v,$tco_var_v1,$copy_acc)}return $tco_result}}};return reverse(go(xs)(ys)(Data_List_Types.Nil.value))}}};var zip=zipWith(Data_Tuple.Tuple.create);var $$null=function(v){if(v instanceof Data_List_Types.Nil){return true}return false};var mapMaybe=function(f){var go=function($copy_acc){return function($copy_v){var $tco_var_acc=$copy_acc;var $tco_done=false;var $tco_result;function $tco_loop(acc,v){if(v instanceof Data_List_Types.Nil){$tco_done=true;return reverse(acc)}if(v instanceof Data_List_Types.Cons){var v1=f(v.value0);if(v1 instanceof Data_Maybe.Nothing){$tco_var_acc=acc;$copy_v=v.value1;return}if(v1 instanceof Data_Maybe.Just){$tco_var_acc=new Data_List_Types.Cons(v1.value0,acc);$copy_v=v.value1;return}throw new Error("Failed pattern match at Data.List (line 419, column 5 - line 421, column 32): "+[v1.constructor.name])}throw new Error("Failed pattern match at Data.List (line 417, column 3 - line 417, column 27): "+[acc.constructor.name,v.constructor.name])}while(!$tco_done){$tco_result=$tco_loop($tco_var_acc,$copy_v)}return $tco_result}};return go(Data_List_Types.Nil.value)};var length=Data_Foldable.foldl(Data_List_Types.foldableList)(function(acc){return function(v){return acc+1|0}})(0);var last=function($copy_v){var $tco_done=false;var $tco_result;function $tco_loop(v){if(v instanceof Data_List_Types.Cons&&v.value1 instanceof Data_List_Types.Nil){$tco_done=true;return new Data_Maybe.Just(v.value0)}if(v instanceof Data_List_Types.Cons){$copy_v=v.value1;return}$tco_done=true;return Data_Maybe.Nothing.value}while(!$tco_done){$tco_result=$tco_loop($copy_v)}return $tco_result};var insertAt=function(v){return function(v1){return function(v2){if(v===0){return new Data_Maybe.Just(new Data_List_Types.Cons(v1,v2))}if(v2 instanceof Data_List_Types.Cons){return Data_Functor.map(Data_Maybe.functorMaybe)(function(v3){return new Data_List_Types.Cons(v2.value0,v3)})(insertAt(v-1|0)(v1)(v2.value1))}return Data_Maybe.Nothing.value}}};var init=function(lst){return Data_Functor.map(Data_Maybe.functorMaybe)(function(v){return v.init})(unsnoc(lst))};var fromFoldable=function(dictFoldable){return Data_Foldable.foldr(dictFoldable)(Data_List_Types.Cons.create)(Data_List_Types.Nil.value)};var filter=function(p){var go=function($copy_acc){return function($copy_v){var $tco_var_acc=$copy_acc;var $tco_done=false;var $tco_result;function $tco_loop(acc,v){if(v instanceof Data_List_Types.Nil){$tco_done=true;return reverse(acc)}if(v instanceof Data_List_Types.Cons){if(p(v.value0)){$tco_var_acc=new Data_List_Types.Cons(v.value0,acc);$copy_v=v.value1;return}if(Data_Boolean.otherwise){$tco_var_acc=acc;$copy_v=v.value1;return}}throw new Error("Failed pattern match at Data.List (line 390, column 3 - line 390, column 27): "+[acc.constructor.name,v.constructor.name])}while(!$tco_done){$tco_result=$tco_loop($tco_var_acc,$copy_v)}return $tco_result}};return go(Data_List_Types.Nil.value)};var dropWhile=function(p){var go=function($copy_v){var $tco_done=false;var $tco_result;function $tco_loop(v){if(v instanceof Data_List_Types.Cons&&p(v.value0)){$copy_v=v.value1;return}$tco_done=true;return v}while(!$tco_done){$tco_result=$tco_loop($copy_v)}return $tco_result};return go};var drop=function($copy_v){return function($copy_v1){var $tco_var_v=$copy_v;var $tco_done=false;var $tco_result;function $tco_loop(v,v1){if(v<1){$tco_done=true;return v1}if(v1 instanceof Data_List_Types.Nil){$tco_done=true;return Data_List_Types.Nil.value}if(v1 instanceof Data_List_Types.Cons){$tco_var_v=v-1|0;$copy_v1=v1.value1;return}throw new Error("Failed pattern match at Data.List (line 543, column 1 - line 543, column 42): "+[v.constructor.name,v1.constructor.name])}while(!$tco_done){$tco_result=$tco_loop($tco_var_v,$copy_v1)}return $tco_result}};exports["fromFoldable"]=fromFoldable;exports["null"]=$$null;exports["length"]=length;exports["last"]=last;exports["init"]=init;exports["uncons"]=uncons;exports["unsnoc"]=unsnoc;exports["insertAt"]=insertAt;exports["reverse"]=reverse;exports["filter"]=filter;exports["mapMaybe"]=mapMaybe;exports["take"]=take;exports["takeWhile"]=takeWhile;exports["drop"]=drop;exports["dropWhile"]=dropWhile;exports["span"]=span;exports["zipWith"]=zipWith;exports["zip"]=zip})(PS["Data.List"]=PS["Data.List"]||{});(function(exports){"use strict";exports.toCharArray=function(s){return s.split("")};exports.singleton=function(c){return c};exports.length=function(s){return s.length};exports.countPrefix=function(p){return function(s){var i=0;while(i<s.length&&p(s.charAt(i)))i++;return i}};exports._indexOf=function(just){return function(nothing){return function(x){return function(s){var i=s.indexOf(x);return i===-1?nothing:just(i)}}}};exports.take=function(n){return function(s){return s.substr(0,n)}};exports.drop=function(n){return function(s){return s.substring(n)}};exports._slice=function(b){return function(e){return function(s){return s.slice(b,e)}}}})(PS["Data.String.CodeUnits"]=PS["Data.String.CodeUnits"]||{});(function(exports){"use strict";var $foreign=PS["Data.String.CodeUnits"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Boolean=PS["Data.Boolean"];var Data_Eq=PS["Data.Eq"];var Data_Function=PS["Data.Function"];var Data_HeytingAlgebra=PS["Data.HeytingAlgebra"];var Data_Maybe=PS["Data.Maybe"];var Data_Ord=PS["Data.Ord"];var Data_Ring=PS["Data.Ring"];var Data_Semiring=PS["Data.Semiring"];var Data_String_Pattern=PS["Data.String.Pattern"];var Data_String_Unsafe=PS["Data.String.Unsafe"];var Prelude=PS["Prelude"];var takeWhile=function(p){return function(s){return $foreign.take($foreign.countPrefix(p)(s))(s)}};var slice=function(b){return function(e){return function(s){var l=$foreign.length(s);var norm=function(x){if(x<0){return l+x|0}if(Data_Boolean.otherwise){return x}throw new Error("Failed pattern match at Data.String.CodeUnits (line 314, column 5 - line 315, column 27): "+[x.constructor.name])};var e$prime=norm(e);var b$prime=norm(b);var $7=b$prime<0||(b$prime>=l||(e$prime<0||(e$prime>l||b$prime>e$prime)));if($7){return Data_Maybe.Nothing.value}return new Data_Maybe.Just($foreign["_slice"](b)(e)(s))}}};var indexOf=$foreign["_indexOf"](Data_Maybe.Just.create)(Data_Maybe.Nothing.value);var stripPrefix=function(v){return function(str){var v1=indexOf(v)(str);if(v1 instanceof Data_Maybe.Just&&v1.value0===0){return Data_Maybe.Just.create($foreign.drop($foreign.length(v))(str))}return Data_Maybe.Nothing.value}};var contains=function(pat){return function($16){return Data_Maybe.isJust(indexOf(pat)($16))}};exports["stripPrefix"]=stripPrefix;exports["contains"]=contains;exports["indexOf"]=indexOf;exports["takeWhile"]=takeWhile;exports["slice"]=slice;exports["singleton"]=$foreign.singleton;exports["toCharArray"]=$foreign.toCharArray;exports["drop"]=$foreign.drop})(PS["Data.String.CodeUnits"]=PS["Data.String.CodeUnits"]||{});(function(exports){"use strict";exports.error=function(msg){return new Error(msg)};exports.throwException=function(e){return function(){throw e}}})(PS["Effect.Exception"]=PS["Effect.Exception"]||{});(function(exports){"use strict";var $foreign=PS["Effect.Exception"];var Control_Applicative=PS["Control.Applicative"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Either=PS["Data.Either"];var Data_Functor=PS["Data.Functor"];var Data_Maybe=PS["Data.Maybe"];var Data_Show=PS["Data.Show"];var Effect=PS["Effect"];var Prelude=PS["Prelude"];exports["error"]=$foreign.error;exports["throwException"]=$foreign.throwException})(PS["Effect.Exception"]=PS["Effect.Exception"]||{});(function(exports){"use strict";exports.unsafePerformEffect=function(f){return f()}})(PS["Effect.Unsafe"]=PS["Effect.Unsafe"]||{});(function(exports){"use strict";var $foreign=PS["Effect.Unsafe"];var Effect=PS["Effect"];exports["unsafePerformEffect"]=$foreign.unsafePerformEffect})(PS["Effect.Unsafe"]=PS["Effect.Unsafe"]||{});(function(exports){"use strict";var Control_Semigroupoid=PS["Control.Semigroupoid"];var Effect_Exception=PS["Effect.Exception"];var Effect_Unsafe=PS["Effect.Unsafe"];var unsafeThrowException=function($0){return Effect_Unsafe.unsafePerformEffect(Effect_Exception.throwException($0))};var unsafeThrow=function($1){return unsafeThrowException(Effect_Exception.error($1))};exports["unsafeThrowException"]=unsafeThrowException;exports["unsafeThrow"]=unsafeThrow})(PS["Effect.Exception.Unsafe"]=PS["Effect.Exception.Unsafe"]||{});(function(exports){"use strict";var Control_Applicative=PS["Control.Applicative"];var Control_Bind=PS["Control.Bind"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Boolean=PS["Data.Boolean"];var Data_Digit=PS["Data.Digit"];var Data_Eq=PS["Data.Eq"];var Data_EuclideanRing=PS["Data.EuclideanRing"];var Data_Foldable=PS["Data.Foldable"];var Data_Function=PS["Data.Function"];var Data_Functor=PS["Data.Functor"];var Data_Generic_Rep=PS["Data.Generic.Rep"];var Data_HeytingAlgebra=PS["Data.HeytingAlgebra"];var Data_Int=PS["Data.Int"];var Data_List=PS["Data.List"];var Data_List_Types=PS["Data.List.Types"];var Data_Maybe=PS["Data.Maybe"];var Data_Monoid=PS["Data.Monoid"];var Data_Ord=PS["Data.Ord"];var Data_Ordering=PS["Data.Ordering"];var Data_Ring=PS["Data.Ring"];var Data_Semigroup=PS["Data.Semigroup"];var Data_Semiring=PS["Data.Semiring"];var Data_Show=PS["Data.Show"];var Data_String=PS["Data.String"];var Data_String_CodeUnits=PS["Data.String.CodeUnits"];var Data_String_Pattern=PS["Data.String.Pattern"];var Data_Traversable=PS["Data.Traversable"];var Data_Tuple=PS["Data.Tuple"];var Data_Unfoldable=PS["Data.Unfoldable"];var Effect_Exception_Unsafe=PS["Effect.Exception.Unsafe"];var Global=PS["Global"];var Partial_Unsafe=PS["Partial.Unsafe"];var Prelude=PS["Prelude"];var Plus=function(){function Plus(){}Plus.value=new Plus;return Plus}();var Minus=function(){function Minus(){}Minus.value=new Minus;return Minus}();var Float=function(){function Float(){}Float.value=new Float;return Float}();var Integral=function(){function Integral(){}Integral.value=new Integral;return Integral}();var Scientific=function(){function Scientific(){}Scientific.value=new Scientific;return Scientific}();var zeroHugeNum={digits:new Data_List_Types.Cons(Data_Digit["_zero"],new Data_List_Types.Cons(Data_Digit["_zero"],Data_List_Types.Nil.value)),decimal:1,sign:Plus.value};var unsafeRemoveFrontZeroes=Data_List.dropWhile(function(v){return Data_Eq.eq(Data_Digit.eqDigit)(v)(Data_Digit["_zero"])});var trivialFraction=function(v){var decimals=Data_List.reverse(Data_List.drop(v.decimal)(v.digits));var meaty=Data_List.dropWhile(function(v1){return Data_Eq.eq(Data_Digit.eqDigit)(v1)(Data_Digit["_zero"])})(decimals);return Data_List["null"](meaty)};var toString=function(v){var sign=function(){if(v.sign instanceof Plus){return Data_Monoid.mempty(Data_List_Types.monoidList)}if(v.sign instanceof Minus){return Control_Applicative.pure(Data_List_Types.applicativeList)("-")}throw new Error("Failed pattern match at Data.HugeNum (line 174, column 14 - line 176, column 49): "+[v.sign.constructor.name])}();var charray=Data_Functor.map(Data_List_Types.functorList)(Data_Digit.toChar)(v.digits);var numray=Data_Maybe.fromJust()(Data_List.insertAt(v.decimal)(".")(charray));return Data_Foldable.foldMap(Data_List_Types.foldableList)(Data_Monoid.monoidString)(Data_String_CodeUnits.singleton)(Data_Semigroup.append(Data_List_Types.semigroupList)(sign)(numray))};var timesSign=function(v){return function(v1){if(v instanceof Plus&&v1 instanceof Plus){return Plus.value}if(v instanceof Minus&&v1 instanceof Minus){return Plus.value}return Minus.value}};var takeMeatyParts=function(arr){return Data_List.reverse(Data_List.dropWhile(function(v){return Data_Eq.eq(Data_Digit.eqDigit)(v)(Data_Digit["_zero"])})(Data_List.reverse(arr)))};var timesPowOfTen=function(n){return function(v){var newDecimal=v.decimal+n|0;var newZeroesLength=function(){var $97=newDecimal>=Data_List.length(takeMeatyParts(v.digits));if($97){return newDecimal-Data_List.length(takeMeatyParts(v.digits))|0}return 0}();var newZeroes=Data_Unfoldable.replicate(Data_List_Types.unfoldableList)(newZeroesLength)(Data_Digit["_zero"]);var z={digits:Data_Semigroup.append(Data_List_Types.semigroupList)(v.digits)(newZeroes),sign:v.sign,decimal:newDecimal};return z}};var smallEnough=function(v){if(v.decimal===1&&Data_List.length(v.digits)===2){return true}return false};var rec=function(v){return v};var parseScientific=function(n){var split=Data_List.span(function(v){return v!=="e"})(Data_List.fromFoldable(Data_Foldable.foldableArray)(Data_String_CodeUnits.toCharArray(Data_Show.show(Data_Show.showNumber)(n))));var signSplit=Data_Maybe.fromJust()(Data_List.uncons(Data_List.drop(1)(split.rest)));var sign=function(){var $102=n<0;if($102){return Minus.value}return Plus.value}();var exponent=Data_Int.round(Global.readFloat(Data_Foldable.foldMap(Data_List_Types.foldableList)(Data_Monoid.monoidString)(Data_String_CodeUnits.singleton)(signSplit.tail)));var expSign=function(){if(signSplit.head==="+"){return Plus.value}return Minus.value}();var base=Data_List.filter(function(v){return v!=="."})(split.init);var z={exponent:exponent,expSign:expSign,base:base,sign:sign};return z};var parsePlusPlus=function(exp){return function(base){var zeroCardinality=(exp-Data_List.length(base)|0)+2|0;var zeroes=Data_Unfoldable.replicate(Data_List_Types.unfoldableList)(zeroCardinality)(Data_Digit["_zero"]);var digits=Data_Semigroup.append(Data_List_Types.semigroupList)(Data_List.mapMaybe(Data_Digit.fromChar)(base))(zeroes);var decimal=1+exp|0;var r={digits:digits,decimal:decimal,sign:Plus.value};return r}};var parsePlusMinus=function(exp){return function(base){var r=parsePlusPlus(exp)(base);return{digits:Data_Semigroup.append(Data_List_Types.semigroupList)(r.digits)(Control_Applicative.pure(Data_List_Types.applicativeList)(Data_Digit["_zero"])),decimal:r.decimal,sign:Minus.value}}};var parseNumber=function(n){if(Data_String_CodeUnits.contains("e")(Data_Show.show(Data_Show.showNumber)(n))){return Scientific.value}if(Data_String_CodeUnits.contains(".")(Data_Show.show(Data_Show.showNumber)(n))){return Float.value}if(Data_Boolean.otherwise){return Integral.value}throw new Error("Failed pattern match at Data.HugeNum (line 204, column 1 - line 204, column 37): "+[n.constructor.name])};var parseMinusPlus=function(exp){return function(base){var zeroes=Data_Unfoldable.replicate(Data_List_Types.unfoldableList)(exp)(Data_Digit["_zero"]);var digits=Data_Semigroup.append(Data_List_Types.semigroupList)(zeroes)(Data_List.mapMaybe(Data_Digit.fromChar)(base));var r={digits:digits,decimal:1,sign:Plus.value};return r}};var parseMinusMinus=function(exp){return function(base){var r=parseMinusPlus(exp)(base);return{digits:r.digits,decimal:r.decimal,sign:Minus.value}}};var scientificToHugeNum=function(n){var parsed=parseScientific(n);var r=function(){if(parsed.expSign instanceof Plus){if(parsed.sign instanceof Plus){return parsePlusPlus(parsed.exponent)(parsed.base)}return parsePlusMinus(parsed.exponent)(parsed.base)}if(parsed.sign instanceof Plus){return parseMinusPlus(parsed.exponent)(parsed.base)}return parseMinusMinus(parsed.exponent)(parsed.base)}();return r};var oneHugeNum={digits:new Data_List_Types.Cons(Data_Digit["_one"],new Data_List_Types.Cons(Data_Digit["_zero"],Data_List_Types.Nil.value)),decimal:1,sign:Plus.value};var neg=function(v){if(v.sign instanceof Minus){return{digits:v.digits,decimal:v.decimal,sign:Plus.value}}return{digits:v.digits,decimal:v.decimal,sign:Minus.value}};var meatyDecimals=function(v){var decimals=Data_List.reverse(Data_List.drop(v.decimal)(v.digits));var meaty=Data_List.dropWhile(function(v1){return Data_Eq.eq(Data_Digit.eqDigit)(v1)(Data_Digit["_zero"])})(decimals);return Data_List.length(meaty)};var makeHugeInteger$prime=function(v){var digits=Data_Semigroup.append(Data_List_Types.semigroupList)(unsafeRemoveFrontZeroes(v.digits))(Control_Applicative.pure(Data_List_Types.applicativeList)(Data_Digit["_zero"]));var decimal=Data_List.length(digits)-1|0;var z={digits:digits,decimal:decimal,sign:v.sign};return z};var lessPrecise=function(v){return function(v1){return Data_List.length(Data_List.drop(v.decimal)(v.digits))<Data_List.length(Data_List.drop(v1.decimal)(v1.digits))}};var isZero=function(v){return Data_Foldable.all(Data_List_Types.foldableList)(Data_HeytingAlgebra.heytingAlgebraBoolean)(function(v1){return Data_Eq.eq(Data_Digit.eqDigit)(v1)(Data_Digit["_zero"])})(v.digits)};var isPositive=function(v){if(v.sign instanceof Plus){return true}return false};var isNegative=function(v){if(v.sign instanceof Minus){return true}return false};var isHugeInteger=function(v){return Data_Foldable.all(Data_List_Types.foldableList)(Data_HeytingAlgebra.heytingAlgebraBoolean)(function(v1){return Data_Eq.eq(Data_Digit.eqDigit)(v1)(Data_Digit["_zero"])})(Data_List.drop(v.decimal)(v.digits))};var makeHugeInteger=function(r){var $122=isHugeInteger(r);if($122){return r}return makeHugeInteger$prime(r)};var integralToHugeNum=function(n){var sign=function(){var $123=n<0;if($123){return Minus.value}return Plus.value}();var integral=Data_List.fromFoldable(Data_Foldable.foldableArray)(Data_String_CodeUnits.toCharArray(Data_Show.show(Data_Show.showNumber)(n)));var fractional=Control_Applicative.pure(Data_List_Types.applicativeList)(Data_Digit["_zero"]);var decimal=function(){if(sign instanceof Minus){return Data_List.length(integral)-1|0}return Data_List.length(integral)}();return{digits:Data_Semigroup.append(Data_List_Types.semigroupList)(Data_List.mapMaybe(Data_Digit.fromChar)(integral))(fractional),decimal:decimal,sign:sign}};var integerPart=function(v){return{digits:Data_Semigroup.append(Data_List_Types.semigroupList)(Data_List.take(v.decimal)(v.digits))(Control_Applicative.pure(Data_List_Types.applicativeList)(Data_Digit["_zero"])),decimal:v.decimal,sign:v.sign}};var floatToHugeNum=function(n){var sign=function(){var $138=n<0;if($138){return Minus.value}return Plus.value}();var pos=n>=0;var split=function(){if(pos){return Data_List.span(function(v){return v!=="."})(Data_List.fromFoldable(Data_Foldable.foldableArray)(Data_String_CodeUnits.toCharArray(Data_Show.show(Data_Show.showNumber)(n))))}return Data_List.span(function(v){return v!=="."})(Data_List.drop(1)(Data_List.fromFoldable(Data_Foldable.foldableArray)(Data_String_CodeUnits.toCharArray(Data_Show.show(Data_Show.showNumber)(n)))))}();var small=Data_List.drop(1)(split.rest);var decimal=Data_List.length(split.init);var digits=Data_List.mapMaybe(Data_Digit.fromChar)(Data_Semigroup.append(Data_List_Types.semigroupList)(split.init)(small));var r={digits:digits,decimal:decimal,sign:sign};return r};var fromNumber=function(n){var v=parseNumber(n);if(v instanceof Float){return floatToHugeNum(n)}if(v instanceof Scientific){return scientificToHugeNum(n)}if(v instanceof Integral){return integralToHugeNum(n)}throw new Error("Failed pattern match at Data.HugeNum (line 283, column 16 - line 286, column 52): "+[v.constructor.name])};var eqSign=new Data_Eq.Eq(function(v){return function(v1){if(v instanceof Plus&&v1 instanceof Plus){return true}if(v instanceof Minus&&v1 instanceof Minus){return true}return false}});var ordSign=new Data_Ord.Ord(function(){return eqSign},function(v){return function(v1){if(v instanceof Plus&&v1 instanceof Minus){return Data_Ordering.GT.value}if(v instanceof Minus&&v1 instanceof Plus){return Data_Ordering.LT.value}return Data_Ordering.EQ.value}});var strictlyEqual=function(v){return function(v1){return v.decimal===v1.decimal&&(Data_Eq.eq(Data_List_Types.eqList(Data_Digit.eqDigit))(v.digits)(v1.digits)&&Data_Eq.eq(eqSign)(v.sign)(v1.sign))}};var dropZeroes=function(){var dropIntegralZeroes=function(v){var integralPart=Data_List.take(v.decimal)(v.digits);var zeroes=Data_List.takeWhile(function(v1){return Data_Eq.eq(Data_Digit.eqDigit)(v1)(Data_Digit["_zero"])})(integralPart);var digits=function(){var $148=Data_List.length(integralPart)===Data_List.length(zeroes);if($148){return Control_Applicative.pure(Data_List_Types.applicativeList)(Data_Digit["_zero"])}return Data_List.drop(Data_List.length(zeroes))(integralPart)}();var decimal=Data_List.length(digits);var z={digits:Data_Semigroup.append(Data_List_Types.semigroupList)(digits)(Data_List.drop(v.decimal)(v.digits)),decimal:decimal,sign:v.sign};return z};var dropFractionalZeroes=function(v){var fractionalDigits=Data_List.reverse(Data_List.drop(v.decimal)(v.digits));var meatyFraction=Data_List.dropWhile(function(v1){return Data_Eq.eq(Data_Digit.eqDigit)(v1)(Data_Digit["_zero"])})(fractionalDigits);var digits=Data_List.reverse(meatyFraction);var z={digits:Data_Semigroup.append(Data_List_Types.semigroupList)(Data_List.take(v.decimal)(v.digits))(function(){var $150=Data_List["null"](digits);if($150){return Control_Applicative.pure(Data_List_Types.applicativeList)(Data_Digit["_zero"])}return digits}()),decimal:v.decimal,sign:v.sign};return z};return function($213){return dropIntegralZeroes(dropFractionalZeroes($213))}}();var eqHugeNum=new Data_Eq.Eq(function(x){return function(y){if(isZero(x)&&isZero(y)){return true}if(Data_Boolean.otherwise){return strictlyEqual(dropZeroes(x))(dropZeroes(y))}throw new Error("Failed pattern match at Data.HugeNum (line 75, column 1 - line 75, column 33): "+[x.constructor.name,y.constructor.name])}});var digitwiseSubtract=function(v){return function(v1){var tint=Data_Digit.toInt(v1.value0)-Data_Digit.toInt(v.value1)|0;var bint=Data_Digit.toInt(v1.value1);var diff$prime=tint-bint|0;var diff=Data_Maybe.fromJust()(Data_Digit.fromInt(function(){var $155=diff$prime<0;if($155){return diff$prime+10|0}return diff$prime}()));var spill=function(){var $156=diff$prime<0;if($156){return Data_Digit["_one"]}return Data_Digit["_zero"]}();return new Data_Tuple.Tuple(new Data_List_Types.Cons(diff,v.value0),spill)}};var digitwiseAdd=function(v){return function(v1){var tint=Data_Digit.toInt(v1.value0)+Data_Digit.toInt(v.value1)|0;var bint=Data_Digit.toInt(v1.value1);var summ$prime=tint+bint|0;var spill=function(){var $163=summ$prime>9;if($163){return Data_Digit["_one"]}return Data_Digit["_zero"]}();var summ=Data_Maybe.fromJust()(Data_Digit.fromInt(function(){var $164=summ$prime>9;if($164){return summ$prime-10|0}return summ$prime}()));return new Data_Tuple.Tuple(new Data_List_Types.Cons(summ,v.value0),spill)}};var equivalize=function(){var integralize=function(v){if(Data_List.length(Data_List.take(v.fst.decimal)(v.fst.digits))===Data_List.length(Data_List.take(v.snd.decimal)(v.snd.digits))){return{fst:v.fst,snd:v.snd}}if(Data_Boolean.otherwise){var lesser=rec(Data_Ord.min(ordHugeNum)(v.fst)(v.snd));var greater=rec(Data_Ord.max(ordHugeNum)(v.fst)(v.snd));var zeroesLength=Data_List.length(Data_List.take(greater.decimal)(greater.digits))-Data_List.length(Data_List.take(lesser.decimal)(lesser.digits))|0;var zeroes=Data_Unfoldable.replicate(Data_List_Types.unfoldableList)(zeroesLength)(Data_Digit["_zero"]);var lesser$prime={digits:Data_Semigroup.append(Data_List_Types.semigroupList)(zeroes)(lesser.digits),decimal:greater.decimal,sign:lesser.sign};var z={fst:lesser$prime,snd:greater};return z}throw new Error("Failed pattern match at Data.HugeNum (line 150, column 3 - line 158, column 57): "+[v.constructor.name])};var fractionalize=function(v){if(Data_List.length(Data_List.drop(v.fst.decimal)(v.fst.digits))===Data_List.length(Data_List.drop(v.snd.decimal)(v.snd.digits))){return{fst:v.fst,snd:v.snd}}if(Data_Boolean.otherwise){var test=lessPrecise(v.fst)(v.snd);var lesser=function(){if(test){return v.fst}return v.snd}();var greater=function(){if(test){return v.snd}return v.fst}();var lesserDecimal=Data_List.length(Data_List.drop(greater.decimal)(greater.digits))-Data_List.length(Data_List.drop(lesser.decimal)(lesser.digits))|0;var zeroes=Data_Unfoldable.replicate(Data_List_Types.unfoldableList)(lesserDecimal)(Data_Digit["_zero"]);var lesser$prime={digits:Data_Semigroup.append(Data_List_Types.semigroupList)(lesser.digits)(zeroes),decimal:lesser.decimal,sign:lesser.sign};var z={fst:lesser$prime,snd:greater};return z}throw new Error("Failed pattern match at Data.HugeNum (line 140, column 3 - line 149, column 57): "+[v.constructor.name])};return function($214){return integralize(fractionalize($214))}}();var compareHugeNum=function(v){return function(v1){if(Data_Ord.lessThan(ordSign)(v.sign)(v1.sign)){return Data_Ordering.LT.value}if(Data_Ord.greaterThan(ordSign)(v.sign)(v1.sign)){return Data_Ordering.GT.value}if(v.decimal>v1.decimal){return Data_Ordering.GT.value}if(v.decimal<v1.decimal){return Data_Ordering.LT.value}if(Data_Eq.eq(eqHugeNum)(v)(v1)){return Data_Ordering.EQ.value}if(Data_Boolean.otherwise){var r=equivalize({fst:v,snd:v1});var s=rec(r.fst);var m=rec(r.snd);var x$prime=function(){var $179=Data_Eq.eq(eqHugeNum)(v)(r.fst);if($179){return s}return m}();var y$prime=function(){var $180=Data_Eq.eq(eqHugeNum)(v1)(r.fst);if($180){return s}return m}();var z=function(){var v2=Data_Ord.compare(Data_List_Types.ordList(Data_Digit.ordDigit))(Data_List.take(v.decimal)(v.digits))(Data_List.take(v.decimal)(v1.digits));if(v2 instanceof Data_Ordering.EQ){return Data_Ord.compare(Data_List_Types.ordList(Data_Digit.ordDigit))(Data_List.drop(v.decimal)(x$prime.digits))(Data_List.drop(v.decimal)(y$prime.digits))}return v2}();return z}throw new Error("Failed pattern match at Data.HugeNum (line 101, column 1 - line 101, column 49): "+[v.constructor.name,v1.constructor.name])}};var ordHugeNum=new Data_Ord.Ord(function(){return eqHugeNum},compareHugeNum);var arrayToHugeNum=function(xs){return{sign:Plus.value,digits:Data_Semigroup.append(Data_List_Types.semigroupList)(xs)(Control_Applicative.pure(Data_List_Types.applicativeList)(Data_Digit["_zero"])),decimal:Data_List.length(xs)}};var adjustDigitsForDecimal=function(decimal){return function(digits){var go=function($copy_n){return function($copy_ds){var $tco_var_n=$copy_n;var $tco_done=false;var $tco_result;function $tco_loop(n,ds){if(n<=0){$tco_done=true;return ds}if(Data_Boolean.otherwise){$tco_var_n=n-1|0;$copy_ds=new Data_List_Types.Cons(Data_Digit["_zero"],ds);return}throw new Error("Failed pattern match at Data.HugeNum (line 380, column 3 - line 382, column 42): "+[n.constructor.name,ds.constructor.name])}while(!$tco_done){$tco_result=$tco_loop($tco_var_n,$copy_ds)}return $tco_result}};return go((decimal-Data_List.length(digits)|0)+1|0)(digits)}};var adjustDecimalForTriviality=function(h1){return function(h2){return function(v){var digitsLength=Data_List.length(v.digits)-1|0;var digits$prime=Data_List.take(digitsLength)(v.digits);var decimalMod=meatyDecimals(h1)+meatyDecimals(h2)|0;var digits=Data_Semigroup.append(Data_List_Types.semigroupList)(Data_Unfoldable.replicate(Data_List_Types.unfoldableList)((decimalMod-digitsLength|0)+1|0)(Data_Digit["_zero"]))(digits$prime);var decimal=Data_List.length(Data_List.drop(decimalMod)(Data_List.reverse(digits)));var r={digits:digits,decimal:decimal,sign:Plus.value};return dropZeroes(r)}}};var adjustDecimalForFrontZeroes=function(xs){return function(oldDec){var newDigits$prime=unsafeRemoveFrontZeroes(Data_List.take(oldDec)(xs));var newDigits=function(){var $187=Data_List["null"](newDigits$prime);if($187){return Control_Applicative.pure(Data_List_Types.applicativeList)(Data_Digit["_zero"])}return newDigits$prime}();return Data_List.length(newDigits)}};var addPlusPlus=function(x){return function(y){var eqv=equivalize({fst:x,snd:y});var r1=rec(eqv.fst);var r2=rec(eqv.snd);var r=Data_List.zip(Data_List.reverse(r1.digits))(Data_List.reverse(r2.digits));var digits$prime$prime=Data_Foldable.foldl(Data_List_Types.foldableList)(digitwiseAdd)(new Data_Tuple.Tuple(Data_Monoid.mempty(Data_List_Types.monoidList),Data_Digit["_zero"]))(r);var spill=Data_Tuple.snd(digits$prime$prime);var digits$prime=Data_Tuple.fst(digits$prime$prime);var digits=unsafeRemoveFrontZeroes(new Data_List_Types.Cons(spill,digits$prime));var decimal=adjustDecimalForFrontZeroes(new Data_List_Types.Cons(spill,digits$prime))(r1.decimal+1|0);var z={digits:adjustDigitsForDecimal(decimal)(digits),decimal:decimal,sign:Plus.value};return dropZeroes(z)}};var addPlusMinus=function(x){return function(y){var eqv=equivalize({fst:x,snd:y});var r1=rec(Data_Ord.min(ordHugeNum)(eqv.fst)(eqv.snd));var r2=rec(Data_Ord.max(ordHugeNum)(eqv.fst)(eqv.snd));var r=Data_List.zip(Data_List.reverse(r2.digits))(Data_List.reverse(r1.digits));var digits$prime$prime=Data_Foldable.foldl(Data_List_Types.foldableList)(digitwiseSubtract)(new Data_Tuple.Tuple(Data_Monoid.mempty(Data_List_Types.monoidList),Data_Digit["_zero"]))(r);var fractionalDigits=Data_List.drop(r1.decimal)(Data_Tuple.fst(digits$prime$prime));var integralDigits$prime$prime=Data_List.take(r1.decimal)(Data_Tuple.fst(digits$prime$prime));var integralDigits$prime=unsafeRemoveFrontZeroes(integralDigits$prime$prime);var integralDigits=function(){var $188=Data_List["null"](integralDigits$prime);if($188){return Control_Applicative.pure(Data_List_Types.applicativeList)(Data_Digit["_zero"])}return integralDigits$prime}();var digits=Data_Semigroup.append(Data_List_Types.semigroupList)(integralDigits)(fractionalDigits);var decimal=adjustDecimalForFrontZeroes(Data_Tuple.fst(digits$prime$prime))(r1.decimal);var z={digits:digits,decimal:decimal,sign:Plus.value};return z}};var addMinusMinus=function(x){return function(y){var z=rec(addPlusPlus(x)(y));return{digits:z.digits,decimal:z.decimal,sign:Minus.value}}};var abs=function(v){return{digits:v.digits,decimal:v.decimal,sign:Plus.value}};var getPowForKRep=function(x){return function(y){return function(v){return v-1|0}(function(v){return v.decimal}(rec(Data_Ord.min(ordHugeNum)(abs(x))(abs(y)))))}};var plus=function(x){return function(y){if(isZero(x)){return y}if(isZero(y)){return x}if(isPositive(x)&&isPositive(y)){return addPlusPlus(x)(y)}if(isNegative(x)&&isNegative(y)){return addMinusMinus(x)(y)}if(Data_Boolean.otherwise){var lesserMag=Data_Ord.min(ordHugeNum)(abs(x))(abs(y));var lesser=Data_Ord.min(ordHugeNum)(x)(y);var greaterMag=Data_Ord.max(ordHugeNum)(abs(x))(abs(y));var greater=Data_Ord.max(ordHugeNum)(x)(y);var z=function(){var $192=Data_Eq.eq(eqHugeNum)(greater)(greaterMag);if($192){return addPlusMinus(greater)(lesser)}return neg(addPlusMinus(greaterMag)(lesserMag))}();return z}throw new Error("Failed pattern match at Data.HugeNum (line 432, column 1 - line 432, column 38): "+[x.constructor.name,y.constructor.name])}};var scale=function(){var go=function($copy_x){return function($copy_v){return function($copy_v1){var $tco_var_x=$copy_x;var $tco_var_v=$copy_v;var $tco_done=false;var $tco_result;function $tco_loop(x,v,v1){if(v===0){$tco_done=true;return x}$tco_var_x=plus(x)(v1);$tco_var_v=v-1|0;$copy_v1=v1;return}while(!$tco_done){$tco_result=$tco_loop($tco_var_x,$tco_var_v,$copy_v1)}return $tco_result}}};return go(zeroHugeNum)}();var multSmallNum=function(v){return function(r2){var v1=Data_List.uncons(v.digits);if(v1 instanceof Data_Maybe.Just){var $199=Data_Eq.eq(Data_Digit.eqDigit)(v1.value0.head)(Data_Digit["_zero"]);if($199){return zeroHugeNum}return scale(Data_Digit.toInt(v1.value0.head))(r2)}return Effect_Exception_Unsafe.unsafeThrow("Error: The impossible happened")}};var toKRep=function(exp){return function(v){var coeff=Data_List.take(v.decimal-exp|0)(v.digits);var bm=new Data_List_Types.Cons(Data_Digit["_one"],Data_Unfoldable.replicate(Data_List_Types.unfoldableList)(exp)(Data_Digit["_zero"]));var prod=Data_Semigroup.append(Data_List_Types.semigroupList)(coeff)(Data_List.drop(1)(bm));var leftSummand=arrayToHugeNum(prod);var k=plus(v)(neg(leftSummand));var z={exp:exp,coeff:coeff,const:k};return z}};var times=function(r1){return function(r2){if(Data_Eq.eq(eqSign)(timesSign(function(v){return v.sign}(rec(r1)))(function(v){return v.sign}(rec(r2))))(Minus.value)){return neg(times(abs(r1))(abs(r2)))}if(!trivialFraction(r1)||!trivialFraction(r2)){return adjustDecimalForTriviality(r1)(r2)(times(makeHugeInteger(r1))(makeHugeInteger(r2)))}if(smallEnough(r1)){return multSmallNum(r1)(r2)}if(smallEnough(r2)){return multSmallNum(r2)(r1)}if(Data_Boolean.otherwise){var exp=getPowForKRep(r1)(r2);var k1=toKRep(exp)(r1);var k2=toKRep(exp)(r2);var z0=times(k1["const"])(k2["const"]);var z2=times(arrayToHugeNum(k1.coeff))(arrayToHugeNum(k2.coeff));var z1=function(){var rightFactor=plus(arrayToHugeNum(k2.coeff))(k2["const"]);var leftFactor=plus(arrayToHugeNum(k1.coeff))(k1["const"]);var prod=times(leftFactor)(rightFactor);return plus(plus(prod)(neg(z2)))(neg(z0))}();var z1Bm=timesPowOfTen(exp)(z1);var z2B2m=timesPowOfTen(2*exp|0)(z2);var z=plus(plus(z2B2m)(z1Bm))(z0);return z}throw new Error("Failed pattern match at Data.HugeNum (line 504, column 1 - line 504, column 39): "+[r1.constructor.name,r2.constructor.name])}};var semiringHugeNum=new Data_Semiring.Semiring(plus,times,oneHugeNum,zeroHugeNum);var ceil=function(h){if(isNegative(h)){return integerPart(h)}if(isZero(h)){return Data_Semiring.zero(semiringHugeNum)}if(Data_Boolean.otherwise){return Data_Semiring.add(semiringHugeNum)(integerPart(h))(Data_Semiring.one(semiringHugeNum))}throw new Error("Failed pattern match at Data.HugeNum (line 316, column 1 - line 316, column 27): "+[h.constructor.name])};var ringHugeNum=new Data_Ring.Ring(function(){return semiringHugeNum},function(r1){return function(r2){return Data_Semiring.add(semiringHugeNum)(r1)(neg(r2))}});var floor=function(h){if(isPositive(h)){return integerPart(h)}if(isZero(h)){return Data_Semiring.zero(semiringHugeNum)}if(Data_Boolean.otherwise){return Data_Ring.sub(ringHugeNum)(integerPart(h))(Data_Semiring.one(semiringHugeNum))}throw new Error("Failed pattern match at Data.HugeNum (line 310, column 1 - line 310, column 28): "+[h.constructor.name])};var round=function(h){if(Data_Ord.lessThan(ordHugeNum)(abs(Data_Ring.sub(ringHugeNum)(h)(floor(h))))(abs(Data_Ring.sub(ringHugeNum)(ceil(h))(h)))){return floor(h)}if(Data_Boolean.otherwise){return ceil(h)}throw new Error("Failed pattern match at Data.HugeNum (line 322, column 1 - line 322, column 28): "+[h.constructor.name])};exports["fromNumber"]=fromNumber;exports["toString"]=toString;exports["integerPart"]=integerPart;exports["abs"]=abs;exports["neg"]=neg;exports["isNegative"]=isNegative;exports["isPositive"]=isPositive;exports["isZero"]=isZero;exports["floor"]=floor;exports["ceil"]=ceil;exports["round"]=round;exports["eqHugeNum"]=eqHugeNum;exports["ordHugeNum"]=ordHugeNum;exports["semiringHugeNum"]=semiringHugeNum;exports["ringHugeNum"]=ringHugeNum})(PS["Data.HugeNum"]=PS["Data.HugeNum"]||{});(function(exports){"use strict";var Control_Applicative=PS["Control.Applicative"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Boolean=PS["Data.Boolean"];var Data_Bounded=PS["Data.Bounded"];var Data_Eq=PS["Data.Eq"];var Data_Function=PS["Data.Function"];var Data_Functor=PS["Data.Functor"];var Data_Generic_Rep=PS["Data.Generic.Rep"];var Data_HeytingAlgebra=PS["Data.HeytingAlgebra"];var Data_HugeNum=PS["Data.HugeNum"];var Data_Int=PS["Data.Int"];var Data_Maybe=PS["Data.Maybe"];var Data_Ord=PS["Data.Ord"];var Data_Ring=PS["Data.Ring"];var Data_Semigroup=PS["Data.Semigroup"];var Data_Semiring=PS["Data.Semiring"];var Data_Show=PS["Data.Show"];var Data_String=PS["Data.String"];var Data_String_CodePoints=PS["Data.String.CodePoints"];var Data_String_CodeUnits=PS["Data.String.CodeUnits"];var Prelude=PS["Prelude"];var HugeInt=function(x){return x};var showHugeInt=new Data_Show.Show(function(v){return"HugeInt "+Data_String_CodeUnits.takeWhile(function(v1){return v1!=="."})(Data_HugeNum.toString(v))});var semiringHugeInt=new Data_Semiring.Semiring(function(v){return function(v1){return Data_Semiring.add(Data_HugeNum.semiringHugeNum)(v)(v1)}},function(v){return function(v1){return Data_Semiring.mul(Data_HugeNum.semiringHugeNum)(v)(v1)}},Data_Semiring.one(Data_HugeNum.semiringHugeNum),Data_Semiring.zero(Data_HugeNum.semiringHugeNum));var fromInt=function($47){return HugeInt(Data_HugeNum.fromNumber(Data_Int.toNumber($47)))};exports["fromInt"]=fromInt;exports["showHugeInt"]=showHugeInt;exports["semiringHugeInt"]=semiringHugeInt})(PS["Data.HugeInt"]=PS["Data.HugeInt"]||{});(function(exports){"use strict";exports.split=function(sep){return function(s){return s.split(sep)}};exports.trim=function(s){return s.trim()}})(PS["Data.String.Common"]=PS["Data.String.Common"]||{});(function(exports){"use strict";var $foreign=PS["Data.String.Common"];var Data_Eq=PS["Data.Eq"];var Data_Ordering=PS["Data.Ordering"];var Data_String_Pattern=PS["Data.String.Pattern"];var Prelude=PS["Prelude"];exports["split"]=$foreign.split;exports["trim"]=$foreign.trim})(PS["Data.String.Common"]=PS["Data.String.Common"]||{});(function(exports){"use strict";var Control_Applicative=PS["Control.Applicative"];var Control_Bind=PS["Control.Bind"];var Control_Monad_Rec_Class=PS["Control.Monad.Rec.Class"];var Data_Array=PS["Data.Array"];var Data_Either=PS["Data.Either"];var Data_Eq=PS["Data.Eq"];var Data_HugeInt=PS["Data.HugeInt"];var Data_Int=PS["Data.Int"];var Data_Maybe=PS["Data.Maybe"];var Data_Ord=PS["Data.Ord"];var Data_Ring=PS["Data.Ring"];var Data_Semiring=PS["Data.Semiring"];var Data_Show=PS["Data.Show"];var Data_String=PS["Data.String"];var Data_String_CodeUnits=PS["Data.String.CodeUnits"];var Data_String_Common=PS["Data.String.Common"];var Data_String_Pattern=PS["Data.String.Pattern"];var Data_Tuple=PS["Data.Tuple"];var Data_Unit=PS["Data.Unit"];var Partial_Unsafe=PS["Partial.Unsafe"];var Prelude=PS["Prelude"];var solve$prime$prime=function(m){return function(abs){var sorted=Data_Array.sortWith(Data_Ord.ordInt)(Data_Tuple.fst)(abs);var go=function(v){var v1=Data_Array.index(sorted)(v.i);if(v1 instanceof Data_Maybe.Nothing){return new Control_Monad_Rec_Class.Done(v.n)}if(v1 instanceof Data_Maybe.Just){var m$prime$prime=v["m'"]-v1.value0.value1|0;var a$prime=Data_HugeInt.fromInt(v1.value0.value0);var $21=m$prime$prime<0;if($21){return new Control_Monad_Rec_Class.Done(Data_Semiring.add(Data_HugeInt.semiringHugeInt)(v.n)(Data_Semiring.mul(Data_HugeInt.semiringHugeInt)(a$prime)(Data_HugeInt.fromInt(v["m'"]))))}return new Control_Monad_Rec_Class.Loop({i:v.i+1|0,"m'":m$prime$prime,n:Data_Semiring.add(Data_HugeInt.semiringHugeInt)(v.n)(Data_Semiring.mul(Data_HugeInt.semiringHugeInt)(a$prime)(Data_HugeInt.fromInt(v1.value0.value1)))})}throw new Error("Failed pattern match at AtCoder.ABC121.C (line 79, column 7 - line 91, column 76): "+[v1.constructor.name])};return Control_Monad_Rec_Class.tailRec(go)({i:0,"m'":m,n:Data_HugeInt.fromInt(0)})}};var solve$prime=function(input){return Control_Bind.bind(Data_Either.bindEither)(Data_Either.note("index1")(Data_String_CodeUnits.indexOf("\n")(input)))(function(v){return Control_Bind.bind(Data_Either.bindEither)(Data_Either.note("line1")(Data_String_CodeUnits.slice(0)(v)(input)))(function(v1){return Control_Bind.bind(Data_Either.bindEither)(Control_Applicative.pure(Data_Either.applicativeEither)(Data_String_CodeUnits.drop(v)(input)))(function(v2){var abss=Data_String_Common.split("\n")(Data_String_Common.trim(v2));return Control_Bind.bind(Data_Either.bindEither)(function(){var v3=Data_String_Common.split(" ")(v1);if(v3.length===2){return Control_Bind.bind(Data_Either.bindEither)(Data_Either.note("n")(Data_Int.fromString(v3[0])))(function(v4){return Control_Bind.bind(Data_Either.bindEither)(Data_Either.note("m")(Data_Int.fromString(v3[1])))(function(v5){return Control_Applicative.pure(Data_Either.applicativeEither)({m:v5,n:v4})})})}return new Data_Either.Left("n m")}())(function(v3){return Control_Bind.bind(Data_Either.bindEither)(Control_Applicative.pure(Data_Either.applicativeEither)(Data_Array.mapMaybe(function(i){var v4=Data_String_Common.split(" ")(i);if(v4.length===2){return Control_Bind.bind(Data_Maybe.bindMaybe)(Data_Int.fromString(v4[0]))(function(v5){return Control_Bind.bind(Data_Maybe.bindMaybe)(Data_Int.fromString(v4[1]))(function(v6){return Control_Applicative.pure(Data_Maybe.applicativeMaybe)(new Data_Tuple.Tuple(v5,v6))})})}return Data_Maybe.Nothing.value})(abss)))(function(v4){return Control_Bind.discard(Control_Bind.discardUnit)(Data_Either.bindEither)(function(){var $43=Data_Array.length(v4)===v3.n;if($43){return Control_Applicative.pure(Data_Either.applicativeEither)(Data_Unit.unit)}return new Data_Either.Left("abs length")}())(function(){return Data_Either.note("HugeInt")(Data_String_CodeUnits.stripPrefix("HugeInt ")(Data_Show.show(Data_HugeInt.showHugeInt)(solve$prime$prime(v3.m)(v4))))})})})})})})};var solve=function(input){var v=solve$prime(input);if(v instanceof Data_Either.Left){return Partial_Unsafe.unsafeCrashWith(v.value0)}if(v instanceof Data_Either.Right){return v.value0}throw new Error("Failed pattern match at AtCoder.ABC121.C (line 36, column 3 - line 38, column 17): "+[v.constructor.name])};exports["solve"]=solve})(PS["AtCoder.ABC121.C"]=PS["AtCoder.ABC121.C"]||{});(function(exports){"use strict";exports.log=function(s){return function(){console.log(s);return{}}}})(PS["Effect.Console"]=PS["Effect.Console"]||{});(function(exports){"use strict";var $foreign=PS["Effect.Console"];var Data_Show=PS["Data.Show"];var Data_Unit=PS["Data.Unit"];var Effect=PS["Effect"];exports["log"]=$foreign.log})(PS["Effect.Console"]=PS["Effect.Console"]||{});(function(exports){"use strict";var $foreign=PS["Node.Encoding"];var Data_Show=PS["Data.Show"];var Prelude=PS["Prelude"];var ASCII=function(){function ASCII(){}ASCII.value=new ASCII;return ASCII}();var UTF8=function(){function UTF8(){}UTF8.value=new UTF8;return UTF8}();var UTF16LE=function(){function UTF16LE(){}UTF16LE.value=new UTF16LE;return UTF16LE}();var UCS2=function(){function UCS2(){}UCS2.value=new UCS2;return UCS2}();var Base64=function(){function Base64(){}Base64.value=new Base64;return Base64}();var Latin1=function(){function Latin1(){}Latin1.value=new Latin1;return Latin1}();var Binary=function(){function Binary(){}Binary.value=new Binary;return Binary}();var Hex=function(){function Hex(){}Hex.value=new Hex;return Hex}();var showEncoding=new Data_Show.Show(function(v){if(v instanceof ASCII){return"ASCII"}if(v instanceof UTF8){return"UTF8"}if(v instanceof UTF16LE){return"UTF16LE"}if(v instanceof UCS2){return"UCS2"}if(v instanceof Base64){return"Base64"}if(v instanceof Latin1){return"Latin1"}if(v instanceof Binary){return"Binary"}if(v instanceof Hex){return"Hex"}throw new Error("Failed pattern match at Node.Encoding (line 19, column 1 - line 19, column 39): "+[v.constructor.name])});exports["ASCII"]=ASCII;exports["UTF8"]=UTF8;exports["UTF16LE"]=UTF16LE;exports["UCS2"]=UCS2;exports["Base64"]=Base64;exports["Latin1"]=Latin1;exports["Binary"]=Binary;exports["Hex"]=Hex;exports["showEncoding"]=showEncoding})(PS["Node.Encoding"]=PS["Node.Encoding"]||{});(function(exports){"use strict";exports.unsafeRequireFS=require("fs")})(PS["Node.FS.Internal"]=PS["Node.FS.Internal"]||{});(function(exports){"use strict";var $foreign=PS["Node.FS.Internal"];var Effect=PS["Effect"];var Prelude=PS["Prelude"];var Unsafe_Coerce=PS["Unsafe.Coerce"];var mkEffect=Unsafe_Coerce.unsafeCoerce;exports["mkEffect"]=mkEffect;exports["unsafeRequireFS"]=$foreign.unsafeRequireFS})(PS["Node.FS.Internal"]=PS["Node.FS.Internal"]||{});(function(exports){"use strict";var Control_Bind=PS["Control.Bind"];var Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_DateTime=PS["Data.DateTime"];var Data_DateTime_Instant=PS["Data.DateTime.Instant"];var Data_EuclideanRing=PS["Data.EuclideanRing"];var Data_Function=PS["Data.Function"];var Data_Function_Uncurried=PS["Data.Function.Uncurried"];var Data_Functor=PS["Data.Functor"];var Data_Int=PS["Data.Int"];var Data_Maybe=PS["Data.Maybe"];var Data_Nullable=PS["Data.Nullable"];var Data_Show=PS["Data.Show"];var Data_Time_Duration=PS["Data.Time.Duration"];var Effect=PS["Effect"];var Node_Buffer=PS["Node.Buffer"];var Node_Encoding=PS["Node.Encoding"];var Node_FS=PS["Node.FS"];var Node_FS_Internal=PS["Node.FS.Internal"];var Node_FS_Perms=PS["Node.FS.Perms"];var Node_FS_Stats=PS["Node.FS.Stats"];var Node_Path=PS["Node.Path"];var Prelude=PS["Prelude"];var fs=Node_FS_Internal.unsafeRequireFS;var readTextFile=function(encoding){return function(file){return Node_FS_Internal.mkEffect(function(v){return fs.readFileSync(file,{encoding:Data_Show.show(Node_Encoding.showEncoding)(encoding)})})}};exports["readTextFile"]=readTextFile})(PS["Node.FS.Sync"]=PS["Node.FS.Sync"]||{});(function(exports){"use strict";var AtCoder_ABC121_C=PS["AtCoder.ABC121.C"];var Control_Applicative=PS["Control.Applicative"];var Control_Bind=PS["Control.Bind"];var Effect=PS["Effect"];var Effect_Console=PS["Effect.Console"];var Node_Encoding=PS["Node.Encoding"];var Node_FS_Sync=PS["Node.FS.Sync"];var Prelude=PS["Prelude"];var solve=AtCoder_ABC121_C.solve;var main=function __do(){var v=Node_FS_Sync.readTextFile(Node_Encoding.UTF8.value)("/dev/stdin")();var v1=solve(v);return Effect_Console.log(v1)()};exports["main"]=main})(PS["Main"]=PS["Main"]||{});PS["Main"].main();