parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Focm":[function(require,module,exports) {
var n={};!function(t){"use strict";(n["Control.Apply"]=n["Control.Apply"]||{}).arrayApply=function(n){return function(t){for(var r=n.length,e=t.length,a=new Array(r*e),o=0,i=0;i<r;i++)for(var u=n[i],c=0;c<e;c++)a[o++]=u(t[c]);return a}}}(),function(t){"use strict";(n["Data.Boolean"]=n["Data.Boolean"]||{}).otherwise=!0}(),function(t){"use strict";n["Control.Category"],n["Data.Boolean"],n["Data.Ord"],n["Data.Ring"];t.flip=function(n){return function(t){return function(r){return n(r)(t)}}},t.const=function(n){return function(t){return n}}}(n["Data.Function"]=n["Data.Function"]||{}),function(t){"use strict";(n["Data.Functor"]=n["Data.Functor"]||{}).arrayMap=function(n){return function(t){for(var r=t.length,e=new Array(r),a=0;a<r;a++)e[a]=n(t[a]);return e}}}(),function(t){"use strict";var r=n["Data.Functor"],e=(n["Control.Semigroupoid"],n["Data.Function"],n["Data.Unit"],function(n){this.map=n}),a=new e(r.arrayMap);t.Functor=e,t.map=function(n){return n.map},t.functorArray=a}(n["Data.Functor"]=n["Data.Functor"]||{}),function(t){"use strict";var r=n["Control.Apply"],e=(n["Control.Category"],n["Data.Function"],n["Data.Functor"]),a=function(n,t){this.Functor0=n,this.apply=t},o=new a(function(){return e.functorArray},r.arrayApply);t.Apply=a,t.apply=function(n){return n.apply},t.applyArray=o}(n["Control.Apply"]=n["Control.Apply"]||{}),function(t){"use strict";n["Control.Apply"],n["Data.Functor"],n["Data.Unit"];t.Applicative=function(n,t){this.Apply0=n,this.pure=t},t.pure=function(n){return n.pure}}(n["Control.Applicative"]=n["Control.Applicative"]||{}),function(t){"use strict";(n["Control.Bind"]=n["Control.Bind"]||{}).arrayBind=function(n){return function(t){for(var r=[],e=0,a=n.length;e<a;e++)Array.prototype.push.apply(r,t(n[e]));return r}}}(),function(t){"use strict";var r=n["Control.Bind"],e=(n["Control.Applicative"],n["Control.Apply"]),a=(n["Control.Category"],n["Data.Function"],n["Data.Functor"],n["Data.Unit"],function(n,t){this.Apply0=n,this.bind=t}),o=new a(function(){return e.applyArray},r.arrayBind);t.Bind=a,t.bind=function(n){return n.bind},t.bindArray=o}(n["Control.Bind"]=n["Control.Bind"]||{}),function(t){"use strict";n["Control.Applicative"],n["Control.Apply"],n["Control.Bind"],n["Data.Functor"],n["Data.Unit"];t.Monad=function(n,t){this.Applicative0=n,this.Bind1=t}}(n["Control.Monad"]=n["Control.Monad"]||{}),function(t){"use strict";(n["Data.Eq"]=n["Data.Eq"]||{}).refEq=function(n){return function(t){return n===t}}}(),function(t){"use strict";var r=n["Data.Eq"],e=(n["Data.HeytingAlgebra"],n["Data.Symbol"],n["Data.Unit"],n["Data.Void"],n["Record.Unsafe"],n["Type.Data.RowList"],function(n){this.eq=n}),a=new e(r.refEq);t.Eq=e,t.eq=function(n){return n.eq},t.eqInt=a}(n["Data.Eq"]=n["Data.Eq"]||{}),function(t){"use strict";(n["Data.Show"]=n["Data.Show"]||{}).showIntImpl=function(n){return n.toString()}}(),function(t){"use strict";var r=n["Data.Show"],e=(n["Data.Symbol"],n["Record.Unsafe"],n["Type.Data.RowList"],function(n){this.show=n}),a=new e(r.showIntImpl);t.Show=e,t.show=function(n){return n.show},t.showInt=a}(n["Data.Show"]=n["Data.Show"]||{}),function(t){"use strict";n["Control.Alt"],n["Control.Alternative"],n["Control.Applicative"],n["Control.Apply"],n["Control.Bind"],n["Control.Category"],n["Control.Extend"],n["Control.Monad"],n["Control.MonadZero"],n["Control.Plus"],n["Data.Bounded"],n["Data.Eq"];var r=n["Data.Function"],e=(n["Data.Functor"],n["Data.Functor.Invariant"],n["Data.Monoid"],n["Data.Ord"],n["Data.Ordering"],n["Data.Semigroup"],n["Data.Show"],n["Data.Unit"],n.Prelude,function(){function n(){}return n.value=new n,n}()),a=function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}(),o=function(n){return function(t){return function(r){if(r instanceof e)return n;if(r instanceof a)return t(r.value0);throw new Error("Failed pattern match at Data.Maybe (line 217, column 1 - line 217, column 51): "+[n.constructor.name,t.constructor.name,r.constructor.name])}}},i=o(!1)(r.const(!0));t.Nothing=e,t.Just=a,t.maybe=o,t.isJust=i}(n["Data.Maybe"]=n["Data.Maybe"]||{}),function(t){"use strict";n["Control.Alt"];var r=n["Control.Applicative"],e=n["Control.Apply"],a=n["Control.Bind"],o=(n["Control.Extend"],n["Control.Monad"]),i=(n["Control.Semigroupoid"],n["Data.Bifoldable"],n["Data.Bifunctor"],n["Data.Bitraversable"],n["Data.Bounded"],n["Data.Eq"],n["Data.Foldable"],n["Data.FoldableWithIndex"],n["Data.Function"],n["Data.Functor"]),u=(n["Data.Functor.Invariant"],n["Data.FunctorWithIndex"],n["Data.Maybe"]),c=(n["Data.Monoid"],n["Data.Ord"],n["Data.Ordering"],n["Data.Semigroup"],n["Data.Show"],n["Data.Traversable"],n["Data.TraversableWithIndex"],n["Data.Unit"],n.Prelude,function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}()),f=function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}(),l=new i.Functor(function(n){return function(t){if(t instanceof c)return new c(t.value0);if(t instanceof f)return new f(n(t.value0));throw new Error("Failed pattern match at Data.Either (line 38, column 8 - line 38, column 52): "+[t.constructor.name])}}),s=function(n){return function(t){return function(r){if(r instanceof c)return n(r.value0);if(r instanceof f)return t(r.value0);throw new Error("Failed pattern match at Data.Either (line 238, column 1 - line 238, column 64): "+[n.constructor.name,t.constructor.name,r.constructor.name])}}},d=new e.Apply(function(){return l},function(n){return function(t){if(n instanceof c)return new c(n.value0);if(n instanceof f)return i.map(l)(n.value0)(t);throw new Error("Failed pattern match at Data.Either (line 82, column 1 - line 82, column 41): "+[n.constructor.name,t.constructor.name])}}),D=new a.Bind(function(){return d},s(function(n){return function(t){return new c(n)}})(function(n){return function(t){return t(n)}})),p=new r.Applicative(function(){return d},f.create),h=new o.Monad(function(){return p},function(){return D});t.Left=c,t.Right=f,t.either=s,t.note=function(n){return u.maybe(new c(n))(f.create)},t.functorEither=l,t.applyEither=d,t.applicativeEither=p,t.bindEither=D,t.monadEither=h}(n["Data.Either"]=n["Data.Either"]||{}),function(t){"use strict";(n["Partial.Unsafe"]=n["Partial.Unsafe"]||{}).unsafePartial=function(n){return n()}}(),function(t){"use strict";(n["Partial"]=n["Partial"]||{}).crashWith=function(){return function(n){throw new Error(n)}}}(),function(t){"use strict";var r=n.Partial;t.crashWith=r.crashWith}(n.Partial=n.Partial||{}),function(t){"use strict";var r=n["Partial.Unsafe"],e=n.Partial;t.unsafeCrashWith=function(n){return r.unsafePartial(function(t){return e.crashWith(t)(n)})}}(n["Partial.Unsafe"]=n["Partial.Unsafe"]||{}),function(t){"use strict";n["Control.Applicative"],n["Control.Bind"],n["Control.Monad"],n["Control.Semigroupoid"],n["Data.Bifunctor"];var r=n["Data.Either"],e=(n["Data.Functor"],n["Data.Identity"],n["Data.Maybe"],n["Data.Unit"],n.Effect,n["Effect.Ref"],n["Partial.Unsafe"],n.Prelude,function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}()),a=function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}(),o=function(n,t){this.Monad0=n,this.tailRecM=t},i=function(n){return n.tailRecM},u=function(n){return function(t){return function(t){var r,o=!1;function i(r){if(!(r instanceof e)){if(r instanceof a)return o=!0,r.value0;throw new Error("Failed pattern match at Control.Monad.Rec.Class (line 91, column 3 - line 91, column 25): "+[r.constructor.name])}t=n(r.value0)}for(;!o;)r=i(t);return r}(n(t))}},c=new o(function(){return r.monadEither},function(n){return function(t){return u(function(t){if(t instanceof r.Left)return new a(new r.Left(t.value0));if(t instanceof r.Right&&t.value0 instanceof e)return new e(n(t.value0.value0));if(t instanceof r.Right&&t.value0 instanceof a)return new a(new r.Right(t.value0.value0));throw new Error("Failed pattern match at Control.Monad.Rec.Class (line 119, column 7 - line 119, column 33): "+[t.constructor.name])})(n(t))}});t.Loop=e,t.Done=a,t.MonadRec=o,t.tailRec=u,t.tailRecM=i,t.tailRecM2=function(n){return function(t){return function(r){return function(e){return i(n)(function(n){return t(n.a)(n.b)})({a:r,b:e})}}}},t.monadRecEither=c}(n["Control.Monad.Rec.Class"]=n["Control.Monad.Rec.Class"]||{}),function(n){"use strict";n.length=function(n){return n.length},n.indexImpl=function(n){return function(t){return function(r){return function(e){return e<0||e>=r.length?t:n(r[e])}}}},n.findIndexImpl=function(n){return function(t){return function(r){return function(e){for(var a=0,o=e.length;a<o;a++)if(r(e[a]))return n(a);return t}}}},n.filter=function(n){return function(t){return t.filter(n)}},n.slice=function(n){return function(t){return function(r){return r.slice(n,t)}}},n.drop=function(n){return function(t){return n<1?t:t.slice(n)}},n.unsafeIndexImpl=function(n){return function(t){return n[t]}}}(n["Data.Array"]=n["Data.Array"]||{}),function(t){"use strict";(n["Unsafe.Coerce"]=n["Unsafe.Coerce"]||{}).unsafeCoerce=function(n){return n}}(),function(t){"use strict";var r=n["Unsafe.Coerce"];t.unsafeCoerce=r.unsafeCoerce}(n["Unsafe.Coerce"]=n["Unsafe.Coerce"]||{}),function(t){"use strict";var r=n["Data.Array"],e=(n["Control.Alt"],n["Control.Alternative"],n["Control.Applicative"]),a=(n["Control.Apply"],n["Control.Bind"]),o=(n["Control.Category"],n["Control.Lazy"],n["Control.Monad.Rec.Class"]),i=(n["Control.Monad.ST"],n["Control.Monad.ST.Internal"],n["Control.Semigroupoid"],n["Data.Array.NonEmpty.Internal"],n["Data.Array.ST"],n["Data.Array.ST.Iterator"],n["Data.Boolean"]),u=n["Data.Eq"],c=(n["Data.Foldable"],n["Data.Function"]),f=(n["Data.Functor"],n["Data.HeytingAlgebra"],n["Data.Maybe"]),l=(n["Data.Ord"],n["Data.Ordering"],n["Data.Ring"],n["Data.Semigroup"],n["Data.Semiring"],n["Data.Traversable"],n["Data.Tuple"],n["Data.Unfoldable"],n["Partial.Unsafe"],n.Prelude,n["Unsafe.Coerce"],function(n){return r.unsafeIndexImpl}),s=function(n){return[n]},d=r.indexImpl(f.Just.create)(f.Nothing.value),D=r.findIndexImpl(f.Just.create)(f.Nothing.value),p=function(n){return function(t){return function(e){return r.filter(function(t){return f.isJust(D(n(t))(e))})(t)}}},h=c.flip(a.bind(a.bindArray));t.singleton=s,t.head=function(n){return d(n)(0)},t.index=d,t.findIndex=D,t.concatMap=h,t.mapMaybe=function(n){return h(function(t){return f.maybe([])(s)(n(t))})},t.intersect=function(n){return p(u.eq(n))},t.intersectBy=p,t.foldRecM=function(n){return function(t){return function(u){return function(c){return o.tailRecM2(n)(function(u){return function(f){if(f>=r.length(c))return e.pure(n.Monad0().Applicative0())(new o.Done(u));if(i.otherwise)return a.bind(n.Monad0().Bind1())(t(u)(l()(c)(f)))(function(t){return e.pure(n.Monad0().Applicative0())(new o.Loop({a:t,b:f+1|0}))});throw new Error("Failed pattern match at Data.Array (line 1099, column 3 - line 1103, column 42): "+[u.constructor.name,f.constructor.name])}})(u)(0)}}}},t.unsafeIndex=l,t.length=r.length,t.drop=r.drop}(n["Data.Array"]=n["Data.Array"]||{}),function(t){"use strict";(n["Data.Int"]=n["Data.Int"]||{}).fromStringAsImpl=function(n){return function(t){return function(r){var e;e=r<11?"[0-"+(r-1).toString()+"]":11===r?"[0-9a]":"[0-9a-"+String.fromCharCode(86+r)+"]";var a=new RegExp("^[\\+\\-]?"+e+"+$","i");return function(e){if(a.test(e)){var o=parseInt(e,r);return(0|o)===o?n(o):t}return t}}}}}(),function(t){"use strict";var r=n["Data.Int"],e=(n["Control.Category"],n["Control.Semigroupoid"],n["Data.Boolean"],n["Data.Bounded"],n["Data.CommutativeRing"],n["Data.DivisionRing"],n["Data.Eq"],n["Data.EuclideanRing"],n["Data.HeytingAlgebra"],n["Data.Int.Bits"],n["Data.Maybe"]),a=(n["Data.Ord"],n["Data.Ordering"],n["Data.Ring"],n["Data.Semiring"],n["Data.Show"],n.Global,n.Math,n.Prelude,r.fromStringAsImpl(e.Just.create)(e.Nothing.value)),o=a(10);t.fromString=o,t.fromStringAs=a}(n["Data.Int"]=n["Data.Int"]||{}),function(n){"use strict";n.split=function(n){return function(t){return t.split(n)}},n.trim=function(n){return n.trim()}}(n["Data.String.Common"]=n["Data.String.Common"]||{}),function(t){"use strict";var r=n["Data.String.Common"];n["Data.Eq"],n["Data.Ordering"],n["Data.String.Pattern"],n.Prelude;t.split=r.split,t.trim=r.trim}(n["Data.String.Common"]=n["Data.String.Common"]||{}),function(t){"use strict";var r=n["Control.Applicative"],e=n["Control.Bind"],a=n["Control.Monad.Rec.Class"],o=n["Data.Array"],i=n["Data.Either"],u=n["Data.Eq"],c=n["Data.Int"],f=n["Data.Maybe"],l=n["Data.Show"],s=(n["Data.String"],n["Data.String.Common"]),d=(n["Data.String.Pattern"],n["Partial.Unsafe"]);n.Prelude;t.solve=function(n){var t=function(n){var t=s.split("\n")(s.trim(n));return e.bind(i.bindEither)(i.note("n m line")(o.head(t)))(function(n){return e.bind(i.bindEither)(2===(d=s.split(" ")(n)).length?e.bind(i.bindEither)(i.note("n")(c.fromString(d[0])))(function(n){return e.bind(i.bindEither)(i.note("m")(c.fromString(d[1])))(function(t){return r.pure(i.applicativeEither)({n:n,m:t})})}):new i.Left("n m"))(function(n){var d=o.drop(1)(t);return e.bind(i.bindEither)(o.foldRecM(a.monadRecEither)(function(n){return function(t){var a=o.mapMaybe(c.fromString)(s.split(" ")(t));return e.bind(i.bindEither)(i.note("k")(o.head(a)))(function(t){var e=o.drop(1)(a);return r.pure(i.applicativeEither)(new f.Just(f.maybe(e)(o.intersect(u.eqInt)(e))(n)))})}})(f.Nothing.value)(d))(function(n){return e.bind(i.bindEither)(i.note("as")(n))(function(n){return r.pure(i.applicativeEither)(l.show(l.showInt)(o.length(n)))})})});var d})}(n);if(t instanceof i.Left)return d.unsafeCrashWith(t.value0);if(t instanceof i.Right)return t.value0;throw new Error("Failed pattern match at AtCoder.ABC118.B (line 18, column 3 - line 20, column 17): "+[t.constructor.name])}}(n["AtCoder.ABC118.B"]=n["AtCoder.ABC118.B"]||{}),function(t){"use strict";(n["Effect.Console"]=n["Effect.Console"]||{}).log=function(n){return function(){return console.log(n),{}}}}(),function(t){"use strict";var r=n["Effect.Console"];n["Data.Show"],n["Data.Unit"],n.Effect;t.log=r.log}(n["Effect.Console"]=n["Effect.Console"]||{}),function(t){"use strict";n["Node.Encoding"];var r=n["Data.Show"],e=(n.Prelude,function(){function n(){}return n.value=new n,n}()),a=function(){function n(){}return n.value=new n,n}(),o=function(){function n(){}return n.value=new n,n}(),i=function(){function n(){}return n.value=new n,n}(),u=function(){function n(){}return n.value=new n,n}(),c=function(){function n(){}return n.value=new n,n}(),f=function(){function n(){}return n.value=new n,n}(),l=function(){function n(){}return n.value=new n,n}(),s=new r.Show(function(n){if(n instanceof e)return"ASCII";if(n instanceof a)return"UTF8";if(n instanceof o)return"UTF16LE";if(n instanceof i)return"UCS2";if(n instanceof u)return"Base64";if(n instanceof c)return"Latin1";if(n instanceof f)return"Binary";if(n instanceof l)return"Hex";throw new Error("Failed pattern match at Node.Encoding (line 19, column 1 - line 19, column 39): "+[n.constructor.name])});t.ASCII=e,t.UTF8=a,t.UTF16LE=o,t.UCS2=i,t.Base64=u,t.Latin1=c,t.Binary=f,t.Hex=l,t.showEncoding=s}(n["Node.Encoding"]=n["Node.Encoding"]||{}),function(t){"use strict";(n["Node.FS.Internal"]=n["Node.FS.Internal"]||{}).unsafeRequireFS=require("fs")}(),function(t){"use strict";var r=n["Node.FS.Internal"],e=(n.Effect,n.Prelude,n["Unsafe.Coerce"].unsafeCoerce);t.mkEffect=e,t.unsafeRequireFS=r.unsafeRequireFS}(n["Node.FS.Internal"]=n["Node.FS.Internal"]||{}),function(t){"use strict";n["Control.Bind"],n["Control.Semigroupoid"],n["Data.DateTime"],n["Data.DateTime.Instant"],n["Data.EuclideanRing"],n["Data.Function"],n["Data.Function.Uncurried"],n["Data.Functor"],n["Data.Int"],n["Data.Maybe"],n["Data.Nullable"];var r=n["Data.Show"],e=(n["Data.Time.Duration"],n.Effect,n["Node.Buffer"],n["Node.Encoding"]),a=(n["Node.FS"],n["Node.FS.Internal"]),o=(n["Node.FS.Perms"],n["Node.FS.Stats"],n["Node.Path"],n.Prelude,a.unsafeRequireFS);t.readTextFile=function(n){return function(t){return a.mkEffect(function(a){return o.readFileSync(t,{encoding:r.show(e.showEncoding)(n)})})}}}(n["Node.FS.Sync"]=n["Node.FS.Sync"]||{}),function(t){"use strict";var r=n["AtCoder.ABC118.B"],e=(n["Control.Applicative"],n["Control.Bind"],n.Effect,n["Effect.Console"]),a=n["Node.Encoding"],o=n["Node.FS.Sync"];n.Prelude;t.main=function(){var n=o.readTextFile(a.UTF8.value)("/dev/stdin")(),t=r.solve(n);return e.log(t)()}}(n.Main=n.Main||{}),n.Main.main();
},{}]},{},["Focm"], null)