Problem:
Score : 300 points

Problem Statement

Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:

Throw the die. The current score is the result of the die.

As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.

The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.

You are given N and K. Find the probability that Snuke wins the game.

Constraints

1 ≤ N ≤ 10^5

1 ≤ K ≤ 10^5

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K

Output

Print the probability that Snuke wins the game. The output is considered correct when the absolute or relative error is at most 10^{-9}.

Sample Input 1

3 10

Sample Output 1

0.145833333333

If the die shows 1, Snuke needs to get four consecutive heads from four coin flips to obtain a score of 10 or above. The probability of this happening is \frac{1}{3} \times (\frac{1}{2})^4 = \frac{1}{48}.

If the die shows 2, Snuke needs to get three consecutive heads from three coin flips to obtain a score of 10 or above. The probability of this happening is \frac{1}{3} \times (\frac{1}{2})^3 = \frac{1}{24}.

If the die shows 3, Snuke needs to get two consecutive heads from two coin flips to obtain a score of 10 or above. The probability of this happening is \frac{1}{3} \times (\frac{1}{2})^2 = \frac{1}{12}.

Thus, the probability that Snuke wins is \frac{1}{48} + \frac{1}{24} + \frac{1}{12} = \frac{7}{48} \simeq 0.1458333333.

Sample Input 2

100000 5

Sample Output 2

0.999973749998

Solution in JavaScript (node.js v5.12) (judge verdict: Wrong Answer)

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,u=new Array(r*e),i=0,o=0;o<r;o++)for(var a=n[o],f=0;f<e;f++)u[i++]=a(t[f]);return u}}}(),function(n){"use strict";n["Control.Semigroupoid"]=n["Control.Semigroupoid"]||{};var t=n["Control.Semigroupoid"],r=function(n){this.compose=n},e=new r(function(n){return function(t){return function(r){return n(t(r))}}});t.compose=function(n){return n.compose},t.Semigroupoid=r,t.semigroupoidFn=e}(n),function(n){"use strict";n["Control.Category"]=n["Control.Category"]||{};var t=n["Control.Category"],r=n["Control.Semigroupoid"],e=function(n,t){this.Semigroupoid0=n,this.identity=t},u=new e(function(){return r.semigroupoidFn},function(n){return n});t.Category=e,t.identity=function(n){return n.identity},t.categoryFn=u}(n),function(n){"use strict";n["Data.Function"]=n["Data.Function"]||{};var t=n["Data.Function"];t.flip=function(n){return function(t){return function(r){return n(r)(t)}}},t.const=function(n){return function(t){return n}}}(n),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),u=0;u<r;u++)e[u]=n(t[u]);return e}}}(),function(t){"use strict";(n["Data.Unit"]=n["Data.Unit"]||{}).unit={}}(),function(n){"use strict";n["Data.Unit"]=n["Data.Unit"]||{};var t=n["Data.Unit"],r=n["Data.Unit"];t.unit=r.unit}(n),function(n){"use strict";n["Data.Functor"]=n["Data.Functor"]||{};var t=n["Data.Functor"],r=n["Data.Functor"],e=n["Data.Function"],u=n["Data.Unit"],i=function(n){this.map=n},o=function(n){return n.map},a=new i(r.arrayMap);t.Functor=i,t.map=o,t.void=function(n){return o(n)(e.const(u.unit))},t.functorArray=a}(n),function(n){"use strict";n["Control.Apply"]=n["Control.Apply"]||{};var t=n["Control.Apply"],r=n["Control.Apply"],e=n["Control.Category"],u=n["Data.Function"],i=n["Data.Functor"],o=function(n,t){this.Functor0=n,this.apply=t},a=new o(function(){return i.functorArray},r.arrayApply),f=function(n){return n.apply};t.Apply=o,t.apply=f,t.applySecond=function(n){return function(t){return function(r){return f(n)(i.map(n.Functor0())(u.const(e.identity(e.categoryFn)))(t))(r)}}},t.applyArray=a}(n),function(n){"use strict";n["Control.Applicative"]=n["Control.Applicative"]||{};var t=n["Control.Applicative"],r=n["Control.Apply"],e=function(n){return n.pure};t.Applicative=function(n,t){this.Apply0=n,this.pure=t},t.pure=e,t.liftA1=function(n){return function(t){return function(u){return r.apply(n.Apply0())(e(n)(t))(u)}}}}(n),function(t){"use strict";(n["Control.Bind"]=n["Control.Bind"]||{}).arrayBind=function(n){return function(t){for(var r=[],e=0,u=n.length;e<u;e++)Array.prototype.push.apply(r,t(n[e]));return r}}}(),function(n){"use strict";n["Control.Bind"]=n["Control.Bind"]||{};var t=n["Control.Bind"],r=n["Control.Bind"],e=n["Control.Apply"],u=n["Data.Function"],i=function(n,t){this.Apply0=n,this.bind=t},o=new i(function(){return e.applyArray},r.arrayBind),a=function(n){return n.bind},f=function(n){return u.flip(a(n))};t.Bind=i,t.bind=a,t.bindFlipped=f,t.composeKleisliFlipped=function(n){return function(t){return function(r){return function(e){return f(n)(t)(r(e))}}}},t.bindArray=o}(n),function(n){"use strict";n.map_=function(n){return function(t){return function(){return n(t())}}},n.for=function(n){return function(t){return function(r){return function(){for(var e=n;e<t;e++)r(e)()}}}},n["modify'"]=function(n){return function(t){return function(){var r=n(t.value);return t.value=r.state,r.value}}}}(n["Control.Monad.ST.Internal"]=n["Control.Monad.ST.Internal"]||{}),function(n){"use strict";n["Control.Monad.ST.Internal"]=n["Control.Monad.ST.Internal"]||{};var t=n["Control.Monad.ST.Internal"],r=n["Control.Monad.ST.Internal"],e=new n["Data.Functor"].Functor(r.map_);t.modify=function(n){return r["modify'"](function(t){var r=n(t);return{state:r,value:r}})},t.functorST=e,t.for=r.for}(n),function(n){"use strict";n["Data.Maybe"]=n["Data.Maybe"]||{};var t=n["Data.Maybe"],r=function(){function n(){}return n.value=new n,n}(),e=function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}();t.Nothing=r,t.Just=e,t.maybe=function(n){return function(t){return function(u){if(u instanceof r)return n;if(u instanceof e)return t(u.value0);throw new Error("Failed pattern match at Data.Maybe (line 217, column 1 - line 217, column 51): "+[n.constructor.name,t.constructor.name,u.constructor.name])}}},t.fromJust=function(n){return function(n){if(n instanceof e)return n.value0;throw new Error("Failed pattern match at Data.Maybe (line 268, column 1 - line 268, column 46): "+[n.constructor.name])}}}(n),function(n){"use strict";n["Data.Array"]=n["Data.Array"]||{};var t=n["Data.Array"],r=n["Control.Bind"],e=n["Data.Function"],u=n["Data.Maybe"],i=function(n){return[n]},o=e.flip(r.bind(r.bindArray));t.singleton=i,t.concatMap=o,t.mapMaybe=function(n){return o(function(t){return u.maybe([])(i)(n(t))})}}(n),function(n){"use strict";n["Data.Either"]=n["Data.Either"]||{};var t=n["Data.Either"],r=n["Control.Applicative"],e=n["Control.Apply"],u=n["Control.Bind"],i=n["Data.Functor"],o=n["Data.Maybe"],a=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}(),c=new i.Functor(function(n){return function(t){if(t instanceof a)return new a(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])}}),l=function(n){return function(t){return function(r){if(r instanceof a)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])}}},s=new e.Apply(function(){return c},function(n){return function(t){if(n instanceof a)return new a(n.value0);if(n instanceof f)return i.map(c)(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])}}),p=new u.Bind(function(){return s},l(function(n){return function(t){return new a(n)}})(function(n){return function(t){return t(n)}})),d=new r.Applicative(function(){return s},f.create);t.Left=a,t.Right=f,t.either=l,t.note=function(n){return o.maybe(new a(n))(f.create)},t.functorEither=c,t.applyEither=s,t.applicativeEither=d,t.bindEither=p}(n),function(n){"use strict";n.intDegree=function(n){return Math.min(Math.abs(n),2147483647)},n.intDiv=function(n){return function(t){return 0===t?0:t>0?Math.floor(n/t):-Math.floor(n/-t)}},n.intMod=function(n){return function(t){if(0===t)return 0;var r=Math.abs(t);return(n%r+r)%r}}}(n["Data.EuclideanRing"]=n["Data.EuclideanRing"]||{}),function(t){"use strict";(n["Data.Ring"]=n["Data.Ring"]||{}).intSub=function(n){return function(t){return n-t|0}}}(),function(n){"use strict";n.intAdd=function(n){return function(t){return n+t|0}},n.intMul=function(n){return function(t){return n*t|0}},n.numAdd=function(n){return function(t){return n+t}},n.numMul=function(n){return function(t){return n*t}}}(n["Data.Semiring"]=n["Data.Semiring"]||{}),function(n){"use strict";n["Data.Semiring"]=n["Data.Semiring"]||{};var t=n["Data.Semiring"],r=n["Data.Semiring"],e=function(n,t,r,e){this.add=n,this.mul=t,this.one=r,this.zero=e},u=new e(r.numAdd,r.numMul,1,0),i=new e(r.intAdd,r.intMul,1,0);t.Semiring=e,t.add=function(n){return n.add},t.zero=function(n){return n.zero},t.mul=function(n){return n.mul},t.one=function(n){return n.one},t.semiringInt=i,t.semiringNumber=u}(n),function(n){"use strict";n["Data.Ring"]=n["Data.Ring"]||{};var t=n["Data.Ring"],r=n["Data.Ring"],e=n["Data.Semiring"],u=function(n,t){this.Semiring0=n,this.sub=t},i=new u(function(){return e.semiringInt},r.intSub);t.Ring=u,t.sub=function(n){return n.sub},t.ringInt=i}(n),function(n){"use strict";n["Data.CommutativeRing"]=n["Data.CommutativeRing"]||{};var t=n["Data.CommutativeRing"],r=n["Data.Ring"],e=function(n){this.Ring0=n},u=new e(function(){return r.ringInt});t.CommutativeRing=e,t.commutativeRingInt=u}(n),function(n){"use strict";n["Data.EuclideanRing"]=n["Data.EuclideanRing"]||{};var t=n["Data.EuclideanRing"],r=n["Data.EuclideanRing"],e=n["Data.CommutativeRing"],u=function(n,t,r,e){this.CommutativeRing0=n,this.degree=t,this.div=r,this.mod=e},i=new u(function(){return e.commutativeRingInt},r.intDegree,r.intDiv,r.intMod);t.EuclideanRing=u,t.degree=function(n){return n.degree},t.div=function(n){return n.div},t.mod=function(n){return n.mod},t.euclideanRingInt=i}(n),function(n){"use strict";n.fromNumberImpl=function(n){return function(t){return function(r){return(0|r)===r?n(r):t}}},n.toNumber=function(n){return n},n.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 u=new RegExp("^[\\+\\-]?"+e+"+$","i");return function(e){if(u.test(e)){var i=parseInt(e,r);return(0|i)===i?n(i):t}return t}}}}}(n["Data.Int"]=n["Data.Int"]||{}),function(n){"use strict";n["Data.Int"]=n["Data.Int"]||{};var t=n["Data.Int"],r=n["Data.Int"],e=n["Data.Maybe"],u=r.fromStringAsImpl(e.Just.create)(e.Nothing.value),i=u(10),o=r.fromNumberImpl(e.Just.create)(e.Nothing.value);t.fromNumber=o,t.fromString=i,t.fromStringAs=u,t.toNumber=r.toNumber}(n),function(n){"use strict";n["Data.Monoid"]=n["Data.Monoid"]||{};var t=n["Data.Monoid"];t.Monoid=function(n,t){this.Semigroup0=n,this.mempty=t},t.mempty=function(n){return n.mempty}}(n),function(t){"use strict";(n["Data.Show"]=n["Data.Show"]||{}).showNumberImpl=function(n){var t=n.toString();return isNaN(t+".0")?t:t+".0"}}(),function(n){"use strict";n["Data.Show"]=n["Data.Show"]||{};var t=n["Data.Show"],r=function(n){this.show=n},e=new r(n["Data.Show"].showNumberImpl);t.Show=r,t.show=function(n){return n.show},t.showNumber=e}(n),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(n){"use strict";n["Data.String.Common"]=n["Data.String.Common"]||{};var t=n["Data.String.Common"],r=n["Data.String.Common"];t.split=r.split,t.trim=r.trim}(n),function(n){"use strict";n["Data.Tuple"]=n["Data.Tuple"]||{};var t=n["Data.Tuple"],r=function(){function n(n,t){this.value0=n,this.value1=t}return n.create=function(t){return function(r){return new n(t,r)}},n}();t.Tuple=r}(n),function(n){"use strict";n.pureE=function(n){return function(){return n}},n.bindE=function(n){return function(t){return function(){return t(n())()}}}}(n.Effect=n.Effect||{}),function(n){"use strict";n["Control.Monad"]=n["Control.Monad"]||{};var t=n["Control.Monad"],r=n["Control.Applicative"],e=n["Control.Bind"];t.Monad=function(n,t){this.Applicative0=n,this.Bind1=t},t.ap=function(n){return function(t){return function(u){return e.bind(n.Bind1())(t)(function(t){return e.bind(n.Bind1())(u)(function(e){return r.pure(n.Applicative0())(t(e))})})}}}}(n),function(n){"use strict";n.Effect=n.Effect||{};var t=n.Effect,r=n.Effect,e=n["Control.Applicative"],u=n["Control.Apply"],i=n["Control.Bind"],o=n["Control.Monad"],a=n["Data.Functor"],f=new o.Monad(function(){return s},function(){return c}),c=new i.Bind(function(){return l},r.bindE),l=new u.Apply(function(){return p},o.ap(f)),s=new e.Applicative(function(){return l},r.pureE),p=new a.Functor(e.liftA1(s));t.functorEffect=p,t.applyEffect=l,t.applicativeEffect=s,t.bindEffect=c,t.monadEffect=f}(n),function(n){"use strict";var t=function(){var n={},t="Pure",r="Throw",e="Catch",u="Sync",i="Async",o="Bind",a="Bracket",f="Fork",c="Sequential",l="Map",s="Apply",p="Alt",d="Cons",m="Resume",h="Release",v="Finalizer",w="Finalized",g="Forked";function C(n,t,r,e){this.tag=n,this._1=t,this._2=r,this._3=e}function D(n){var t=function(t,r,e){return new C(n,t,r,e)};return t.tag=n,t}function E(n){return new C(t,void 0)}function y(n){try{n()}catch(t){setTimeout(function(){throw t},0)}}function A(n,t,r){try{return t(r())}catch(e){return n(e)}}function _(n,t,r){try{return t(r)()}catch(e){return r(n(e))(),E}}var b=function(){var n=1024,t=0,r=0,e=new Array(n),u=!1;function i(){var i;for(u=!0;0!==t;)t--,i=e[r],e[r]=void 0,r=(r+1)%n,i();u=!1}return{isDraining:function(){return u},enqueue:function(o){var a;t===n&&(a=u,i(),u=a),e[(r+t)%n]=o,t++,u||i()}}}();var S=0,F=1,M=2,P=3,N=4,R=5,k=6;function B(n,l,s){var p=0,g=S,D=s,E=null,I=null,L=null,T=null,x=null,q=0,W=0,J=null,O=!0;function z(s){for(var W,K,H;;)switch(W=null,K=null,H=null,g){case M:g=F,D=L(D),null===T?L=null:(L=T._1,T=T._2);break;case P:n.isLeft(D)?(g=R,E=D,D=null):null===L?g=R:(g=M,D=n.fromRight(D));break;case F:switch(D.tag){case o:L&&(T=new C(d,L,T)),L=D._2,g=F,D=D._1;break;case t:null===L?(g=R,D=n.right(D._1)):(g=M,D=D._1);break;case u:g=P,D=A(n.left,n.right,D._1);break;case i:return g=N,void(D=_(n.left,D._1,function(n){return function(){p===s&&(p++,b.enqueue(function(){p===s+1&&(g=P,D=n,z(p))}))}}));case r:g=R,E=n.left(D._1),D=null;break;case e:x=new C(d,D,null===L?x:new C(d,new C(m,L,T),x,I),I),L=null,T=null,g=F,D=D._1;break;case a:q++,x=new C(d,D,null===L?x:new C(d,new C(m,L,T),x,I),I),L=null,T=null,g=F,D=D._1;break;case f:g=P,W=B(n,l,D._2),l&&l.register(W),D._1&&W.run(),D=n.right(W);break;case c:g=F,D=U(n,l,D._1)}break;case R:if(L=null,T=null,null===x)g=k,D=I||E||D;else switch(W=x._3,H=x._1,x=x._2,H.tag){case e:I&&I!==W?g=R:E&&(g=F,D=H._2(n.fromLeft(E)),E=null);break;case m:I&&I!==W||E?g=R:(L=H._1,T=H._2,g=M,D=n.fromRight(D));break;case a:q--,null===E&&(K=n.fromRight(D),x=new C(d,new C(h,H._2,K),x,W),(I===W||q>0)&&(g=F,D=H._3(K)));break;case h:q++,x=new C(d,new C(w,D,E),x,I),g=F,D=I&&I!==W?H._1.killed(n.fromLeft(I))(H._2):E?H._1.failed(n.fromLeft(E))(H._2):H._1.completed(n.fromRight(D))(H._2),E=null;break;case v:q++,x=new C(d,new C(w,D,E),x,I),g=F,D=H._1;break;case w:q--,g=R,D=H._1,E=H._2}break;case k:for(var j in J)J.hasOwnProperty(j)&&(O=O&&J[j].rethrow,y(J[j].handler(D)));return J=null,void(I&&E?setTimeout(function(){throw n.fromLeft(E)},0):n.isLeft(D)&&O&&setTimeout(function(){if(O)throw n.fromLeft(D)},0));case S:g=F;break;case N:return}}function K(n){return function(){if(g===k)return O=O&&n.rethrow,n.handler(D)(),function(){};var t=W++;return(J=J||{})[t]=n,function(){null!==J&&delete J[t]}}}return{kill:function(t,r){return function(){if(g===k)return r(n.right(void 0))(),function(){};var e=K({rethrow:!1,handler:function(){return r(n.right(void 0))}})();switch(g){case S:I=n.left(t),g=k,D=I,z(p);break;case N:null===I&&(I=n.left(t)),0===q&&(g===N&&(x=new C(d,new C(v,D(t)),x,I)),g=R,D=null,E=null,z(++p));break;default:null===I&&(I=n.left(t)),0===q&&(g=R,D=null,E=null)}return e}},join:function(n){return function(){var t=K({rethrow:!1,handler:n})();return g===S&&z(p),t}},onComplete:K,isSuspended:function(){return g===S},run:function(){g===S&&(b.isDraining()?z(p):b.enqueue(function(){z(p)}))}}}function I(t,r,e,u){var o=0,a={},f=0,c={},m=new Error("[ParAff] Early exit"),h=null,v=n;function w(r,e,u){var i,o,f=e,c=null,m=null,h=0,v={};n:for(;;)switch(i=null,f.tag){case g:if(f._3===n&&(i=a[f._1],v[h++]=i.kill(r,function(n){return function(){0===--h&&u(n)()}})),null===c)break n;f=c._2,null===m?c=null:(c=m._1,m=m._2);break;case l:f=f._2;break;case s:case p:c&&(m=new C(d,c,m)),c=f,f=f._1}if(0===h)u(t.right(void 0))();else for(o=0,i=h;o<i;o++)v[o]=v[o]();return v}function D(r){return function(e){return function(){delete a[r._1],r._3=e,function r(e,i,o){var a,d,v,g,C,D;for(t.isLeft(e)?(a=e,d=null):(d=e,a=null);;){if(v=null,g=null,C=null,D=null,null!==h)return;if(null===i)return void u(a||d)();if(i._3!==n)return;switch(i.tag){case l:null===a?(i._3=t.right(i._1(t.fromRight(d))),d=i._3):i._3=a;break;case s:if(v=i._1._3,g=i._2._3,a){if(i._3=a,C=!0,D=f++,c[D]=w(m,a===v?i._2:i._1,function(){return function(){delete c[D],C?C=!1:null===o?r(a,null,null):r(a,o._1,o._2)}}),C)return void(C=!1)}else{if(v===n||g===n)return;d=t.right(t.fromRight(v)(t.fromRight(g))),i._3=d}break;case p:if(v=i._1._3,g=i._2._3,v===n&&t.isLeft(g)||g===n&&t.isLeft(v))return;if(v!==n&&t.isLeft(v)&&g!==n&&t.isLeft(g))a=d===v?g:v,d=null,i._3=a;else if(i._3=d,C=!0,D=f++,c[D]=w(m,d===v?i._2:i._1,function(){return function(){delete c[D],C?C=!1:null===o?r(d,null,null):r(d,o._1,o._2)}}),C)return void(C=!1)}null===o?i=null:(i=o._1,o=o._2)}}(e,r._2._1,r._2._2)}}}return function(){var u,i,f=F,c=e,m=null,h=null;n:for(;;)switch(u=null,i=null,f){case F:switch(c.tag){case l:m&&(h=new C(d,m,h)),m=new C(l,c._1,n,n),c=c._2;break;case s:m&&(h=new C(d,m,h)),m=new C(s,n,c._2,n),c=c._1;break;case p:m&&(h=new C(d,m,h)),m=new C(p,n,c._2,n),c=c._1;break;default:i=o++,f=R,u=c,c=new C(g,i,new C(d,m,h),n),(u=B(t,r,u)).onComplete({rethrow:!1,handler:D(c)})(),a[i]=u,r&&r.register(u)}break;case R:if(null===m)break n;m._1===n?(m._1=c,f=F,c=m._2,m._2=n):(m._2=c,c=m,null===h?m=null:(m=h._1,h=h._2))}for(v=c,i=0;i<o;i++)a[i].run()}(),function(n){return new C(i,function(r){return function(){return function(n,r){var e;for(var u in h=t.left(n),c)if(c.hasOwnProperty(u))for(u in e=c[u])e.hasOwnProperty(u)&&e[u]();c=null;var o=w(n,v,r);return function(n){return new C(i,function(n){return function(){for(var n in o)o.hasOwnProperty(n)&&o[n]();return E}})}}(n,r)}})}}function U(n,t,r){return new C(i,function(e){return function(){return I(n,t,r,e)}})}return C.EMPTY=n,C.Pure=D(t),C.Throw=D(r),C.Catch=D(e),C.Sync=D(u),C.Async=D(i),C.Bind=D(o),C.Bracket=D(a),C.Fork=D(f),C.Seq=D(c),C.ParMap=D(l),C.ParApply=D(s),C.ParAlt=D(p),C.Fiber=B,C.Supervisor=function(n){var t={},r=0,e=0;return{register:function(n){var u=r++;n.onComplete({rethrow:!0,handler:function(n){return function(){e--,delete t[u]}}}),t[u]=n,e++},isEmpty:function(){return 0===e},killAll:function(i,o){return function(){var a=0,f={};function c(r){f[r]=t[r].kill(i,function(t){return function(){delete f[r],a--,n.isLeft(t)&&n.fromLeft(t)&&setTimeout(function(){throw n.fromLeft(t)},0),0===a&&o()}})()}for(var l in t)t.hasOwnProperty(l)&&(a++,c(l));return t={},r=0,e=0,function(n){return new C(u,function(){for(var n in f)f.hasOwnProperty(n)&&f[n]()})}}}}},C.Scheduler=b,C.nonCanceler=E,C}();n._pure=t.Pure,n._map=function(n){return function(r){return r.tag===t.Pure.tag?t.Pure(n(r._1)):t.Bind(r,function(r){return t.Pure(n(r))})}},n._bind=function(n){return function(r){return t.Bind(n,r)}},n._liftEffect=t.Sync,n._parAffMap=function(n){return function(r){return t.ParMap(n,r)}},n._parAffApply=function(n){return function(r){return t.ParApply(n,r)}},n.makeAff=t.Async,n._makeFiber=function(n,r){return function(){return t.Fiber(n,null,r)}},n._sequential=t.Seq}(n["Effect.Aff"]=n["Effect.Aff"]||{}),function(n){"use strict";n["Control.Parallel.Class"]=n["Control.Parallel.Class"]||{};var t=n["Control.Parallel.Class"];t.parallel=function(n){return n.parallel},t.sequential=function(n){return n.sequential},t.Parallel=function(n,t,r,e){this.Applicative1=n,this.Monad0=t,this.parallel=r,this.sequential=e}}(n),function(n){"use strict";n.foldrArray=function(n){return function(t){return function(r){for(var e=t,u=r.length-1;u>=0;u--)e=n(r[u])(e);return e}}},n.foldlArray=function(n){return function(t){return function(r){for(var e=t,u=r.length,i=0;i<u;i++)e=n(e)(r[i]);return e}}}}(n["Data.Foldable"]=n["Data.Foldable"]||{}),function(n){"use strict";n["Data.Semigroup"]=n["Data.Semigroup"]||{};var t=n["Data.Semigroup"];t.Semigroup=function(n){this.append=n},t.append=function(n){return n.append}}(n),function(n){"use strict";n["Data.Foldable"]=n["Data.Foldable"]||{};var t=n["Data.Foldable"],r=n["Data.Foldable"],e=n["Control.Applicative"],u=n["Control.Apply"],i=n["Data.Monoid"],o=n["Data.Semigroup"],a=n["Data.Unit"],f=function(n,t,r){this.foldMap=n,this.foldl=t,this.foldr=r},c=function(n){return n.foldr},l=function(n){return function(t){return function(r){return c(n)(function(n){return function(e){return o.append(t.Semigroup0())(r(n))(e)}})(i.mempty(t))}}},s=new f(function(n){return l(s)(n)},r.foldlArray,r.foldrArray);t.Foldable=f,t.foldr=c,t.foldl=function(n){return n.foldl},t.foldMap=function(n){return n.foldMap},t.foldMapDefaultR=l,t.traverse_=function(n){return function(t){return function(r){return c(t)(function(t){return u.applySecond(n.Apply0())(r(t))})(e.pure(n)(a.unit))}}},t.foldableArray=s}(n),function(n){"use strict";n["Control.Parallel"]=n["Control.Parallel"]||{};var t=n["Control.Parallel"],r=n["Control.Category"],e=n["Control.Parallel.Class"],u=n["Data.Foldable"],i=function(n){return function(t){return function(r){return function(i){return e.sequential(n)(u.traverse_(n.Applicative1())(t)(function(t){return e.parallel(n)(r(t))})(i))}}}};t.parTraverse_=i,t.parSequence_=function(n){return function(t){return i(n)(t)(r.identity(r.categoryFn))}}}(n),function(n){"use strict";n["Effect.Class"]=n["Effect.Class"]||{};var t=n["Effect.Class"];t.liftEffect=function(n){return n.liftEffect},t.MonadEffect=function(n,t){this.Monad0=n,this.liftEffect=t}}(n),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(n){"use strict";n.Partial=n.Partial||{};var t=n.Partial,r=n.Partial;t.crashWith=r.crashWith}(n),function(n){"use strict";n["Partial.Unsafe"]=n["Partial.Unsafe"]||{};var t=n["Partial.Unsafe"],r=n["Partial.Unsafe"],e=n.Partial;t.unsafeCrashWith=function(n){return r.unsafePartial(function(t){return e.crashWith(t)(n)})}}(n),function(t){"use strict";(n["Unsafe.Coerce"]=n["Unsafe.Coerce"]||{}).unsafeCoerce=function(n){return n}}(),function(n){"use strict";n["Unsafe.Coerce"]=n["Unsafe.Coerce"]||{};var t=n["Unsafe.Coerce"],r=n["Unsafe.Coerce"];t.unsafeCoerce=r.unsafeCoerce}(n),function(n){"use strict";n["Effect.Aff"]=n["Effect.Aff"]||{};var t=n["Effect.Aff"],r=n["Effect.Aff"],e=n["Control.Applicative"],u=n["Control.Apply"],i=n["Control.Bind"],o=n["Control.Monad"],a=n["Control.Parallel"],f=n["Control.Parallel.Class"],c=n["Data.Either"],l=n["Data.Foldable"],s=n["Data.Function"],p=n["Data.Functor"],d=n["Data.Monoid"],m=n["Data.Semigroup"],h=n["Data.Unit"],v=n.Effect,w=n["Effect.Class"],g=n["Partial.Unsafe"],C=n["Unsafe.Coerce"],D=new p.Functor(r._parAffMap),E=new p.Functor(r._map),y={isLeft:function(n){if(n instanceof c.Left)return!0;if(n instanceof c.Right)return!1;throw new Error("Failed pattern match at Effect.Aff (line 390, column 12 - line 392, column 20): "+[n.constructor.name])},fromLeft:function(n){if(n instanceof c.Left)return n.value0;if(n instanceof c.Right)return g.unsafeCrashWith("unsafeFromLeft: Right");throw new Error("Failed pattern match at Effect.Aff (line 395, column 20 - line 399, column 3): "+[n.constructor.name])},fromRight:function(n){if(n instanceof c.Right)return n.value0;if(n instanceof c.Left)return g.unsafeCrashWith("unsafeFromRight: Left");throw new Error("Failed pattern match at Effect.Aff (line 400, column 21 - line 402, column 31): "+[n.constructor.name])},left:c.Left.create,right:c.Right.create},A=function(n){return function(){var t=function(n){return r._makeFiber(y,n)}(n)();return t.run(),t}},_=new u.Apply(function(){return D},r._parAffApply),b=new o.Monad(function(){return M},function(){return S}),S=new i.Bind(function(){return F},r._bind),F=new u.Apply(function(){return E},o.ap(b)),M=new e.Applicative(function(){return F},r._pure),P=new w.MonadEffect(function(){return b},r._liftEffect),N=new f.Parallel(function(){return R},function(){return b},C.unsafeCoerce,r._sequential),R=new e.Applicative(function(){return _},function(n){return f.parallel(N)(e.pure(M)(n))}),k=new m.Semigroup(function(n){return function(t){return function(r){return a.parSequence_(N)(l.foldableArray)([n(r),t(r)])}}}),B=s.const(e.pure(M)(h.unit)),I=new d.Monoid(function(){return k},B);t.launchAff=A,t.launchAff_=function(n){return p.void(v.functorEffect)(A(n))},t.nonCanceler=B,t.functorAff=E,t.applyAff=F,t.applicativeAff=M,t.bindAff=S,t.monadAff=b,t.monadEffectAff=P,t.functorParAff=D,t.applyParAff=_,t.applicativeParAff=R,t.parallelAff=N,t.semigroupCanceler=k,t.monoidCanceler=I,t.makeAff=r.makeAff}(n),function(n){"use strict";n.new=function(n){return function(){return{value:n}}},n.read=function(n){return function(){return n.value}},n.write=function(n){return function(t){return function(){return t.value=n,{}}}}}(n["Effect.Ref"]=n["Effect.Ref"]||{}),function(n){"use strict";n["Effect.Ref"]=n["Effect.Ref"]||{};var t=n["Effect.Ref"],r=n["Effect.Ref"];t.new=r.new,t.read=r.read,t.write=r.write}(n),function(n){"use strict";n.ceil=Math.ceil,n.log=Math.log,n.ln2=Math.LN2}(n.Math=n.Math||{}),function(n){"use strict";n.Math=n.Math||{};var t=n.Math,r=n.Math;t.ceil=r.ceil,t.log=r.log,t.ln2=r.ln2}(n),function(n){"use strict";n["Node.Encoding"]=n["Node.Encoding"]||{};var t=n["Node.Encoding"],r=n["Data.Show"],e=function(){function n(){}return n.value=new n,n}(),u=function(){function n(){}return n.value=new n,n}(),i=function(){function n(){}return n.value=new n,n}(),o=function(){function n(){}return n.value=new n,n}(),a=function(){function n(){}return n.value=new n,n}(),f=function(){function n(){}return n.value=new n,n}(),c=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 u)return"UTF8";if(n instanceof i)return"UTF16LE";if(n instanceof o)return"UCS2";if(n instanceof a)return"Base64";if(n instanceof f)return"Latin1";if(n instanceof c)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=u,t.UTF16LE=i,t.UCS2=o,t.Base64=a,t.Latin1=f,t.Binary=c,t.Hex=l,t.encodingToNode=function(n){if(n instanceof e)return"ascii";if(n instanceof u)return"utf8";if(n instanceof i)return"utf16le";if(n instanceof o)return"ucs2";if(n instanceof a)return"base64";if(n instanceof f)return"latin1";if(n instanceof c)return"binary";if(n instanceof l)return"hex";throw new Error("Failed pattern match at Node.Encoding (line 31, column 1 - line 31, column 37): "+[n.constructor.name])},t.showEncoding=s}(n),function(t){"use strict";(n["Node.Process"]=n["Node.Process"]||{}).process=process}(),function(n){"use strict";n["Node.Process"]=n["Node.Process"]||{};var t=n["Node.Process"],r=n["Node.Process"],e=r.process.stdout,u=r.process.stdin;t.stdin=u,t.stdout=e}(n),function(n){"use strict";n.readChunkImpl=function(n){return function(t){return function(r){if(r instanceof Buffer)return t(r);if("string"==typeof r)return n(r);throw new Error("Node.Stream.readChunkImpl: Unrecognised chunk type; expected String or Buffer, got: "+r)}}},n.onDataEitherImpl=function(n){return function(t){return function(r){return function(){t.on("data",function(t){r(n(t))()})}}}},n.onEnd=function(n){return function(t){return function(){n.on("end",t)}}},n.write=function(n){return function(t){return function(r){return function(){return n.write(t,null,r)}}}},n.writeStringImpl=function(n){return function(t){return function(r){return function(e){return function(){return n.write(r,t,e)}}}}}}(n["Node.Stream"]=n["Node.Stream"]||{}),function(n){"use strict";n.error=function(n){return new Error(n)},n.throwException=function(n){return function(){throw n}}}(n["Effect.Exception"]=n["Effect.Exception"]||{}),function(n){"use strict";n["Effect.Exception"]=n["Effect.Exception"]||{};var t=n["Effect.Exception"],r=n["Effect.Exception"];t.throw=function(n){return r.throwException(r.error(n))}}(n),function(t){"use strict";(n["Node.Buffer"]=n["Node.Buffer"]||{}).toStringImpl=function(n){return function(t){return function(){return t.toString(n)}}}}(),function(n){"use strict";n["Node.Buffer"]=n["Node.Buffer"]||{};var t=n["Node.Buffer"],r=n["Node.Buffer"],e=n["Node.Encoding"];t.toString=function(n){return r.toStringImpl(e.encodingToNode(n))}}(n),function(n){"use strict";n["Node.Stream"]=n["Node.Stream"]||{};var t=n["Node.Stream"],r=n["Node.Stream"],e=n["Control.Applicative"],u=n["Control.Bind"],i=n["Data.Either"],o=n["Data.Show"],a=n.Effect,f=n["Effect.Exception"],c=n["Node.Buffer"],l=n["Node.Encoding"],s=r.readChunkImpl(i.Left.create)(i.Right.create),p=function(n){return function(t){return r.onDataEitherImpl(s)(n)(t)}},d=function(n){return function(t){return p(n)(u.composeKleisliFlipped(a.bindEffect)(t)(function(n){if(n instanceof i.Left)return f.throw("Stream encoding should not be set");if(n instanceof i.Right)return e.pure(a.applicativeEffect)(n.value0);throw new Error("Failed pattern match at Node.Stream (line 94, column 5 - line 98, column 17): "+[n.constructor.name])}))}};t.onData=d,t.onDataString=function(n){return function(t){return function(r){return d(n)(u.composeKleisliFlipped(a.bindEffect)(r)(c.toString(t)))}}},t.onDataEither=p,t.writeString=function(n){return function(t){return r.writeStringImpl(n)(o.show(l.showEncoding)(t))}},t.onEnd=r.onEnd}(n),function(n){"use strict";n.ABC126C=n.ABC126C||{};var t=n.ABC126C,r=n["Control.Applicative"],e=n["Control.Bind"],u=n["Control.Category"],i=n["Control.Monad.ST.Internal"],o=n["Data.Array"],a=n["Data.Either"],f=n["Data.EuclideanRing"],c=n["Data.Functor"],l=n["Data.Int"],s=n["Data.Maybe"],p=n["Data.Monoid"],d=n["Data.Semiring"],m=n["Data.Show"],h=n["Data.String.Common"],v=n["Data.Tuple"],w=n["Data.Unit"],g=n.Effect,C=n["Effect.Aff"],D=n["Effect.Class"],E=n["Effect.Ref"],y=n.Math,A=n["Node.Encoding"],_=n["Node.Process"],b=n["Node.Stream"],S=n["Partial.Unsafe"],F=C.makeAff(function(n){return function(){var t=E.new("")();return b.onDataString(_.stdin)(A.UTF8.value)(function(n){return function(){var r=E.read(t)();return E.write(r+n)(t)()}})(),b.onEnd(_.stdin)(function(){var e=E.read(t)();return n(r.pure(a.applicativeEither)(e))()})(),p.mempty(C.monoidCanceler)}}),M=function(n){var t=o.mapMaybe(l.fromString)(function(n){return h.split(" ")(n)}(n));return 2===t.length?new s.Just(new v.Tuple(t[0],t[1])):s.Nothing.value},P=function(n){return function(t){return(r=l.toNumber(n),e=l.toNumber(t),u=s.fromJust()(l.fromNumber(y.ceil(y.log(e)/y.ln2))),function(){var e={value:0};return i.for(1)(n+1|0)(function(n){var r=function(n){return function(t){return r={value:1},function(){for(;r.value<=n&&1<<r.value<t;)c.void(i.functorST)(i.modify(d.add(d.semiringInt)(1))(r))()}(),r.value;var r}}(u)(f.div(f.euclideanRingInt)(t)(n)),o=1/l.toNumber(1<<r);return i.modify(d.add(d.semiringNumber)(o))(e)})(),e.value/r})();var r,e,u}},N=function(n){return a.either(function(n){return S.unsafeCrashWith(n)})(u.identity(u.categoryFn))(e.bind(a.bindEither)(a.note("n k")(M(h.trim(n))))(function(n){return r.pure(a.applicativeEither)(m.show(m.showNumber)(P(n.value0)(n.value1))+"\n")}))},R=C.launchAff_(e.bind(C.bindAff)(F)(function(n){return e.bind(C.bindAff)(r.pure(C.applicativeAff)(N(n)))(function(n){return D.liftEffect(C.monadEffectAff)((t=n,c.void(g.functorEffect)(b.writeString(_.stdout)(A.UTF8.value)(t)(r.pure(g.applicativeEffect)(w.unit)))));var t})}));t.main=R,t.solve=N}(n),n.ABC126C.main();
},{}]},{},["Focm"], null)