Problem:
Score : 500 points

Problem Statement

For an integer n not less than 0, let us define f(n) as follows:

f(n) = 1 (if n < 2)

f(n) = n f(n-2) (if n \geq 2)

Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N).

Constraints

0 \leq N \leq 10^{18}

Input

Input is given from Standard Input in the following format:

N

Output

Print the number of trailing zeros in the decimal notation of f(N).

Sample Input 1

12

Sample Output 1

1

f(12) = 12 × 10 × 8 × 6 × 4 × 2 = 46080, which has one trailing zero.

Sample Input 2

5

Sample Output 2

0

f(5) = 5 × 3 × 1 = 15, which has no trailing zeros.

Sample Input 3

1000000000000000000

Sample Output 3

124999999999999995

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

module.exports=function(e){var r={};function n(t){if(r[t])return r[t].exports;var i=r[t]={i:t,l:!1,exports:{}};return e[t].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var i in e)n.d(t,i,function(r){return e[r]}.bind(null,i));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=0)}([function(e,r,n){"use strict";var t=n(1);n(2)(t.readFileSync("/dev/stdin","utf8"))},function(e,r){e.exports=require("fs")},function(e,r,n){"use strict";var t=n(3),i=n(5);e.exports=function(e){var r=new t(e);i(r)}},function(e,r,n){"use strict";var t=n(4);e.exports=class{constructor(e){var r=e.trim().split(/\s+/g);this.inp=new t(r)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(e,r,n){"use strict";e.exports=class{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=e.length,this.items=e,this.ind=0}enq(e){this.size+=1,this.items.push(e)}deq(){var e=this.items[this.ind];return this.size-=1,this.ind+=1,e}clear(){this.items=[],this.size=0,this.ind=0}}},function(e,r,n){"use strict";var t=n(6);e.exports=function(e){var r=new t(e.inr());if(r.mod(2).eq(0)){for(var n=new t(0),i=new t(5);r.gte(i);)n=n.plus(r.idiv(i).idiv(2)),i=i.times(5);console.log(n.toString())}else console.log(0)}},function(e,r,n){var t;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,u=Math.ceil,f=Math.floor,c="[BigNumber Error] ",l=c+"Number primitive has more than 15 significant digits: ",a=1e14,h=14,p=9007199254740991,g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,w=1e9;function m(e){var r=0|e;return e>0||e===r?r:r-1}function v(e){for(var r,n,t=1,i=e.length,o=e[0]+"";t<i;){for(r=e[t++]+"",n=h-r.length;n--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function b(e,r){var n,t,i=e.c,o=r.c,s=e.s,u=r.s,f=e.e,c=r.e;if(!s||!u)return null;if(n=i&&!i[0],t=o&&!o[0],n||t)return n?t?0:-u:s;if(s!=u)return s;if(n=s<0,t=f==c,!i||!o)return t?0:!i^n?1:-1;if(!t)return f>c^n?1:-1;for(u=(f=i.length)<(c=o.length)?f:c,s=0;s<u;s++)if(i[s]!=o[s])return i[s]>o[s]^n?1:-1;return f==c?0:f>c^n?1:-1}function y(e,r,n,t){if(e<r||e>n||e!==f(e))throw Error(c+(t||"Argument")+("number"==typeof e?e<r||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function O(e){var r=e.c.length-1;return m(e.e/h)==r&&e.c[r]%2!=0}function N(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(r<0?"e":"e+")+r}function E(e,r,n){var t,i;if(r<0){for(i=n+".";++r;i+=n);e=i+e}else if(++r>(t=e.length)){for(i=n,r-=t;--r;i+=n);e+=i}else r<t&&(e=e.slice(0,r)+"."+e.slice(r));return e}(o=function e(r){var n,t,i,o,A,x,S,_,P,R=k.prototype={constructor:k,toString:null,valueOf:null},D=new k(1),B=20,L=4,I=-7,M=21,T=-1e7,U=1e7,C=!1,j=1,q=0,G={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},F="0123456789abcdefghijklmnopqrstuvwxyz";function k(e,r){var n,o,u,c,a,g,d,w,m=this;if(!(m instanceof k))return new k(e,r);if(null==r){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>U?m.c=m.e=null:e.e<T?m.c=[m.e=0]:(m.e=e.e,m.c=e.c.slice()));if((g="number"==typeof e)&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,a=e;a>=10;a/=10,c++);return void(c>U?m.c=m.e=null:(m.e=c,m.c=[e]))}w=String(e)}else{if(!s.test(w=String(e)))return i(m,w,g);m.s=45==w.charCodeAt(0)?(w=w.slice(1),-1):1}(c=w.indexOf("."))>-1&&(w=w.replace(".","")),(a=w.search(/e/i))>0?(c<0&&(c=a),c+=+w.slice(a+1),w=w.substring(0,a)):c<0&&(c=w.length)}else{if(y(r,2,F.length,"Base"),10==r)return V(m=new k(e),B+m.e+1,L);if(w=String(e),g="number"==typeof e){if(0*e!=0)return i(m,w,g,r);if(m.s=1/e<0?(w=w.slice(1),-1):1,k.DEBUG&&w.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else m.s=45===w.charCodeAt(0)?(w=w.slice(1),-1):1;for(n=F.slice(0,r),c=a=0,d=w.length;a<d;a++)if(n.indexOf(o=w.charAt(a))<0){if("."==o){if(a>c){c=d;continue}}else if(!u&&(w==w.toUpperCase()&&(w=w.toLowerCase())||w==w.toLowerCase()&&(w=w.toUpperCase()))){u=!0,a=-1,c=0;continue}return i(m,String(e),g,r)}g=!1,(c=(w=t(w,r,10,m.s)).indexOf("."))>-1?w=w.replace(".",""):c=w.length}for(a=0;48===w.charCodeAt(a);a++);for(d=w.length;48===w.charCodeAt(--d););if(w=w.slice(a,++d)){if(d-=a,g&&k.DEBUG&&d>15&&(e>p||e!==f(e)))throw Error(l+m.s*e);if((c=c-a-1)>U)m.c=m.e=null;else if(c<T)m.c=[m.e=0];else{if(m.e=c,m.c=[],a=(c+1)%h,c<0&&(a+=h),a<d){for(a&&m.c.push(+w.slice(0,a)),d-=h;a<d;)m.c.push(+w.slice(a,a+=h));a=h-(w=w.slice(a)).length}else a-=d;for(;a--;w+="0");m.c.push(+w)}}else m.c=[m.e=0]}function z(e,r,n,t){var i,o,s,u,f;if(null==n?n=L:y(n,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==r)f=v(e.c),f=1==t||2==t&&(s<=I||s>=M)?N(f,s):E(f,s,"0");else if(o=(e=V(new k(e),r,n)).e,u=(f=v(e.c)).length,1==t||2==t&&(r<=o||o<=I)){for(;u<r;f+="0",u++);f=N(f,o)}else if(r-=s,f=E(f,o,"0"),o+1>u){if(--r>0)for(f+=".";r--;f+="0");}else if((r+=o-u)>0)for(o+1==u&&(f+=".");r--;f+="0");return e.s<0&&i?"-"+f:f}function $(e,r){for(var n,t=1,i=new k(e[0]);t<e.length;t++){if(!(n=new k(e[t])).s){i=n;break}r.call(i,n)&&(i=n)}return i}function H(e,r,n){for(var t=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,t++);return(n=t+n*h-1)>U?e.c=e.e=null:n<T?e.c=[e.e=0]:(e.e=n,e.c=r),e}function V(e,r,n,t){var i,o,s,c,l,p,d,w=e.c,m=g;if(w){e:{for(i=1,c=w[0];c>=10;c/=10,i++);if((o=r-i)<0)o+=h,s=r,d=(l=w[p=0])/m[i-s-1]%10|0;else if((p=u((o+1)/h))>=w.length){if(!t)break e;for(;w.length<=p;w.push(0));l=d=0,i=1,s=(o%=h)-h+1}else{for(l=c=w[p],i=1;c>=10;c/=10,i++);d=(s=(o%=h)-h+i)<0?0:l/m[i-s-1]%10|0}if(t=t||r<0||null!=w[p+1]||(s<0?l:l%m[i-s-1]),t=n<4?(d||t)&&(0==n||n==(e.s<0?3:2)):d>5||5==d&&(4==n||t||6==n&&(o>0?s>0?l/m[i-s]:0:w[p-1])%10&1||n==(e.s<0?8:7)),r<1||!w[0])return w.length=0,t?(r-=e.e+1,w[0]=m[(h-r%h)%h],e.e=-r||0):w[0]=e.e=0,e;if(0==o?(w.length=p,c=1,p--):(w.length=p+1,c=m[h-o],w[p]=s>0?f(l/m[i-s]%m[s])*c:0),t)for(;;){if(0==p){for(o=1,s=w[0];s>=10;s/=10,o++);for(s=w[0]+=c,c=1;s>=10;s/=10,c++);o!=c&&(e.e++,w[0]==a&&(w[0]=1));break}if(w[p]+=c,w[p]!=a)break;w[p--]=0,c=1}for(o=w.length;0===w[--o];w.pop());}e.e>U?e.c=e.e=null:e.e<T&&(e.c=[e.e=0])}return e}function W(e){var r,n=e.e;return null===n?e.toString():(r=v(e.c),r=n<=I||n>=M?N(r,n):E(r,n,"0"),e.s<0?"-"+r:r)}return k.clone=e,k.ROUND_UP=0,k.ROUND_DOWN=1,k.ROUND_CEIL=2,k.ROUND_FLOOR=3,k.ROUND_HALF_UP=4,k.ROUND_HALF_DOWN=5,k.ROUND_HALF_EVEN=6,k.ROUND_HALF_CEIL=7,k.ROUND_HALF_FLOOR=8,k.EUCLID=9,k.config=k.set=function(e){var r,n;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(y(n=e[r],0,w,r),B=n),e.hasOwnProperty(r="ROUNDING_MODE")&&(y(n=e[r],0,8,r),L=n),e.hasOwnProperty(r="EXPONENTIAL_AT")&&((n=e[r])&&n.pop?(y(n[0],-w,0,r),y(n[1],0,w,r),I=n[0],M=n[1]):(y(n,-w,w,r),I=-(M=n<0?-n:n))),e.hasOwnProperty(r="RANGE"))if((n=e[r])&&n.pop)y(n[0],-w,-1,r),y(n[1],1,w,r),T=n[0],U=n[1];else{if(y(n,-w,w,r),!n)throw Error(c+r+" cannot be zero: "+n);T=-(U=n<0?-n:n)}if(e.hasOwnProperty(r="CRYPTO")){if((n=e[r])!==!!n)throw Error(c+r+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw C=!n,Error(c+"crypto unavailable");C=n}else C=n}if(e.hasOwnProperty(r="MODULO_MODE")&&(y(n=e[r],0,9,r),j=n),e.hasOwnProperty(r="POW_PRECISION")&&(y(n=e[r],0,w,r),q=n),e.hasOwnProperty(r="FORMAT")){if("object"!=typeof(n=e[r]))throw Error(c+r+" not an object: "+n);G=n}if(e.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(n=e[r])||/^.$|[+-.\s]|(.).*\1/.test(n))throw Error(c+r+" invalid: "+n);F=n}}return{DECIMAL_PLACES:B,ROUNDING_MODE:L,EXPONENTIAL_AT:[I,M],RANGE:[T,U],CRYPTO:C,MODULO_MODE:j,POW_PRECISION:q,FORMAT:G,ALPHABET:F}},k.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!k.DEBUG)return!0;var r,n,t=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(t)){if((1===o||-1===o)&&i>=-w&&i<=w&&i===f(i)){if(0===t[0]){if(0===i&&1===t.length)return!0;break e}if((r=(i+1)%h)<1&&(r+=h),String(t[0]).length==r){for(r=0;r<t.length;r++)if((n=t[r])<0||n>=a||n!==f(n))break e;if(0!==n)return!0}}}else if(null===t&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(c+"Invalid BigNumber: "+e)},k.maximum=k.max=function(){return $(arguments,R.lt)},k.minimum=k.min=function(){return $(arguments,R.gt)},k.random=(o=9007199254740992*Math.random()&2097151?function(){return f(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var r,n,t,i,s,l=0,a=[],p=new k(D);if(null==e?e=B:y(e,0,w),i=u(e/h),C)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(i*=2));l<i;)(s=131072*r[l]+(r[l+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),r[l]=n[0],r[l+1]=n[1]):(a.push(s%1e14),l+=2);l=i/2}else{if(!crypto.randomBytes)throw C=!1,Error(c+"crypto unavailable");for(r=crypto.randomBytes(i*=7);l<i;)(s=281474976710656*(31&r[l])+1099511627776*r[l+1]+4294967296*r[l+2]+16777216*r[l+3]+(r[l+4]<<16)+(r[l+5]<<8)+r[l+6])>=9e15?crypto.randomBytes(7).copy(r,l):(a.push(s%1e14),l+=7);l=i/7}if(!C)for(;l<i;)(s=o())<9e15&&(a[l++]=s%1e14);for(i=a[--l],e%=h,i&&e&&(s=g[h-e],a[l]=f(i/s)*s);0===a[l];a.pop(),l--);if(l<0)a=[t=0];else{for(t=-1;0===a[0];a.splice(0,1),t-=h);for(l=1,s=a[0];s>=10;s/=10,l++);l<h&&(t-=h-l)}return p.e=t,p.c=a,p}),k.sum=function(){for(var e=1,r=arguments,n=new k(r[0]);e<r.length;)n=n.plus(r[e++]);return n},t=function(){function e(e,r,n,t){for(var i,o,s=[0],u=0,f=e.length;u<f;){for(o=s.length;o--;s[o]*=r);for(s[0]+=t.indexOf(e.charAt(u++)),i=0;i<s.length;i++)s[i]>n-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(r,t,i,o,s){var u,f,c,l,a,h,p,g,d=r.indexOf("."),w=B,m=L;for(d>=0&&(l=q,q=0,r=r.replace(".",""),h=(g=new k(t)).pow(r.length-d),q=l,g.c=e(E(v(h.c),h.e,"0"),10,i,"0123456789"),g.e=g.c.length),c=l=(p=e(r,t,i,s?(u=F,"0123456789"):(u="0123456789",F))).length;0==p[--l];p.pop());if(!p[0])return u.charAt(0);if(d<0?--c:(h.c=p,h.e=c,h.s=o,p=(h=n(h,g,w,m,i)).c,a=h.r,c=h.e),d=p[f=c+w+1],l=i/2,a=a||f<0||null!=p[f+1],a=m<4?(null!=d||a)&&(0==m||m==(h.s<0?3:2)):d>l||d==l&&(4==m||a||6==m&&1&p[f-1]||m==(h.s<0?8:7)),f<1||!p[0])r=a?E(u.charAt(1),-w,u.charAt(0)):u.charAt(0);else{if(p.length=f,a)for(--i;++p[--f]>i;)p[f]=0,f||(++c,p=[1].concat(p));for(l=p.length;!p[--l];);for(d=0,r="";d<=l;r+=u.charAt(p[d++]));r=E(r,c,u.charAt(0))}return r}}(),n=function(){function e(e,r,n){var t,i,o,s,u=0,f=e.length,c=r%d,l=r/d|0;for(e=e.slice();f--;)u=((i=c*(o=e[f]%d)+(t=l*o+(s=e[f]/d|0)*c)%d*d+u)/n|0)+(t/d|0)+l*s,e[f]=i%n;return u&&(e=[u].concat(e)),e}function r(e,r,n,t){var i,o;if(n!=t)o=n>t?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=r[i]){o=e[i]>r[i]?1:-1;break}return o}function n(e,r,n,t){for(var i=0;n--;)e[n]-=i,i=e[n]<r[n]?1:0,e[n]=i*t+e[n]-r[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(t,i,o,s,u){var c,l,p,g,d,w,v,b,y,O,N,E,A,x,S,_,P,R=t.s==i.s?1:-1,D=t.c,B=i.c;if(!(D&&D[0]&&B&&B[0]))return new k(t.s&&i.s&&(D?!B||D[0]!=B[0]:B)?D&&0==D[0]||!B?0*R:R/0:NaN);for(y=(b=new k(R)).c=[],R=o+(l=t.e-i.e)+1,u||(u=a,l=m(t.e/h)-m(i.e/h),R=R/h|0),p=0;B[p]==(D[p]||0);p++);if(B[p]>(D[p]||0)&&l--,R<0)y.push(1),g=!0;else{for(x=D.length,_=B.length,p=0,R+=2,(d=f(u/(B[0]+1)))>1&&(B=e(B,d,u),D=e(D,d,u),_=B.length,x=D.length),A=_,N=(O=D.slice(0,_)).length;N<_;O[N++]=0);P=B.slice(),P=[0].concat(P),S=B[0],B[1]>=u/2&&S++;do{if(d=0,(c=r(B,O,_,N))<0){if(E=O[0],_!=N&&(E=E*u+(O[1]||0)),(d=f(E/S))>1)for(d>=u&&(d=u-1),v=(w=e(B,d,u)).length,N=O.length;1==r(w,O,v,N);)d--,n(w,_<v?P:B,v,u),v=w.length,c=1;else 0==d&&(c=d=1),v=(w=B.slice()).length;if(v<N&&(w=[0].concat(w)),n(O,w,N,u),N=O.length,-1==c)for(;r(B,O,_,N)<1;)d++,n(O,_<N?P:B,N,u),N=O.length}else 0===c&&(d++,O=[0]);y[p++]=d,O[0]?O[N++]=D[A]||0:(O=[D[A]],N=1)}while((A++<x||null!=O[0])&&R--);g=null!=O[0],y[0]||y.splice(0,1)}if(u==a){for(p=1,R=y[0];R>=10;R/=10,p++);V(b,o+(b.e=p+l*h-1)+1,s,g)}else b.e=l,b.r=+g;return b}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,S=/^\.([^.]+)$/,_=/^-?(Infinity|NaN)$/,P=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,r,n,t){var i,o=n?r:r.replace(P,"");if(_.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(A,function(e,r,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,t&&t!=i?e:r}),t&&(i=t,o=o.replace(x,"$1").replace(S,"0.$1")),r!=o))return new k(o,i);if(k.DEBUG)throw Error(c+"Not a"+(t?" base "+t:"")+" number: "+r);e.s=null}e.c=e.e=null},R.absoluteValue=R.abs=function(){var e=new k(this);return e.s<0&&(e.s=1),e},R.comparedTo=function(e,r){return b(this,new k(e,r))},R.decimalPlaces=R.dp=function(e,r){var n,t,i,o=this;if(null!=e)return y(e,0,w),null==r?r=L:y(r,0,8),V(new k(o),e+o.e+1,r);if(!(n=o.c))return null;if(t=((i=n.length-1)-m(this.e/h))*h,i=n[i])for(;i%10==0;i/=10,t--);return t<0&&(t=0),t},R.dividedBy=R.div=function(e,r){return n(this,new k(e,r),B,L)},R.dividedToIntegerBy=R.idiv=function(e,r){return n(this,new k(e,r),0,1)},R.exponentiatedBy=R.pow=function(e,r){var n,t,i,o,s,l,a,p,g=this;if((e=new k(e)).c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+W(e));if(null!=r&&(r=new k(r)),s=e.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!e.c||!e.c[0])return p=new k(Math.pow(+W(g),s?2-O(e):+W(e))),r?p.mod(r):p;if(l=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new k(NaN);(t=!l&&g.isInteger()&&r.isInteger())&&(g=g.mod(r))}else{if(e.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||s&&g.c[1]>=24e7:g.c[0]<8e13||s&&g.c[0]<=9999975e7)))return o=g.s<0&&O(e)?-0:0,g.e>-1&&(o=1/o),new k(l?1/o:o);q&&(o=u(q/h+2))}for(s?(n=new k(.5),l&&(e.s=1),a=O(e)):a=(i=Math.abs(+W(e)))%2,p=new k(D);;){if(a){if(!(p=p.times(g)).c)break;o?p.c.length>o&&(p.c.length=o):t&&(p=p.mod(r))}if(i){if(0===(i=f(i/2)))break;a=i%2}else if(V(e=e.times(n),e.e+1,1),e.e>14)a=O(e);else{if(0==(i=+W(e)))break;a=i%2}g=g.times(g),o?g.c&&g.c.length>o&&(g.c.length=o):t&&(g=g.mod(r))}return t?p:(l&&(p=D.div(p)),r?p.mod(r):o?V(p,q,L,void 0):p)},R.integerValue=function(e){var r=new k(this);return null==e?e=L:y(e,0,8),V(r,r.e+1,e)},R.isEqualTo=R.eq=function(e,r){return 0===b(this,new k(e,r))},R.isFinite=function(){return!!this.c},R.isGreaterThan=R.gt=function(e,r){return b(this,new k(e,r))>0},R.isGreaterThanOrEqualTo=R.gte=function(e,r){return 1===(r=b(this,new k(e,r)))||0===r},R.isInteger=function(){return!!this.c&&m(this.e/h)>this.c.length-2},R.isLessThan=R.lt=function(e,r){return b(this,new k(e,r))<0},R.isLessThanOrEqualTo=R.lte=function(e,r){return-1===(r=b(this,new k(e,r)))||0===r},R.isNaN=function(){return!this.s},R.isNegative=function(){return this.s<0},R.isPositive=function(){return this.s>0},R.isZero=function(){return!!this.c&&0==this.c[0]},R.minus=function(e,r){var n,t,i,o,s=this,u=s.s;if(r=(e=new k(e,r)).s,!u||!r)return new k(NaN);if(u!=r)return e.s=-r,s.plus(e);var f=s.e/h,c=e.e/h,l=s.c,p=e.c;if(!f||!c){if(!l||!p)return l?(e.s=-r,e):new k(p?s:NaN);if(!l[0]||!p[0])return p[0]?(e.s=-r,e):new k(l[0]?s:3==L?-0:0)}if(f=m(f),c=m(c),l=l.slice(),u=f-c){for((o=u<0)?(u=-u,i=l):(c=f,i=p),i.reverse(),r=u;r--;i.push(0));i.reverse()}else for(t=(o=(u=l.length)<(r=p.length))?u:r,u=r=0;r<t;r++)if(l[r]!=p[r]){o=l[r]<p[r];break}if(o&&(i=l,l=p,p=i,e.s=-e.s),(r=(t=p.length)-(n=l.length))>0)for(;r--;l[n++]=0);for(r=a-1;t>u;){if(l[--t]<p[t]){for(n=t;n&&!l[--n];l[n]=r);--l[n],l[t]+=a}l[t]-=p[t]}for(;0==l[0];l.splice(0,1),--c);return l[0]?H(e,l,c):(e.s=3==L?-1:1,e.c=[e.e=0],e)},R.modulo=R.mod=function(e,r){var t,i,o=this;return e=new k(e,r),!o.c||!e.s||e.c&&!e.c[0]?new k(NaN):!e.c||o.c&&!o.c[0]?new k(o):(9==j?(i=e.s,e.s=1,t=n(o,e,0,3),e.s=i,t.s*=i):t=n(o,e,0,j),(e=o.minus(t.times(e))).c[0]||1!=j||(e.s=o.s),e)},R.multipliedBy=R.times=function(e,r){var n,t,i,o,s,u,f,c,l,p,g,w,v,b,y,O=this,N=O.c,E=(e=new k(e,r)).c;if(!(N&&E&&N[0]&&E[0]))return!O.s||!e.s||N&&!N[0]&&!E||E&&!E[0]&&!N?e.c=e.e=e.s=null:(e.s*=O.s,N&&E?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=m(O.e/h)+m(e.e/h),e.s*=O.s,(f=N.length)<(p=E.length)&&(v=N,N=E,E=v,i=f,f=p,p=i),i=f+p,v=[];i--;v.push(0));for(b=a,y=d,i=p;--i>=0;){for(n=0,g=E[i]%y,w=E[i]/y|0,o=i+(s=f);o>i;)n=((c=g*(c=N[--s]%y)+(u=w*c+(l=N[s]/y|0)*g)%y*y+v[o]+n)/b|0)+(u/y|0)+w*l,v[o--]=c%b;v[o]=n}return n?++t:v.splice(0,1),H(e,v,t)},R.negated=function(){var e=new k(this);return e.s=-e.s||null,e},R.plus=function(e,r){var n,t=this,i=t.s;if(r=(e=new k(e,r)).s,!i||!r)return new k(NaN);if(i!=r)return e.s=-r,t.minus(e);var o=t.e/h,s=e.e/h,u=t.c,f=e.c;if(!o||!s){if(!u||!f)return new k(i/0);if(!u[0]||!f[0])return f[0]?e:new k(u[0]?t:0*i)}if(o=m(o),s=m(s),u=u.slice(),i=o-s){for(i>0?(s=o,n=f):(i=-i,n=u),n.reverse();i--;n.push(0));n.reverse()}for((i=u.length)-(r=f.length)<0&&(n=f,f=u,u=n,r=i),i=0;r;)i=(u[--r]=u[r]+f[r]+i)/a|0,u[r]=a===u[r]?0:u[r]%a;return i&&(u=[i].concat(u),++s),H(e,u,s)},R.precision=R.sd=function(e,r){var n,t,i,o=this;if(null!=e&&e!==!!e)return y(e,1,w),null==r?r=L:y(r,0,8),V(new k(o),e,r);if(!(n=o.c))return null;if(t=(i=n.length-1)*h+1,i=n[i]){for(;i%10==0;i/=10,t--);for(i=n[0];i>=10;i/=10,t++);}return e&&o.e+1>t&&(t=o.e+1),t},R.shiftedBy=function(e){return y(e,-p,p),this.times("1e"+e)},R.squareRoot=R.sqrt=function(){var e,r,t,i,o,s=this,u=s.c,f=s.s,c=s.e,l=B+4,a=new k("0.5");if(1!==f||!u||!u[0])return new k(!f||f<0&&(!u||u[0])?NaN:u?s:1/0);if(0==(f=Math.sqrt(+W(s)))||f==1/0?(((r=v(u)).length+c)%2==0&&(r+="0"),f=Math.sqrt(+r),c=m((c+1)/2)-(c<0||c%2),t=new k(r=f==1/0?"1e"+c:(r=f.toExponential()).slice(0,r.indexOf("e")+1)+c)):t=new k(f+""),t.c[0])for((f=(c=t.e)+l)<3&&(f=0);;)if(o=t,t=a.times(o.plus(n(s,o,l,1))),v(o.c).slice(0,f)===(r=v(t.c)).slice(0,f)){if(t.e<c&&--f,"9999"!=(r=r.slice(f-3,f+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(V(t,t.e+B+2,1),e=!t.times(t).eq(s));break}if(!i&&(V(o,o.e+B+2,0),o.times(o).eq(s))){t=o;break}l+=4,f+=4,i=1}return V(t,t.e+B+1,L,e)},R.toExponential=function(e,r){return null!=e&&(y(e,0,w),e++),z(this,e,r,1)},R.toFixed=function(e,r){return null!=e&&(y(e,0,w),e=e+this.e+1),z(this,e,r)},R.toFormat=function(e,r,n){var t,i=this;if(null==n)null!=e&&r&&"object"==typeof r?(n=r,r=null):e&&"object"==typeof e?(n=e,e=r=null):n=G;else if("object"!=typeof n)throw Error(c+"Argument not an object: "+n);if(t=i.toFixed(e,r),i.c){var o,s=t.split("."),u=+n.groupSize,f=+n.secondaryGroupSize,l=n.groupSeparator||"",a=s[0],h=s[1],p=i.s<0,g=p?a.slice(1):a,d=g.length;if(f&&(o=u,u=f,f=o,d-=o),u>0&&d>0){for(o=d%u||u,a=g.substr(0,o);o<d;o+=u)a+=l+g.substr(o,u);f>0&&(a+=l+g.slice(o)),p&&(a="-"+a)}t=h?a+(n.decimalSeparator||"")+((f=+n.fractionGroupSize)?h.replace(new RegExp("\\d{"+f+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):h):a}return(n.prefix||"")+t+(n.suffix||"")},R.toFraction=function(e){var r,t,i,o,s,u,f,l,a,p,d,w,m=this,b=m.c;if(null!=e&&(!(f=new k(e)).isInteger()&&(f.c||1!==f.s)||f.lt(D)))throw Error(c+"Argument "+(f.isInteger()?"out of range: ":"not an integer: ")+W(f));if(!b)return new k(m);for(r=new k(D),a=t=new k(D),i=l=new k(D),w=v(b),s=r.e=w.length-m.e-1,r.c[0]=g[(u=s%h)<0?h+u:u],e=!e||f.comparedTo(r)>0?s>0?r:a:f,u=U,U=1/0,f=new k(w),l.c[0]=0;p=n(f,r,0,1),1!=(o=t.plus(p.times(i))).comparedTo(e);)t=i,i=o,a=l.plus(p.times(o=a)),l=o,r=f.minus(p.times(o=r)),f=o;return o=n(e.minus(t),i,0,1),l=l.plus(o.times(a)),t=t.plus(o.times(i)),l.s=a.s=m.s,d=n(a,i,s*=2,L).minus(m).abs().comparedTo(n(l,t,s,L).minus(m).abs())<1?[a,i]:[l,t],U=u,d},R.toNumber=function(){return+W(this)},R.toPrecision=function(e,r){return null!=e&&y(e,1,w),z(this,e,r,2)},R.toString=function(e){var r,n=this,i=n.s,o=n.e;return null===o?i?(r="Infinity",i<0&&(r="-"+r)):r="NaN":(null==e?r=o<=I||o>=M?N(v(n.c),o):E(v(n.c),o,"0"):10===e?r=E(v((n=V(new k(n),B+o+1,L)).c),n.e,"0"):(y(e,2,F.length,"Base"),r=t(E(v(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(r="-"+r)),r},R.valueOf=R.toJSON=function(){return W(this)},R._isBigNumber=!0,null!=r&&k.set(r),k}()).default=o.BigNumber=o,void 0===(t=function(){return o}.call(r,n,r,e))||(e.exports=t)}()}]);