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 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)}}};exports["flip"]=flip})(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 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";exports.unit={}})(PS["Data.Unit"]=PS["Data.Unit"]||{});(function(exports){"use strict";exports.showIntImpl=function(n){return n.toString()}})(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 showInt=new Show($foreign.showIntImpl);var show=function(dict){return dict.show};exports["Show"]=Show;exports["show"]=show;exports["showInt"]=showInt})(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.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.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";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";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.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 append=function(dict){return dict.append};exports["Semigroup"]=Semigroup;exports["append"]=append})(PS["Data.Semigroup"]=PS["Data.Semigroup"]||{});(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 mempty=function(dict){return dict.mempty};exports["Monoid"]=Monoid;exports["mempty"]=mempty})(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])}}};exports["Nothing"]=Nothing;exports["Just"]=Just;exports["maybe"]=maybe})(PS["Data.Maybe"]=PS["Data.Maybe"]||{});(function(exports){"use strict";exports.intAdd=function(x){return function(y){return x+y|0}};exports.intMul=function(x){return function(y){return x*y|0}}})(PS["Data.Semiring"]=PS["Data.Semiring"]||{});(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 semiringInt=new Semiring($foreign.intAdd,$foreign.intMul,1,0);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;exports["semiringInt"]=semiringInt})(PS["Data.Semiring"]=PS["Data.Semiring"]||{});(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 sum=function(dictFoldable){return function(dictSemiring){return foldl(dictFoldable)(Data_Semiring.add(dictSemiring))(Data_Semiring.zero(dictSemiring))}};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["sum"]=sum;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 fromRight=function(dictPartial){return function(v){if(v instanceof Right){return v.value0}throw new Error("Failed pattern match at Data.Either (line 261, column 1 - line 261, column 52): "+[v.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["fromRight"]=fromRight;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";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.slice=function(s){return function(e){return function(l){return l.slice(s,e)}}};exports.drop=function(n){return function(l){return n<1?l:l.slice(n)}};exports.zipWith=function(f){return function(xs){return function(ys){var l=xs.length<ys.length?xs.length:ys.length;var result=new Array(l);for(var i=0;i<l;i++){result[i]=f(xs[i])(ys[i])}return result}}}})(PS["Data.Array"]=PS["Data.Array"]||{});(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 singleton=function(a){return[a]};var index=$foreign.indexImpl(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);var head=function(xs){return index(xs)(0)};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["head"]=head;exports["index"]=index;exports["concatMap"]=concatMap;exports["mapMaybe"]=mapMaybe;exports["length"]=$foreign.length;exports["drop"]=$foreign.drop;exports["zipWith"]=$foreign.zipWith})(PS["Data.Array"]=PS["Data.Array"]||{});(function(exports){"use strict";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";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);exports["fromString"]=fromString;exports["fromStringAs"]=fromStringAs})(PS["Data.Int"]=PS["Data.Int"]||{});(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 Control_Semigroupoid=PS["Control.Semigroupoid"];var Data_Array=PS["Data.Array"];var Data_Either=PS["Data.Either"];var Data_Eq=PS["Data.Eq"];var Data_Foldable=PS["Data.Foldable"];var Data_Functor=PS["Data.Functor"];var Data_HeytingAlgebra=PS["Data.HeytingAlgebra"];var Data_Int=PS["Data.Int"];var Data_Maybe=PS["Data.Maybe"];var Data_Ord=PS["Data.Ord"];var Data_Semiring=PS["Data.Semiring"];var Data_Show=PS["Data.Show"];var Data_String=PS["Data.String"];var Data_String_Common=PS["Data.String.Common"];var Data_String_Pattern=PS["Data.String.Pattern"];var Data_Traversable=PS["Data.Traversable"];var Data_Unit=PS["Data.Unit"];var Partial_Unsafe=PS["Partial.Unsafe"];var Prelude=PS["Prelude"];var solve$prime$prime=function(c){return function(bs){return function(ass){var go=function(v){var v1=Data_Array.index(ass)(v.i);if(v1 instanceof Data_Maybe.Nothing){return new Control_Monad_Rec_Class.Done(v.n)}if(v1 instanceof Data_Maybe.Just){var $16=(Data_Foldable.sum(Data_Foldable.foldableArray)(Data_Semiring.semiringInt)(Data_Array.zipWith(Data_Semiring.mul(Data_Semiring.semiringInt))(v1.value0)(bs))+c|0)>0;if($16){return new Control_Monad_Rec_Class.Loop({i:v.i+1|0,n:v.n+1|0})}return new Control_Monad_Rec_Class.Loop({i:v.i+1|0,n:v.n})}throw new Error("Failed pattern match at AtCoder.ABC121.B (line 55, column 7 - line 60, column 46): "+[v1.constructor.name])};return Control_Monad_Rec_Class.tailRec(go)({i:0,n:0})}}};var solve$prime=function(input){var lines=Data_String_Common.split("\n")(Data_String_Common.trim(input));return Control_Bind.bind(Data_Either.bindEither)(Control_Bind.bind(Data_Either.bindEither)(Data_Either.note("nmc")(Data_Array.head(lines)))(function(v){return Control_Bind.bind(Data_Either.bindEither)(Data_Either.note("bss")(Data_Array.head(Data_Array.drop(1)(lines))))(function(v1){return Control_Bind.bind(Data_Either.bindEither)(Control_Applicative.pure(Data_Either.applicativeEither)(Data_Array.drop(2)(lines)))(function(v2){return Control_Applicative.pure(Data_Either.applicativeEither)({asss:v2,bss:v1,nmc:v})})})}))(function(v){return Control_Bind.bind(Data_Either.bindEither)(function(){var v1=Data_String_Common.split(" ")(v.nmc);if(v1.length===3){return Control_Bind.bind(Data_Either.bindEither)(Data_Either.note("n")(Data_Int.fromString(v1[0])))(function(v2){return Control_Bind.bind(Data_Either.bindEither)(Data_Either.note("m")(Data_Int.fromString(v1[1])))(function(v3){return Control_Bind.bind(Data_Either.bindEither)(Data_Either.note("c")(Data_Int.fromString(v1[2])))(function(v4){return Control_Applicative.pure(Data_Either.applicativeEither)({c:v4,m:v3,n:v2})})})})}return new Data_Either.Left("n m c")}())(function(v1){return Control_Bind.bind(Data_Either.bindEither)(Control_Applicative.pure(Data_Either.applicativeEither)(Data_Array.mapMaybe(Data_Int.fromString)(Data_String_Common.split(" ")(v.bss))))(function(v2){return Control_Bind.discard(Control_Bind.discardUnit)(Data_Either.bindEither)(function(){var $33=Data_Array.length(v2)!==v1.m;if($33){return new Data_Either.Left("bs length")}return Control_Applicative.pure(Data_Either.applicativeEither)(Data_Unit.unit)}())(function(){return Control_Bind.bind(Data_Either.bindEither)(Control_Applicative.pure(Data_Either.applicativeEither)(Data_Functor.map(Data_Functor.functorArray)(function(i){return Data_Array.mapMaybe(Data_Int.fromString)(Data_String_Common.split(" ")(i))})(v.asss)))(function(v3){return Control_Bind.discard(Control_Bind.discardUnit)(Data_Either.bindEither)(function(){var $35=Data_Array.length(v3)===v1.n;if($35){return Control_Applicative.pure(Data_Either.applicativeEither)(Data_Unit.unit)}return new Data_Either.Left("ass length")}())(function(){return Control_Bind.discard(Control_Bind.discardUnit)(Data_Either.bindEither)(function(){var $36=Data_Foldable.all(Data_Foldable.foldableArray)(Data_HeytingAlgebra.heytingAlgebraBoolean)(function($43){return v1.m===Data_Array.length($43)})(v3);if($36){return Control_Applicative.pure(Data_Either.applicativeEither)(Data_Unit.unit)}return new Data_Either.Left("as length")}())(function(){return Control_Applicative.pure(Data_Either.applicativeEither)(Data_Show.show(Data_Show.showInt)(solve$prime$prime(v1.c)(v2)(v3)))})})})})})})})};var solve=function(input){return Data_Either.fromRight()(solve$prime(input))};exports["solve"]=solve})(PS["AtCoder.ABC121.B"]=PS["AtCoder.ABC121.B"]||{});(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_B=PS["AtCoder.ABC121.B"];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_B.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();