This repository has been archived by the owner on Apr 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
/
all.min.js
1 lines (1 loc) · 426 KB
/
all.min.js
1
var nerdamer=function(e){"use strict";var d=new P,S=e.bigInt,k=e.bigDec;k.set({precision:250});var t={},o=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083],M={},D={callPeekers:!1,init_primes:1e3,exclude:[],suppress_errors:!1,PARSE2NUMBER:!1,SAFE:!1,IMAGINARY:"i",FUNCTION_MODULES:[Math],ALLOW_CHARS:["π"],USE_MULTICHARACTER_VARS:!0,POWER_OPERATOR:"^",VALIDATION_REGEX:/^[a-z_αAβBγΓδΔϵEζZηHθΘιIκKλΛμMνNξΞoOπΠρPσΣτTυϒϕΦχXψΨωΩ∞][0-9a-z_αAβBγΓδΔϵEζZηHθΘιIκKλΛμMνNξΞoOπΠρPσΣτTυϒϕΦχXψΨωΩ]*$/i,IMPLIED_MULTIPLICATION_REGEX:/([\+\-\/\*]*[0-9]+)([a-z_αAβBγΓδΔϵEζZηHθΘιIκKλΛμMνNξΞoOπΠρPσΣτTυϒϕΦχXψΨωΩ]+[\+\-\/\*]*)/gi,ALIASES:{"π":"pi","∞":"Infinity"},POSITIVE_MULTIPLIERS:!1,CACHE:{},SILENCE_WARNINGS:!1,PRECISION:21,EXPRESSION_DECP:19,DEFAULT_DECP:16,VECTOR:"vector",PARENTHESIS:"parens",SQRT:"sqrt",ABS:"abs",FACTORIAL:"factorial",DOUBLEFACTORIAL:"dfactorial",LONG_PI:"3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196",LONG_E:"2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746639193200305992181741359662904357290033429526059563073813232862794349076323382988075319525101901",PI:Math.PI,E:Math.E,LOG:"log",LOG10:"log10",LOG10_LATEX:"log_{10}",MAX_EXP:2e5,SCIENTIFIC_MAX_DECIMAL_PLACES:14,SCIENTIFIC_IGNORE_ZERO_EXPONENTS:!0};!function(){D.CACHE.roots={};for(var e=2;e<=40;e++)for(var t=2;t<=40;t++){var n=S(e).pow(t);D.CACHE.roots[n+"-"+t]=e}}();function n(t){function e(e){this.name=t,this.message=void 0!==e?e:"",(e=new Error(this.message)).name=this.name,this.stack=e.stack}return e.prototype=Object.create(Error.prototype),e}function r(e){return-1!==f.indexOf(e)}function i(e){return e instanceof R}function A(e){return(e=ne(e)?e.multiplier:e).lessThan(0)}function c(e){return Math.min.apply(void 0,e)}function s(e,t){if(ae(e))for(var n=e.length,r=0;r<n;r++)t.call(e,r);else for(var i in e)e.hasOwnProperty(i)&&t.call(e,i)}function a(e){for(var t=e.length,n=[],r=0;r<t;r++){var i=e[r];-1===n.indexOf(i)&&n.push(i)}return n}function u(e){for(var t=o[o.length-1]||2;t<e;t++)g(t)&&o.push(t)}var F=t.N=1,B=t.P=2,G=t.S=3,V=t.EX=4,H=t.FN=5,j=t.PL=6,X=t.CB=7,$=t.CP=8,l=D.CONST_HASH="#",Z=D.PARENTHESIS,z=D.SQRT,Q=D.ABS,Y=D.FACTORIAL,W=D.DOUBLEFACTORIAL,p=[],J={},f=[],h=[],K=function(e,t){if(!D.suppress_errors)throw new(t||Error)(e)},w=function(e){for(var t=e[0],n=1,r=e.length;n<r;n++)if(!e[n].equals(t))return!1;return!0},ee=function(e){h.push(e),D.SHOW_WARNINGS&&console&&console.warn&&console.warn(e)},m=function(e,t){if((t=t||"variable",-1===D.ALLOW_CHARS.indexOf(e))&&!D.VALIDATION_REGEX.test(e))throw new U(e+" is not a valid "+t+" name")},y=function(e){var t,n,r,i=Math.sign(e);return e=Math.abs(e),/\d+\.?\d*e[\+\-]*\d+/i.test(e)&&(r=(r=(n=String(e).toLowerCase().split("e")).pop())/(t=Math.abs(r)),n=n[0].split("."),e=-1==r?(t-=n[0].length)<0?n[0].slice(0,t)+"."+n[0].slice(t)+(2===n.length?n[1]:""):"0."+new Array(t+1).join("0")+n.join(""):((r=n[1])&&(t-=r.length),t<0?n[0]+r.slice(0,t)+"."+r.slice(t):n.join("")+new Array(t+1).join("0"))),i<0?"-"+e:e},g=function(e){for(var t=Math.floor(Math.sqrt(e)),n=2;n<=t;n++)if(e%n==0)return!1;return!0},te=function(e){return/^\d+\.?\d*$/.test(e)},v=function(e){return ne(e)?v(e.multiplier.toDecimal()):e%1!=0},ne=function(e){return e instanceof Fe},b=function(e,t,n){if(n=n||{c:[],add:function(e){-1===this.c.indexOf(e)&&isNaN(e)&&this.c.push(e)}},ne(e)){var r=e.group,i=e.previousGroup;if(r===V&&b(e.power,t,n),r===$||r===X||i===$||i===X)for(var s in e.symbols)b(e.symbols[s],t,n);else if(r===G||i===G)"e"!==e.value&&"pi"!==e.value&&e.value!==D.IMAGINARY&&n.add(e.value);else if(r===j||i===j)b(pe(e.symbols),t,n);else if(r===V)isNaN(e.value)||n.add(e.value),b(e.power,t,n);else if(r===H&&!t)for(var o=0;o<e.args.length;o++)b(e.args[o],t,n)}return n.c.sort()},N=function(e,n){e=d.expand(e),n=n||{};function t(e,t){n[e]||(n[e]=new Fe(0)),n[e]=d.add(n[e],t.clone())}return e.each(function(e){if(e.isConstant("all"))t("constants",e);else if(e.group===G)t(e.value,e);else if(e.group!==H||e.fname!==Q&&""!==e.fname){if(e.group===V||e.group===H)throw new Error("Unable to separate. Term cannot be a function!");t(b(e).join(" "),e)}else N(e.args[0])}),n},re=function(e){return e instanceof Ve},ie=function(e){return e instanceof He},se=function(e){return e instanceof je},oe=function(e){return e.group===F||e.group===B},ae=function(e){return Array.isArray(e)},ue=function(e){return/^[-+]?\d+e?\+?\d*$/gim.test(e.toString())},le=function(e){return e&&String(e)},E=function(e){return"("+e+")"},ce=function(){var n=[].slice.call(arguments);return n.shift().replace(/{(\d+)}/g,function(e,t){t=n[t];return"function"==typeof t?t():t})},q=Object.keys,pe=function(e,t,n){for(var r in e)break;return t?r:n?{key:r,obj:e[r]}:e[r]},fe=function(e,t,n){return m(e),r(e)?null:(t=t||b(d.parse(n)),d.functions[e]=[d.mapped_function,t.length,{name:e,params:t,body:n}],n)},he=function(e,t,n){var r,i;return t=String(t),e.group===$?(i=d.expand(e.clone()).stripVar(t),r=d.subtract(e.clone(),i.clone()),i=i):r=e.clone(),e=r.stripVar(t),t=d.divide(r.clone(),e.clone()),i=i||new Fe(0),n?{a:e,x:t,ax:r,b:i}:[e,t,r,i]},me=function(e,t){return ue(e)?e>=Number.MAX_VALUE?e.toString():Number(e):(t=void 0===t?14:t,Math.round(e*Math.pow(10,t))/Math.pow(10,t))},ge=function(e){return e%2==0},de=function(e){return 1/(e%1)%2==0},ve=function(e,t){var n=typeof t;"function"==n&&"undefined"!=n||(t=function(e,t){return e===t});for(var r=[];e.length;){var i=e[0];if(1===e.length){r.push(i);break}var s=[];r.push(i);for(var o=1;o<e.length;o++){var a=e[o];t(i,a)||s.push(a)}e=s}return r},x=function(e){function t(e){-1===f.indexOf(e)&&f.push(e)}"string"==typeof e?t(e):s(e,function(e){t(e)})},we=function(e,t){var n;return ae(e)?n=e.splice(t,1)[0]:(n=e[t],delete e[t]),n},ye=function(e,t,n,r){var i=D[e];D[e]=void 0===n||!!n;r=t.call(r);return D[e]=i,r},be=function(e){return[].slice.call(e)},Se=function(e,t){return ye("PARSE2NUMBER",function(){return d.parse(e,t)},!0)},C=function(e){if(ae(e)){for(var t=new Ve([]),n=0;n<e.length;n++)t.elements.push(C(e[n]));return t}return ne(e)?e:d.parse(e)},Me=function(e){for(var t=0;t<e.length;t++)if(e[t].group!==F)return!1;return!0},Ne=function(e){for(var t=0;t<e.length;t++)if(!e[t].isPi()&&!e[t].isE()&&!e[t].isConstant(!0))return!1;return!0},Ee=function(e,n,r){(n.isComposite()&&!e.isComposite()||n.isLinear()&&!e.isLinear())&&([e,n]=[n,e]);var i=new Fe(0);return e.isLinear()?e.each(function(t){var e;n.isComposite()?n.isLinear()?n.each(function(e){e=d.multiply(d.parse(t),d.parse(e)),e=d.expand(d.parse(e),r);i=d.add(i,e)},!0):i=d.add(i,d.multiply(t,d.parse(n))):(e=d.multiply(d.parse(t),d.parse(n)),i=d.add(i,d.expand(e,r)))},!0):i=d.multiply(e,n),i},qe=n("DivisionByZero"),xe=n("ParseError"),Ae=n("UndefinedError"),Ce=n("OutOfFunctionDomainError"),L=n("MaximumIterationsReached"),I=n("NerdamerTypeError"),Le=n("ParityError"),Ie=n("OperatorError"),Ue=n("OutOfRangeError"),_e=n("DimensionError"),U=n("InvalidVariableNameError"),_=n("ValueLimitExceededError"),Oe=n("NerdamerValueError"),O=n("SolveError"),e=n("InfiniteLoopError"),Re=n("UnexpectedTokenError"),e={DivisionByZero:qe,ParseError:xe,OutOfFunctionDomainError:Ce,UndefinedError:Ae,MaximumIterationsReached:L,NerdamerTypeError:I,ParityError:Le,OperatorError:Ie,OutOfRangeError:Ue,DimensionError:_e,InvalidVariableNameError:U,ValueLimitExceededError:_,NerdamerValueError:Oe,SolveError:O,InfiniteLoopError:e,UnexpectedTokenError:Re},Te={csc:function(e){return 1/Math.sin(e)},sec:function(e){return 1/Math.cos(e)},cot:function(e){return 1/Math.tan(e)},acsc:function(e){return Math.asin(1/e)},asec:function(e){return Math.acos(1/e)},acot:function(e){return Math.PI/2-Math.atan(e)},erf:function(e){var t=1/(1+.5*Math.abs(e)),t=1-t*Math.exp(-e*e-1.26551223+t*(1.00002368+t*(.37409196+t*(.09678418+t*(t*(.27886807+t*(t*(1.48851587+t*(.17087277*t-.82215223))-1.13520398))-.18628806)))));return 0<=e?t:-t},diff:function(t){return function(e){return(t(e+.001)-t(e-.001))/.002}},median:function(...e){e.sort(function(e,t){return e-t});var t=Math.floor(e.length/2);return e.length%2?e[t]:(e[t-1]+e[t])/2},fromContinued:function(e){for(var t=e.fractions.slice(),n=1/t.pop(),r=0,i=t.length;r<i;r++)n=1/(t.pop()+n);return e.sign*(e.whole+n)},continuedFraction:function(e,t){t=t||20;for(var n=Math.sign(e),r=Math.abs(e),i=Math.floor(r),s=r-i,o=0,a=!1,u={whole:i,sign:n,fractions:[]};!a&&0!==s;){var l=1/s,c=Math.floor(l);if(1e7<c)if(Te.fromContinued(u)-e<=Number.EPSILON)break;u.fractions.push(c),((s=l-c)<=1e-14||t-1<=o)&&(a=!0),o++}n=u.fractions.length-1;return 1===u.fractions[n]&&(u.fractions.pop(),u.fractions[--n]++),u},bigpow:function(e,t){e instanceof De||(e=De.create(e)),t instanceof De||(t=De.create(t));var n,r=new De(0);return t.isInteger()?(r.num=e.num.pow(t.toString()),r.den=e.den.pow(t.toString())):(n=De.create(Math.pow(e.num,t.num)),e=De.create(Math.pow(e.den,t.num)),r.num=Te.nthroot(n,t.den.toString()),r.den=Te.nthroot(e,t.den)),r},gamma:function(e){var t=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7];if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Te.gamma(1-e));--e;for(var n=t[0],r=1;r<9;r++)n+=t[r]/(e+r);var i=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(i,e+.5)*Math.exp(-i)*n},bigfactorial:function(e){for(var t=new S(1),n=2;n<=e;n++)t=t.times(n);return new De(t)},bigLog:function(e){var t=["-253631954333118718762629409109262279926288908775918712466601196032/39970093576053625963957478139049824030906352922262642968060706375","0","24553090145869607172412918483124184864289170814122579923404694986469653261608528681589949629750677407356463601998534945057511664951799678336/35422621391945757431676178435630229283255250779216421054188228659061954317501699707236864189383591478024245495110561124597124995986978302375","369017335340917140706044240090243368728616279239227943871048759140274862131699550043150713059889196223917527172547/335894053932612728969975338549993764554481173661218585876475837409922537622385232776657791604345125227005476864000","24606853025626737903121303930100462245506322607985779603220820323211395607931699126390918477501325805513849611930008427268176602460462988972957593458726734897129954728102144/17750092415977639787139561330326170936321452137635322313122938207611787444311735251389066106937796085669460151963285086542745859461943369606018450213014148175716400146484375","399073568781976806715759409052286641738926636328983929439450824555613704676637191564699164303012247386095942144825603522401740680808466858044/247958349743620302021733249049411604982786755454514947379317600613433680222511897950658049325685140346169718465773927872179874971908848116625","1468102989495846944084741146947295378041808701256909016224309866143294556551407470861354311593351276612463858816796714569499021375899793849136855085849133702029337910502448189055357182595424959360/819363879309286303497217527375463120404739098260200279520788950777458900438307356738082930586032462601215802636320993648007907724899611296693997216938989854861043298494990214825163523387600982777","5896704855274661767824574093605344871722790278354431422729640950821239030785642943033153793245906863203822369276271050164634206965056233097479117980782641839669/3030306850569309344013726745100070601277982132543905537366562638553198167007159067544789592089960911065181606283478843359856123992707598685058297067179343872000","76631772943534985713873427262830314617912556928476573358548256872141516989538374761909611879922349479420014771499018155447198112155515453671128814488139633810493264352294560043912066253026059140653027326566801398784/36852092933388988649396042883218509607503204211148493545892849595498822817623842579026942621098851631842754395231561679671400197056377380063233740202370686144673585955581403046886083948450136247134308381940165804875","3159076083816399509754948610929467278257473888282947311280653574634802580912280940686954763313882823327077171624015737719617373932318151594325834524000275847475866299387913048/1437757485694188822758304467756419845842037623148461107362957994816554782989250555362514354661961482939226272309026092009962414616417412938087494467254146002233028411865234375","22266067259907364984531611601870291368272674573653403965630628996687370994139884833897773468149149664829922302484782423514167405397665098388400450149078982462318781750661005833037235183394221496186539779712428265837926417581952/9670030144664428565128962309657100138096047028794689249320859276197340398920725569428532293373676415359965773460364494998334259893079003125373872108770534788283842907318071170285038777091588292539102269617376180390982915567375","14604654564989239958569331443385369522850975185358647132770022716433280072271007767111036877803328768910274400515590151934676819262085211828028638417329558229123989556376108454497813055/6090614019162516693013973409650613208227889078878781039105047015752493519149314227721984436973374032279421344818329285207124280297611253861173835238379831004010748379874393292231671808","1901241885407696031217292877862925220917660047127261026827869027159993239567933534052663335498281439239753018507182016153657409777749792228538380379703411298411623469292891476969894084838876001545818141543890273256985768690847587711270930688/765116019778838839812655402103512685695769161212360553099732689795578904762091216998790589926057819838537805856579109910198553330075924857419395160755642371550113347465300208422126945265887065434116781678702741657275181694851670325469434625","139459806786604751793737926146840623607010208216289543036026206208962059593900745886202214788747453279179283344350478734275973878932538430194363355795823581315329311220701640235653288975569812161436/54371368534412517053056101353618694718215711767266376573138772968257303578467926450212293233332401067673270853953399269852376592855992724934941173346260129257754416412476202526978443681584633116375","1045669091124493070709683241190022970908640501171378776604126771144008324358233819560649021940145166254659028524319517244711645162132513416238958170819347361185944945680269442845829390112062101255500836072082817820950448463314034677353723256969344/396228259004446234921310936915931611736815598535963504660076315228798989932959459406702091180060429080345146735173591749448509810270759531977278642135591672189002006272326131885315743181289970885337574780897529347356567086535505950450897216796875","9912919238915437302006264477931031611447467070103973106567538528951878797932559935860738745374437522819124347510590800370471910492338584284092534264608801221235029062881964101996762011296996851893455828946521/3660537472668264151218961634689665210933936249986285290553357254224360417386515311493310199319523687171757653216994741150377508234317025158302057758196429623723072084157928224798322861732880034847243894784000","9263710175433181746575186369318246002919895649622127410824041370079225200282403368319370743363303164313395723904510539050157032684710468364067204876434546848634842333436957245275217583248805993142227630297924119330553308466662488683624783307023014909360640/3341177182697517248552428837661919299725031035849865632511882688786226888137634168024976033652753689210700218163621739078534353578510364301481093730054725078138658805025014615651043313990684347632166030359086885561104034510990826655289288319840595753002771","5116082230713622171832327542439052727465114322479570603905499496221224653983960598946033081212909066917137546065542953865612718836914393275681318667667521726785633638189373998191090501201427906618075889744489190209584/1805752553736060443820406101277706970767657006346276183748749630179442318063568286372320188433843729960294965366346522303898609655762491623098453269916163621089005711823488749297418113474056676109581110715068124438875","246569125619713282434448566970352231845414317018379160824176638351574938993535464763890962336882760882398479702237564384291290459961036068916857265499633061660562532011248501476114401629839742058389195725393702000011860799793778295606988057303225493814005789533570432/85307063020836305797178273029353623060860009152114361453434032434699636078115114412588719432277441055049132559782203988387794711585368296817222565434951256788867244687081233632650953850383220864394261763844194948389861147622944651546912394593164406926489862036343375","133672026303452911046163998480860917119290576658330909785707604886881155606725822685088929236266583416708668502760907677019598002175122453170574729028452721476464728566191464897928696630979863154661704374206171469014225143/45398130975270785045482567762871405072140548998125471025451666500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","6041693953360002800224091673336562508913199995987479264605216252220579740134601435770085920869376641180763419907442721705887169884230643795126568815123647603047739799302562095542459344811429882053086550900803768964612193941424128649976704727183797495759082741166938351872/2016766992122395667828553277997478570503475626107286343497917705446132017125079612756035254750822860815515899557855166824523851779156336235294914777307802256439645525835223691751931866188957324792276149549076500784191791380803500156776088683900346065830066370370083309875","705868391597244582764749229356331441978820024796066870551110486625729826111158236686696326058778874201639006234449557592353247542995871491078308187261304930042019640830629526023972693107193897009168955674240659026247094657679060/231848642748474339277532000336338632910990823562381469441716922006107433404523316252618490265927265734670539384485699132080062215196462178933963957679882342083893417545858074378754089719547920901917516016346211301054206383643383","101832160604157943093944673541651013907278188571533075311673249923948856034633446617630054761681006062910980371900782781226979391765818325065031889334563981235894369036439929651260587335544056975715076598739977065390678221999918899003881778449092038750712969437519295878491018112/32944277910571666002449086492515464541550138004002141571670657643770713783329063548790202120805341989608877739811787937782240802963962520261844114327432160788193314874913687387269408387417806176202979244637915812905426565263196954203487934225589622864145960079736633434831996625","10655703119271468913597640479490594180964700448340778168715956712130636958373270202484276402718566314881119559090842449610957974112230306343486091910217340665146602598568991520563987490686996746558858366002301982443029430290679385551/3398412687366638541233365137084722368200311117891192348532156645374786104142009695796409107380345795998400850838706661851176885183144928701608654514812261697598380070746520197171576610572921007069104300695592751543563472456384512000","1903039332876763837419920240543738799531131775028971323439870868730321221615515008394327723508670975623498588291298064320786970626232668956372004004897872810230178526101184611242511193415796638694370503100219710864543168952682617801833318493436174387568067811938490953495819438108686336/598806534367503338307287246320963280558134937382149405305466709787179429317914803617527827862441615350396864359976273212272586892074799651088317544101755361439294687323233086696182687664637422796995789967075271448560870681210580691574924544896656175563265378514188341796398162841796875","525573915563826130963525826191411949262846916750432019596028344808298471293378917508549164993368392834023782480702893643486699787870059946429810070222126260200026332874480239090370088123833491499400991181659445914352500247596757005142623368/163278727324937389095822405034435687776345799835442022795533783889356344755225815267819508608559076191292900367982490827396869405536484846115955581043091229202052407483776587687967125885665493681707461345895999542381476164157058393971431375","9263815657177858787273494705338516861045771674838057329170239610953039987023429736752079544014780707408666628475997291124805562998227296677616204140605356257712022384368492575381355563976330347792504605666631512343447560301417325154003481040250148561839861837778597346623630046623751094400/2843321709948499955095590862256744532227698001408929142548057792217790532624003190447363578048562448168721539177458065482170148482375585867230123873178100117094533143052886527452665480614620123764036974180917207421482431983407742154634391264619615289225747664532332469783301704643254076601","407959339726114455622180187758753007349209016396248763075759257357925636039752474207685682218422721827857994768023399625060206708378433960993946156803948655098667156937949174400873748557248801874735834957795040139401560494087476967548060208243867/123780218751812156744401121690996305978134694678934447237402511116731459214498784497436358160964198336874043702652746834763131444030185151143987331404604087778514863973633941401826334750268416015224906056576641018962863645043976537664227639296000","2547676391598917379516698439971914695230548782904479778605691338364453606537643088857116141939170899135026552016969320061900926954008522781162186995856580955090548471448276736878300717869625651893741316530109438876067419826217901657017506157997588944233677467357220316084583383623602865379325184/764562034757392298786420374672266498815021229519853724850874576419885380830752931701831256959159800764672605004880389358601658343203513177084389490286723240185146570925957286083025676875197029662038213216541352875570101363668917766225709569356861275434470568767077844675593176178611021135573625","186545352286463730559933346565311535598243666022232037054735807289501173444103692309735768703898330430135399033529355360391658728987379385732098960609744313878477967971557204207043802935782878745271859468248704012618254203101767841517569443555143252/55399179641621656233589820996143825959365789093262978988289445625153099592463372579496245442338653053662134699646413817866770218574795378644415019944304868289119443774932782235638737888469746745621382139263856603239588594078668393194675445556640625","664884440164786473344854955309049113269357314957985265728106924238588705533437169796551912202931185746193155801905841712503407258166135075966280435780812714252670362202091663287095423712596462690753468682634261029392794173636943978404002804413009590005984736612421172979101972556772005594499779860608/195485517776407145286424460448995460754674039560651791192647586550615878988380153730602665795647187884543361218962125172808792176382956599256188706636727418572541254480798303566840010217729386905041217793614214518363859058348249961790104618910877813067510758225302884815410347238200133693756493703875","2614957283934314904315471338485451166053664494383241929385424599389309215073267052860464009981063483440201193771607520572077231889699858482582363845275452280606276949653970992719332472370351170732899676316967244504534154616036371979031399425846100527685/761493664432749089312665480773496290658029971027686543404885407644062485746072719559288231362060149626237939029641098328278650939665665969011529293869562636656650999759724704272743235210867676873525147820749560155294022488994426729939894753293900972032","124843380518493746761140367283007507854364503961156704095198010255465940085534099747297600085903814014415830785663764373057896014399822131175202342399536439284123918855893825207202244831315575594886675813256448846863723093240955901916229136393454605455444105444987028391748121054399538064686074523506176/36022228212051654395480210378626648518430280334458144892889271272122662467638331091863215146548048144675657239846337165813938424387499358852301016926312083940212100001220180762189978024821166744964908871443681332664798940660421469519997746775275873085770018269706847741064037876137315001228315806659875","827992369063043155578730871896750570951766628472810506926098505028264552046829097082095665194000002802661600196840639204300804225352337632259980703832713031790922485730615305441309917696044954289187837653933158950774246017223571461858939407386087081525130831392/236805932823686534991153393869288530368011574665859226704279685567723830696754821658770176385138917722808377962346690757191122309876922069867472518117628639913077442806147910884267694879089753138429767401700283014143248445966474839193628309668702223994071394625","17347276886878323736540051321582548724378497839789943634071026331001588645519865992773157565595886250230140452154269197770615097377486013097979087647774513500701793885978192218455687078883766086309728287172567466406449372659680040183273634701092561727514713494914793425407149186041796935055187281744386432/4919325621804683623339606849970832094714371903709195539440424738973575902329797546592497378000858196173718145883783709223158260700365224756081275272021856393735663399552166737690038832550853145831185979094979556715294990257315369124065787473707136464772247917156232366320267601622617803514003753662109375","137984231830526866236186357461458917020538108058615632801298091031540729111527734872044790487396302545910108285921421417358113055522725197998483383380192391312304647004240060970929072498293210057120617332323445379424867965764749534125081131327565507524502163460761/38810445792642817561168950890315210470940006613819790543653745327778579787694809782601777514116858514049585074667085399925278459138508514838268321349069481334967221455722811414399738756151414906092225265355449011152267068726417045644222323488445626292574879744000","746567120547823334914136339633766098626636643449144032626270358619125402826113269699709721071135471625588981126637674402048519990010499180844665151971356149292818375448504122545400227696621572263621729512461528550588108384619064912224884465737417596190735966915167530332762203074440688676123756162572829692160/208334337057923929636884170505570363171441147899816815785150954417598643614152856767186132467069365605496210036171429712485182162940460120834349006784956522600679357307849981862006710239311750261522832996877712350330290831638640913932265004107623954913155144975252743257846945609734368518424172846119306643431","64649371728330695076928013661001819989330953381731372450140483779536126948957993261299287753791770622512248630224724990234903928056275080682537641377393210728546364176267034339221558641084730052304770498929958838997239635790469536857863963589118888238069738647239076/17903951498200212327802847425913723358452100686246224008745414214690047078122925247086521362329833307849817944645647750649290248110509395628305970523384831671737569872597295947593410067364379687588919135621621162007748635920864926867870502568935739725312687094047375","2454918942158003099688922026016393688092399295166304634317616773083386087532869193458590448918958337530406410803840837646465522656670050113548208618655070231274778592766244282964463702354872753657766121825196898916725498553882689210280080206627916046484942827487726300822318764058084323314109595329304407466188383616/674880185931325925966586583820010578979699141814417326552629206140252348822939845006845669570885271576698771404162512001549922909048916000017837898649100825976232784446638776021483802989797501705685620612986771521390439936066527738682396560462899753657942715306792783283782238662155922082005591512296007820682995125","74018558041066162916454010680594042518462756234254788158141115244349044958441521749277686851928706433556285971088455226217644009628399441967508838553345152310730562224910795446341601049647392069373970101491741830623078126344928804029524181578945586663110848142571149861/20204153620006780689923328634586091101021423979622170579036140596085566172775051595588438592742563923428900864000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","2127032036758045513335690185608563023954009095206088224487365541995326714285119384743928987635752931664240752323937321097955456543854943206092931247498833001499955456190701695430459583885125382086777607021670447795321669948733328973350279846928613949120929250312666393359442423066212311060931469017737106028339882830848/576612418511902928757340062840968526862381326698309578771238715462180282212422302261044980131594522407066369222998903808960617461164985318633518680304995784614308979881735537678182134128319596636920719106506829571072447362052319438091347699720147003209417806230149598345068078717948025207635448205253184540936478445125","35289653975561083576641954928762116897061274899517309102784750384002335187117263273488751066569234386120759866204372398611196356888479036949053282301027789530999737306501029700128744408015642211359442183943916106790666114870974212159410284751571905275610921784716184508440/9503006066880728386808143045924119024212377150217533250562188228062174064693375135306438120385877320162710918716613546077156389583384656340709638430674364232343609717735574035535102953482366914421205216675248471695111720986346092738728929878538430662191272737183832556131","102633551023964794485575491065909467125458972250222581133681080524371507544152979467328048718122409841060527545925136196267751819689935599599321090571687632103850847605493223603751038996548520557330016046032671961857623066292962260173840972332108111505971231021442896036760967107060309991355545554631003681544611731245475968/27459658121882266328752886605529964804078316737648012166874496015808620265471203512606463219297059547428855195782384236337998738233668399173746663289852416697917397644234441300570212555870401420579737973722145663287124151049692290432756231390864184491891697469874600345958989433125942336757049639797225309327019275689074625","10034393558388390065766795008210457368713365491566387292163814915435906649268119060550511145023450790393353937124495488860451123302412204483570913557762460385297770427946219119911920640306914453207097103853766023934602534502476962159682750262143380527529536498215384467975023/2667919902603322771586358077760621955455470781865624844984169443739075976572061827709528710108877015489050369589117491611045518221354793418884447632063538994046714401229510497599783726376490260140723032102883617341970952663947646017489439179953454964374887388652792446976000","248528145263843375390386172800048509380966183384567983242213959113927668429802237067505890436957693495616107089384741585283620097982859345081736730899912519273262934785992235852866637878831878448348444611412764161078458068549719800733237024285525816723480868704742804077255242682077291713092790250511567621735004237450946304/65676865669148624809340872151906045781446981664561196686217551358486802274698228825404698950974939545099727242259547145392352658637333562345477931951890984276718673618736565926663528625796412420753961231404680876558659735251469326707567479071881966875336951133475135427640218972722939427821842173216282390058040618896484375","7805448718805635696495809414501206964843262114470109146341305656318015059743127114324245035489577134938579856003956861881125856595981500593426840968087618241785931128978516340812066502964561231235073012672356530509663384739132686548934288703179479011016719045530855033205271548/2050525178024039744126592505352202216905491833360272553169520915020715464206141942151086176509423406413311520838568324134077402841030113427309725873344806030836314500267104070131451720947531994814710189000076651895520222646974590481497382830325485174899169093049299764813276375","3355325071293197839434119105039673324264765809771192815982246040415580387729382404624613875653005261578877047405365032178619450963731719777167015959920645055600439987161800547901539269321100559393048973255388860193948274255340335876890491746900991668165565729269698196233805991206691196045182214641935483083662356666996922240/876402579119117579582569839757462461050855174353108858954282915644790659429341853404829661899850841645529640454766173209897510988090318303454542547519850473808789222552969933222203420847859171250332350076509996295844203965564448154484566493395403967626596213792922784509892086361572955175655987334882030766001799867659814117","218871061991045868372866381545267589365410350294028138778572466235486397478028823720846191998825628156716190463263492304639890659254282445466806224943413446008645087186307985343574807361972238230520975439736199291019544576443791916302825193643774360055545186783819367378492631806297/56849560726416896431557940314760680962653658127458002233782028041537121216487790008085876994020812492987733987414743604239935223783349870516284048368761617736127892160849065895223288023531930411718807065209903593668117085505482007061969339237404945180379460053180570404846043136000","5008685108365226931582937964451700746853986170633433728409171904803795018146152804690759530990140552460596075588463394200510044617816085275660078502126507209302951286606953039953843685800941558212440519542602092919776366067720586295390886070120828199562643208637974347390938772070049344991272621102622931576339988103674070876518912/1293888539680354282541277646947380627241979967611883341823378331667976045287311988103163380651334828012840330710760757271860219584371109472132211215957402251594055009937397184768184517621978947384029376766290498101728971145633139541827544539988344772578184316843734267915665730981857376872622787627370859411909330227080697966353375","15388340113525711660227566446101909585796746979396093776960989868457211684028149502578116456785221720682202816140911944661051001675127262774824593420825587319436537346311831003212424497488485098543512314062112948777572038731823948224734505930748371522309451168088057190162878224801232/3954220582960831691377435160890656173654063611768428458807273708040518769541211737927975894584024448193835165167801976423275767590502552964407494549049777006346189436817215329891530811451811864579644894987864267389290848598289794977382504890216219362031324635609053075313568115234375","5099039333987561374222193551155323470675617979816941646196895589439391685938046865391119484510329634015275893520725135141878751153360264368353595348921951280561029028912953500944814771064409611917475818956659775131751121312316084465321917769679881052144364834485866477379437705913911371481828140817759401117780199246301705600020671104/1303503600297679371136943454060319958680553228879031326679449263682048703103464872914972900105569835004878963701599765030590097739639045890060548760692125546754294514068052902543220382104483822438283040090444827980927544440984823535260277595466339403795403200720622852069244768910603820007632395190204569927612348189089161551951106625","4902837141334073026145827027361937996261324349722726869116185158777439337041263482852376194988371853413467559557923410949898048139830183335197992754748294810838187068126867611615800383834975563313220497573778480109264178673389149671194149749735833378557143135481387904961537942569904075/1247045310545991266291285730016853118981099516935251861146038369985109288084420528171217942065832292739130145780833406014673689119563698528225048800794718789218267628507713621235056538202070171596177775095071513194885568843375526804796016261173388452184505503341132236719484809714335744","38114743522716832107917466438257616720476488812538316101658139632867788464381862291240727309611460187159930652186486096300862388591521625093237019662273764387591494074792574929490381910446287947994150655077877204446864004067956087975012773988833339521775463977233068498404144221045837190392670308437391686081418318624745039402145439223552/9647001083383999453668111809775451078976046488746916070976218645431946648087171586252172936600115032316383427265217993193444199863138429602138841976586190525451324093772097241349417938578878934577091671046050326087898259692917931230974174799815198493279413438192301437068820185757869608523761456160341754512329264442115351926967120404125","573695055225225727008803730767518906490704995929177617646275646884555707960986625481944101622708415415988844740028718027554452662358957933526173824325955904005404113684003841990198157072540659184995738719040024647370869010473254071681533880576462368600901824622431045529064651675640055917092/144509482511118816399089096021290587489594541280398871255876563615464628718527634679330291741479135415168539765887291789615790513527330600394937614433502341116068305347468133950204152174094704092402978083370792135432486240914953928188835819767755172666693219213868545854371103120604946200875","23876960329653589647925126180903391687666378233201794403339630995420215267415575142266707357255726330536094448314199602616026935251126469221925945960901748679919435908556550271504767784553484434363646489174587463466333864577705745452492395785557425904735048180164697040313528831173448025400634629163795223739061661461986923675833880378496/5986312408594306954013526197465608559068621248896320652512228238115589875514604632230098997609482248000888567135685167138762172475788060284232459813998201719590208742091697294562538265829954186149162974972471533202880368317237508987477069872431064075005305838801862900501819963793062041081601844759452202282545840716920793056488037109375","58168289917567723171226992383559866214094157894992327555495441698028867727845766488121900626912848698952863438654895252811583144479300382761129433911280049009362667380001406579175563745824368613319103673817094498117944856004415812877213722455299491145649879676787079744410765053845551958756701/14517067289347903655500020160671113450349743650636953726251191692074385521975132268313263723831804150872238173602847065423463131917373356798750100313145228608894881457107689499956903046984443545789053438946050974567665049237414588435796381674590098629779384355275820782532479708807512981504000","728621890568281859295409481422447012528302594365693410763821707074444799793690738137592101239862736313347273167450056625929591960610208335290882047413011571781161008296084630072829079783328937418641417642857196346026366370059522990813537731394823630207433267854616768658990289454635793326766697884798538576055949457122067828153655416688640/181030730759516991863708593747964787874073354051675597050399087612142539517308720603687322924426591889179726492403913356461908748733972707460063017057809060190437917851790767968877215795679844983288935075688219234885360839984681619084834228226744165610073685719017596630302462070188937998558312507638434329299017584329479516410907786681093","86855946923438322218622470067224691860808273886184997065663554841573982963995340977083049132518812923329423480393306918856650577072525633920456721265953575424233701929892019410099166322511413146891121248381648145391642571638857576890568882512129960291171866772665863159474602604647289052079991768/21485753507365901947528588896402264670781310878547726104482740647554738151100954835784115119035980523529677083504495839730499664052882400915208251594384038810917282207449860876251558307288700200910747338758723324686939379138206117634546981163355060740270734146780942696291669461182599512320099625","2158989152301022938148680102142188531448821359505188055264665167313418619665693092337665573150374231484840948447637297247277576415460889296724813940128955070240137590073233263168835678714131062764247434144994737610229909964847568491446606012581370840699582055341626266533733744293929658949697805855362114229666626620766245630122333733703618176/531794915405164005613733454597931482878479882704956110685223892325074211694837836221759995948610212818642789132749082430059593652854659130217225506942675608692701447738732031302987802196501895840510235161825501235133794449421919927396142470196961877376701957829921152848178076410141813926924749057304222282687697297216661687583257901415465125","139432548574396829074586704387656697097760057897628994548358619815052936481650396157428747411173567801047221928593253479330480454469358220685854351236980383914223693722868233819483137401339800304943891968050399345430243790898955416907228948287367356990263740207046902209563417267686591994743547621/34201151688775214071963206765436083445901621442002061707492082843232231754829227303539041286301398668437202547003300396162741375435703188500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","11008517174872833286150985180322584448162884832099344969609291070844193524816852920942383850580217443209402836100467940651581092350600329145627967515818684442171571156446321228596914355704205623857871497315955269266498229823278800717909321269179839084452384509142712677235552103459737790674103994445173074670347080506698168482564009465276165824768/2689223396936080856855299215659204161946704205931885125148201643087176556822542895325191478283706585400237901215485150928036895428721912118467760766508162631903585126377676412573187912443878232521444786090510891599171741773242011017926658231638022943018461086517502584854390836347781674626615709751386455292026775663545470794167629144456268750125","16108638074211260588800537540680707641986073914251424878121255234668558067988171568946079848860335948991834525552515669040163026131919804987340113244760738846884911038097907756220945883750502673899084880578229601870882631165510396775126850307838505063922101682333806284668762825609556049426829531780/3919363961344261777100658318137884299575193089462944554282218278496298610828757650104922583359642384253066896538203596057302203635134833545580869871333892935330950583664400555463557735723364497947986885146043017010159347046389604172186788902608216894094289769850517098027486468084407618748895626853","34420755849180279597302103726180110022640946692592540634353734157479505420320000324260530767186132260970572450489530034440214259559325114511265075416512316229177952140217732655405289808326341696986755141965043719344169685611217958619102774617224847284122901023774956887687026904767714958090256282893003000752947427857703259704682455375442735857024/8342030311716679826889917494957593165464748884572298173556257652389845294530325764837124998293398445804458613956489096007564811101361266196542129764287084823604897187311540561857741285793447174119667215803837719660675298308873496219385226998078648428368061868944322478384684509466965129972030932418920415308276430355882329457342937549162000252625","345888075261020004071220843714060353763382280664960929903544964118831237876694384053904571498830068831026644303797377762345709976595360421502594656308937649239978525713471393570536680412814805076323426256584504251728507416368609420882442293831684681071553766603478479006495757222912500012444787804577811/83505703731469734628961395063481893801938371516752417759131774530720075262459158384433785006689548434701904106312038822969658455364219435022841597243178757423598248565463985786213156556523685666430799283870548238467817226915680747412191245046634279766450629886904716776719219698922088211154187845632000","1061717830619177527082296723099890392273896386613997004874669053445943252046748251883532634529759169500795452576392700472771365240996842610207274128102329096619028487369622001737128463631016494371635687841733644339636164570819431573829173533941056258744442930643735587780907310433371453992062647737259587563398111688659657406089003293576961475848704/255359631537215747979895955806995352799574790340218399351168178555478073997876110889483456972687438702262017800167048243754141722496276537685853311434069991222324039005160057724073156957530106623908696241268268096879569794431919729620178375212905203484165745866913773304319069321426245521467122472046370356725530914587807274074293673038482666015625","274122944106300296738399632684955400761495830361663966466225652918683099779465438024846903286816813856490888796372134557295699980528187779624865098445756013563535339056233912394908544185885547842235097677765325396255649207317018754967666450708249125316192200151505568416495274671679500594656671785202496/65687592621976546250581560102201535533608158256953087745856906437400149205693427285162333502528793675585022025602144243543064185647792948495372442630333800126269123531636800213405254045262127593759539706750242430153456891792533267948231185296091297979933562727112487057234422009426868531651634706262125","7842680480716516803148821198697967237136721860017131244266974996267074742248599085253569637183007740566941125452215834642683053334607896723447140851344501084122965014242091312411884985569341166545074688756440728922408743841592658677792796881188604773469108807869960161395759837407978596679911066586626885830991556090978327508459276025943279064965688960/1872528612245648675720382138045071131304652050696842872529163720558126655075937845539792108048310219395746259570506175902206215101518698490144716531697689534559827422735649881381597761684154409796315455445459537515308174919488497154409643876490472215352056502193150125644288086294418253309947229151074464928874881827227706992859640236086417889990541889","5300824422251242070074569186825929119848111723012841627275830216301188228660779008353049603527567784119877706984722171178137272986345560485784907345500893648715341273841147320288851034078863843374665850852481747000237834238703248634174397792745914847774297223176674917912406659831206869442510948965571661/1261140476013707338477604677428573831791396352814802149994640617701773078174882455512668089072441176857892331468691160991310474734143842336092636848492066592397892638052212250229129355009939118431643425836944282456647571558383755315238500832868535816144280088644939696339160092963629012001958205063168000","2220223718762215584659309059880106334425515875615107369399767892051551634000614327272260081056973863669004224981561870246078120862256383581012183852291444462730018546753183156982897386563561418424093883164027305254176874653780425452987066512563140531367766900610414277825262239199580925879453806414860409441845631158680721091621460775043562065815179617536/526383206607841251253861841374779803798480623722760367843070466043030228662340154304405180907941079883976168609082254331465595267209149963786388600028701073430773581228212441424400748220833542964971495005714483235359479470452593264280645360131482713147116366500300066771223383007216182988263355451923333319170174755334598973202740108032097242475554128875","521891797109626296684891455959263713257353500867652268541535940159815152120871142196535233326890353914761242025931373491906127275561002910157909306979093246574207104081108188995072105948138299097848175016082947174156278439986705241571619793059501724269644447572323501261424770743329858038040685313621446524/123310256826873923765604825413207481739886340225713108649758575106598510022338480189649787216845041382860899099250547657534972156328080736149239332330143771138115695598493059325064119176038137294863053148618656356436332991079150723235214278848602671333076219529535123842212129829931654967367649078369140625","66086044538329677372986118727999622900471937619891337714357792768200341519193500393739322894033303245376225584865369486696276607060432449792893028061817203932068085863800494054274423512956136695211796751845295921015953538329385253280866669403169919614982155350899648626481405781514434761541281229159396787287553493046927448595964103589100429722948913403008/15562137339474350565671240515273666798063901504051979980452491653975250630723677279081058884163396938548780856293034775459223871281049026140999055923743471466471830572672766633086347312178711643724485955576579988182546105048041649947277672869613992334541438784737993706482731696809943027528882927942967419447250586964258807454003775693567366165507144866375","335377615394100148751647837967017467711612297170079949298328061159559939969228226474615711044891085626519877634842694983669611974807129333052471799687426665556738316626171408219730853872410792831871526174987402129691897433888027072807302411474690613948951673562473758814664346259109886876538510453475290967835/78715592752271462306588358880337347638000605031000575876214116610339827495261512281635361568951675037834544811575026718101166562072917855004822606752296233435017284127594847656529606648345533195437635894948829857913798336356647286032372695130461573940500785137424365840081503133157308796505622439791698116608","20090879701618729602554170716780970848925039917987945471322994867171660307998603515745066411687983450400412739285577269751603921163835619296822801840348319742203974023505186187060251544248644338412667631232247108675504629538319425769464277309915502144443973397371136256151336255138506001292355330875114245901820438821732843540725116728866301271466614762497024/4700223519410528857298732096729483544820841497820611795617923063440946097326817340637303431283005509904481323205480729806879570430868897342398783028649633951362398196137429076844504529051072393709154483678349272930361110568616112723747726853614661953537957117231900032044221535502745676310313569997665352252492568100075191900969170979460298189170486601502625","2904778979985524171206573028445379872240558084236464200857594814631031581387804621371822074061289363372523364167184697785570324832815972970658633551879143187709707164796663015180877412717910872234647704536817108676736661804878068078543241390828229923424191204586313620612539678930999769543756218765870513049986792/677408099044823641581658869221044375312077929976719183424865834811543737800956896926637625166844372424044003929341361734886232742770909683021563822987505236295727478159938135467975522336774471915167606673489722102077041330652185811196423400701795791669780695158730756241178262962515917389382302757366325768069625","31270155809329751863885224732454397292230969002004953832354065319735530624996254695453061851449600345977646455072512400760539747054003851289540339425848681804190284451253462663731135337775088379954403740058084949675460445909826322297817535400604180338201322667139062500269285493417563095365899631360901732684124930296643108551710704785906431324876072470231424/7269578038000504017073007978844992319987411732848567116655821196644382777088703228960020894756722675887473977480537577509061256138261063926845643360849217556370868752909531088361229374467207196928745673402380473721018157327193509586295879051411183657185176812738231456253321187419224704301236205478184115996135940848503487199394612616742961108684539794921875","432538822079707760382094121020421735679118830363764570640789368235407853152380328891350816400541189148550353337874309885334920995713154225799660601389784410911658967499100610376065640785585342035058364676314084595283850213942576431310823836792440218271879354669291052589804956435743500204185107215929849054782893113/100246574739326291035824954677502591279343311051719151327066341370995390423713403739043396503785261917771859220535505691760472395306543276314938287868734009582906895763073519374099272340577921671298878837400921045252035507925021904954445172372479744465666760762909731237634082051855588025732494461939980856983552000","1914333673689206389116942789116917579088664511118582610293383428712902211612554212779880638065888518488492298586641997844141510832940409501694726851666478650414191249534733087933879981733561565249818572204932715347752949087800778646065986244657260832234479202201129845117955957242616947361016603702640821256099895469088229339240402478576285854783063612307200/442333801076281757298117784528962837115323835962460661601905131618341609371649347131724700192551574625400701487125984359494804828935577124602622582550626336986871791407398609915208114339012374456785705161994343348351473385887949809051796407340988735853810174589261300681030826392672282630613354461927208579993042968520650313621522933214063366558703422757071","5704691626402072213006354545292364761246893919997531024861408248746241619817955824682639582830486790618668221530365426203424888737658778881721063941495350237419723855000515747725926735319471480027293210991869255971365522170749568996651406002311020883635577590045650037569906001924971041810547543163363976464780729932/1314240362076792592671773873754757443276256223533339004339330559325754574023619698171225777585408160438834449576526997055649849875516310105297894855264038450585295422343454458568152668980131977005808840141079502436391909349182185596381509091427752151860204235071122788499996991078935216686010888734471173124487937875","451219364084386208718456142329444023337343409261545444643031014769484085278440612677813682892926852469540118625738238137458321112005189595703619178533263706811689687213128887082197330137502064260105387500552856851972124172206996205919556553246133218441769325133725631665593372188755090094541462474970525820334385058333756591222492801647110594428922046641945259392/103648250172203340865458115839764297558925693061798169434516001775068769911768281084188883278842546791612199025413573394167639925287068809631958006622842716869211374513136766899877504136929177267362862319748507372147243911522667591375015611312165464514308451222180272935398828092646393830572838772085366567154646425598388620105539619174837489536378605144891769625","1591076564577634575701791393842535460875733974464805197283632670013516183281542903377750304419996681222758401497321278555686661981435637461350320471258386388843198706277657208526372100698700615835733712519332548607115875288787602084336341594576426630670911478276101702119972195558314357975365863803265163991961173/364433108410193393847203348728981296285742202617988970384277162225847256295865554341611171460436362780497179090329831885853324392923449579538286804729856000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","5307507148709435807261229345132535134848030343901300324623409721698217134932866488937772986386501538026693956121121771089740095760486362654754229904633476234090792827930433598453200536551779789049352131005222659995845427680686677324963223653949277037520711609343166926627713758990384011274777087968799793410506391884872456420041494598273703914689586637995139580794368/1212244290381524115082005575105703496583315188540177702780216570265159923654197746388568151706509243638302707511238539845531608313334248788980188054651601536067740709977678222790481348003085034888244447626347312094586389347535167903408519024105748523384932942441843118813819781347089702286481924493361058339731949844620763272778960860509570622673048786968660129650125","3046577098843580578619955603029073328361298436129791931304665777036152915858575282362742008136721284817899542475666054101957899858138590963789072530710775790433466847100422875906866496318804986202089528198912098377828580031852152997907433335176267300286466072997014023120087988748396598176622765923059385876855303940720/693911859077752895978833241338902695755528613729508555938416419864772385336777924892434701804078893822446727762077537955240605927550548046309823051841326355655848406646248595628715185413852040295631448250459076043816328082561248420925930431777502622148019371383254316636979070731427737764160145097293260938978413488819","155310926743873343426312607182060072939030765297630534544899230213054714482456829198485999782086944271490229412707980997432528653509945301574794242118433868747172279224118534460563400440670015323324602117517342201640016853927923976796453577048995243600967202462466681112804476672348206491490513419336308575442086511015101999847896197546900512764233674747415844045184/35278162986589659300679088538176070649273991865663041616088851923111175518405117391134863644540911005782372831496121355954470744169969774540892096320978686548284501139861783292226140413769665461494668479430833892857992401391262903582109993838728281915806394747833588629467613308837196269424421131934859079260185052081536487462257809987002198437182539441349474426375","46729591025621874782758519074451728476386657576036360734358719976400940301493939192083339293779149127132651616972817165172116269307276487158069293114860391502484125554406945249728802484128756924044633825692779783425628292959170597009935305429239702926898931975023598456207165067568919757902764815108751735753431153581849/10585868084079030838651390738371141142245086465033459640458366146849314274285871375459898014414833295804139979016362796357043372316321872357817727821559232353993714062535883074661734509440994664726425399880995133711038483607773782532430879196405793694658185175583691180757783597895616920432527125993118171361116684288000","3736372348124144720852190769710129461145889011598636925228657393934132828633132357232883470466940330848177425542748100211498184494252714616379450272611850068867816250209867530921278645286769418080018709947826876461419654782341309127709703626401211996255743831998918894661053669189312375159058718767082163156988766821194002596331826150321864927832618126580509732359424/844176851007504003627016945212023239308348428094023437269532743221937069345682900884618378849283002998220513307273333096775669556093005637615012750733216460458689282791632437851364674879152695438589692227159038555722539345972833161146108367329370564838671791241431125003401861887477969954740544092178721327724620450947646209914621007186497081420384347438812255859375","1258774755828991281578968023382624723772927642002016270484090409043454336040857926581316994594109169123354553321469500848146015719851609220423736153365139804086413284787598253618361769125996755159571523632747129480387254164008968993734442164892486441152227433281625391753702577143985047832519062595123255569172968685060844/283659859661671181526547833415653453506477950678651675193210969173130116121017723360258249430884213011988678011357458727603413521688184521573094783291496368005697481333739504490647194454695504722542014845706216224432373442438242355188461951883454664693262684873988061018976711201351382163527093784753398257094429403691625","84932063355292829988908961192574710493098897148701473172754949846455626381329456661808566365329266898990829247446356970454502007127269708487563279536825277374133681167235811080298134899629580318813382668399644553111080625918213250223197440426147821225593304993621451053135332451997633132772608233430131400186571793929377129211228689703376067763625568623535588709576320/19089978133324852910950469658566458037096027722326716800113107848115231563787455584278193954518442601810776347091253561956877155673550458955562102935555510392954425196165785410319126098393353878286400877305164869548380670204577544630353859009177051698096136470072137579698473017257397949994722015089768745013713383769765609613514021200888647472804720456494757423299627","802638881530832431828249604040579750916118423833791608589560402449036920165704012070349537114920882938466635598602387718300074733476150548724726460209016834416094317724261857969955414000155807312852092720310159572547644569797512233899495300028159721348599816083166712365215075728968005941610056018023633235372936903015771583/179951197386119079732438617407921535065140503043429174394605652913879982486051627760652197484142547447000508189455126493868229565647284332735552462525598465192073558793335913005459266977086104359621022691931002488052727597513413492393525660272900161375677499228252863529934576881596384036401784035248649026076581302370304000","25208742399375362881099811032135575360109715964024747212026245529087599633280142314962581193303683759605084995818253124445773115574470717199218828756449187055537877478033129862600982068782249943150019637186466260707552416433010545437321814115233841687700051830170191107127799355485920046505591193770164750886037885397478191534797655616745528343172318318678405576430544896/5637713398995569614196397857525646325234056219513202928587580534159596897880731043336790273040813044077153051260989730372846713618900145444802234629922717464041261370803598799826604841654608724727320798324006129524610666235998113655193642594744544226880944882342204407750193512869672849910003246504052298022468012594459974209940607450480609190841893267203392880360823875","732332637178584560220688900268566130246820235956768724845747830959547501950765063982943061181526237061809052444110437930100210105274824607344902764184151030827266142225894655531497849161692760385938786736436977268616029862577293984376170905024712952813234949508186306774257035535805330366742322777611063402455261391021097128/163377988152179636922409938163005948596822656868040662831003991395905185823836089887990201522673196719628247106777881741843786365701135555917263285268753605514812568258179391272113405920369587922702002732667842511108732068683407168090725712401954314293193572654347237716691784386690948494003094992876867763698101043701171875","22391374854299462107923583267570593886002658786775211597896252879708753450794332301142909715845151746786016535157797023153041007263258732991465037648536702217273897876864351559736449481285518249846264600935543582562018874574655740660800634883403597181876364712521253650744197321080655028374602772696770227741610874399454362583980465225235674816785988164157351243193265401728/4983275997188967758382167867656806681565521964135131710678447245984239733544941881418957694612909599261843693554043504855207170782744518943778096768859337980470219783210191765678908537645270392500777411134164918803949155037581108678968701961544979451081836872425574123683574475790997414488641534074873248802450108535183413970057319247033379016606809226547805269752123746375","21252344995592269775107236774689012760750850598567799560343535731251766780016530978663079386453430272698006977668063208502408607227544322945446079708000304179073184745623740466334127867464883762843346619853325415963062181018736410570113171387891518398846617197097407612852037905687899800932343156979591740310928257766081697645/4718515378484509142377558412184183991357747235892194234377932213613746008373918923611236346330189287336493794499188640380975364991548794341177060325509698404571318037298112293926833877103554546466055612498927474225619680186119313129604319096374924037870803554153458104225741255753314955115645304948564151765516183663634546688","76703085666560609319365659209445044957052359500745196718269665234646121134787807938680787341023203786904308047981099228357850016602203539979246579454229078497537148799349353250167621935384193502383187510928609818011142642954550330069991570983902841318203794113898871515702445720207144863877026526025447819537396146822201819435536435835285098485990260677737192230985069824/16989892821104122916312992616665764943723222199277412857053896319814438961475117951904867066845412639236790762432996309717924037467863024360211163971190006272168845197000304328480920483651558672879967350982199768255256753110375467976246339260326422891913564151453729285191351273342206198366624882195135056176502724912849575385576554208844814085228696838834665339811027625","40153831166521391225489894857551838468150576827129133168972859441122728710165233865309084872159583787083130713473702296122465319276461991457173085312407612757280915853584698420083436946976844240063731333638150599017886937783470942007376523947840104246927580254612991191040951001539641947153847776050138532219595746056076776809812/8873576113581065493273519627544307418139908640325227196912114520903505426722086265723900326735989771660987609604507503750212298754414472822477243293638486047313990878348820573874809636084574108909615044524663712495422565151340037564156235745628465172219286664653343193162657374410926171153516871765680561505768223660055617934625","200736374277835272485186523480177159453030082779872429648449412313247640312479214261681899286513818912991945046297334418102711629933437654377760028476767482162031641781499114859553677502002901248124750539270235098492377826240319766677856465093871367817683734079621359186477306173620331748496369122143019303740252461824523590096923561928354020960176605008889579578495073283712/44259440065125442964014453739391594153290923937737136823355312892557975399035370631521014554980129291582486968083228888083079118116286312583989433037097397252506140224404130371160608365777625538148303917306340620019882928744151294738308047800711028158277500317134537540772759486365658024194428796846364486187105343266398338060080611643110071184992193593643605709075927734375","488459049325494693259159444507437983381645757291858092983371672334043029615965882574409808932509285079401239403272414271652617474184321852388397021836909585659327974611273820676128650810907598106588433939541654215766888212287311943387232664417347883717203611092450971786083806323404432266197250919880225892099146722474124874256523/107455855466267410923480140898552598306699341366032095904938430084768624148829473848763761936703072253841751966906142283640379336131083461646777390874405323298406517250231389493084918065243079819898691146841695350589992171102939046740169198394671965069747042621265775948217054519855346617967866614303497258042439052681849864192000","8430374068596413768975326329313648683222744787097373111477788794692418932056901235174019333392845529821722488982447683794746518712070635063397464904489452840169472596494433874412726723065560358405027764015273789053064830528919091414531400589850704395887250756457780868677553068164933299802944396576360356896758745030955907258232257358056931680617626606715393885378887657377280/1850480358582748412767893656294669486390769246349349706200869446679212812264400876685764762211659843658541567071977813110496329850010288179702589501255367345935389050373021591572539260951149696801665953123597521983257852207280970577287472932167362521740230973547070264273850381896786822127290397075758780174083415923482640313277341120938690594859118603017930500014640169211239","58273615882491925540881784328370957720539797010816130007322211512070634295154626813477498607761260613353633996451797686143131893884559909668805628269959901044961666535533876340116728982072626875010391195372759135469446048394835148654407846242721443845351855234347422256700864370273092971804207514736924787577569355949601385705517152/12763172138328432984573837529764902730448666594097466544652830703737195804747682450548488162227364538052585484418491914323658215406327363805353540266048943197822838925184942600367647278764952826664684839953902567694832690683467635727409976388280092262839126779730168889686628630302519063225007497707028600865624133968363921915016625","2685278694947152969468407055109959900160804835228466214479525891103128459065131221736713585038130737099067040196326815283171857977706979990467444622550497565521863441617001097354649972660183038850033950647594754644997436624623325003537308428828750008305464174443210079059253920383411910911594636045517662796811001285984447671371943267419151220518726940455756833040934506414133888/586864816044968996825907488721678304211296267371936463272955488077666796280028127333229453342355554450708284934221461946991556216095213627059047984199091625921432110913096253352065238765240063555347292393427726758010888546427415276046238297382474708612526770055488323003698641493939145624184943388159614111350839555141202024991876221874110644879676602924730506882384603409121625","27700345710264347957758638741952394530538598225904772664391173119594616680996031886665218221392453628824570256438960349220263575741495285780845399187013582169907518462437966962923592601721119258663490655013419675469864809004562272799012227293974254329929404036071055528766397079743200179924243479370594973626764330855493789112414191/6040997839051213541001279276287478343874107660287651711609067205111574718442229224212245187655300348484144001298428958025052162253854676210451657425437588244676589965820312500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","80160269787574270953020489212619791839643207793889009503234879683494928396231769167082355143564723274576166638869430572977442020236299319718643894871736539109822173538266278165276591962215927816541165548699380129014840956895931285215480350321259054359835472320394089646764361802445068798451796525897304221529850133401768027469126408090577121172238802281079916258951770135485696/17444957084936455555074876721808241311651668802091828589911310253709517226715880722948267977560381436307152342821304525073651379763144281678911047276389231713860392794975453518107055568765009486973017341479560154792340888780337029481646046233967923289468141293699236815196553819373828280398488966665994092877680860643266914861837639322607761804740256920429518434353839878280875","2352816897072623416220002134476921108405735955266703519252095150412419264317091785317803024028565851487861978477208755211589867803009700996828082850796103789009194767813611798769297617674631277847910238088040257037678126316866517601388289837575778165301828137259948173292658462765645645868094197736382683775415645307647043205988394700/510973411316690313485681833991645423802776865720580280058344111363363091616558230182669376841383375321912553771027107891991318313938505988903735114191313214327683449514676737796942389784957658395806951715454372568523597420866050825822028817422805046287798054682484158011143949412956697442991898914560191411624040490122951328364833797","6403295584873165688372907494046202150046769667837790834896334486679541887567517050446119511695248926941383207478170182650927368177009669717288184903306689332746127845953193587519575304974203099873732502605739219028995266139383163062837007982999189114810534856227848568800302527760100163350814120545587074865568436789021082619398126713943637898657861949091545516403987546145915409024/1387794272010111535893205703999712437783041553900341112488641528986385462810448493444968969845352401058333929711237978223214186693177251566069419805757440174840170213159651962686467523533938145629444468366235554597245713128812532716616087753947246800626006504878203666972651384731498770435755225220796872155249202960801768048854869001310722927230237083418017482134588865244642658875","82993247683514419570466529457059660634483860665557779709153549045427987672829778520201315148149878525274005978368939092115193636113741972236218502664881450367443614971109677363668874484696543982239492409231870942414193419634675024621942196087473557914167832058111113476295926250739099284241826553737074679953551191767148712684157318697/17950946423927357725787689855263532224005643859095168852729513034456208872420513601894508438640531171097082516559962755244698695622824386001219435651555513795509616906355363573638916895074349491513539093024980575852693293474288638209680085037286354050958859425647536735341886663074581909148323105020337857959651624760873736590065664000","584891611376763781852144397260140844977346305541197362434227194779766612939978629636198589818106137319267243431810481928639442343946346034433828599323416877248326356345631611148749005937144684862502198147087702668524450709118588741606955966569427636630159793409544653944608958808602551061186799401212712216156799273254257486955348236914237644151956226336750212957092204830385441792/126256710861549838395499078249922986417488985866522660521294610280820007499099176190820291214370699289977888813109514854178180265382471972583921477022411657285850911270389720508719377071949050253246021921916685716353393018411683757067093259101151481189635423399611625009617884983318141463140199839724797412514785751549277231259345923662499623640886881048572831787168979644775390625","4743054867460856425399742072925732465660626340183690464743217147109403130730445842673866624947360862438925194786600531200056131309608642363389833474026007798643235346104937733349791667694862514383520689594596660275306247615314272223660862212527346572811422915223417783887717426641317921972456913534338708745549252254865615725859881457906376/1021840037832289788284691535543138164288462770384961802287250236519983887262771944174557087207566030730743075334169628971336358708580124427857321953981475719503574867471090607795242192417162791762511940848493176847925838738242153177311649130718886794249673254183907621449520415060660496225939963471753122766421338241291756892571824984344625","3784664074155769467702999785016514468281913375341134899878893061325465790589101335015569840325786070795267055386681356241209412947116340524588831510768864231937929260236754881829005065056310226407358204278658699999612596866156294195316867934035877283950841910726224355461522065773816109849107487214275801829843762482082803559183694631856772777313673086715631547326400170962722842240/813783281473223559981291694175087508812520505931454895884442580280342455516154674683217348039336712901850738745276445107477919518905155156380620466135946654952837573797479076027688866326359448543065305071605591497778941561986579230698384305536224430794233462949056326864499827444363206162251104552740175503996670997705423888382328014210171324376593090187604268086334796245552762333","1946671258536842642381655747294621776070051525209940130115769153666368932042152311477746728678182920842238801763565726086459485050237860693394471644023999467670017470376746609892484192072297938254898880354014176373253875722410186683852253828299669530022166361304397631667133689128358365296701757782382475692465977794960109690362462330857/417774039698408581013003883929127512062321623871486379101498968145670269174833505080260389860863417408848209525427705249526516766731427603641806256289098209429110794311660844125377702016056984573671024035213045475132134896835814746425864304907974005950155657789157496389234919107772201305672421982198984613601511388413381215220924416000","328578487723377153600821813410631465225159589727320893988991729306688663770697528156625398176929288628930496338036815910669579019719633124832162035588583242320537435554101841406566009219059042888412893352417446437227440076869427577701706713564212185163005644118869496869980925214424591264870388237079776503547314587137721633918824664946974571838634860386893404364499977966899068777016064/70382695927096628347637455030970644630942872888311870124896575877585692281624151103204551947776906510366521972834357031777287506848887607457751667816514216907338309372900327919413372044625602555866294337672022362865161523684052940126509854895320132828009551012639156341878073682501185688461720664801829933689280752623773789373199210473995823367199793407048741191786377993390965297664875","2617201476921368517857942326432090876874414269689140439151907982631768946799200744678055980827789859579196832718849393046147656447672531861353456343821196812881882023188898815179947651274131166835133965629115749368441605680383605331300030886676081418867305170012032824011912531673468215561506423833911621270680104083533917562622600478548/559567121085534865189976875600841717161617153776904752351231210970240323460800785728739412474960421770806162360125774000625035522428160837855944215417821324758873127567654244465281354654299068546570789547691342609793050301258532586131013585959164719533123826201937801986942606844854123769532447570107525081084531848318874835968017578125","636225736038986537559880265988431731529837451289737542395494683393492040808565905376235074534207026537145408562785279823547657299565440309510931336394031904920056464959974743525662459433889398003683078967642651812081450227654478095420306880762753401111260630654049389197602389949892636943971690212484981672010398108426002137114819838399222096538921225458913266993881960732663394566024064/135776510176793971074115131648637508758953050390591773574951317807919051619690313331192027871176160424663811116849856489187562728496099757910540362703888937768555824513740118941387831822900198029266206334350448626733139136083404404120210893986654422850183837974770675600952078956326317698998103770833069712616832650406225828969036781514645731022616236082175582937900731419575337473384125","266695771933124633677367149389643417608461366874310588884377151539325854547826373711099517873721616543570605935954334944030816383858485296542260152894035979141266909050267414072982042090341712035518685997484257326212454742816979806460287972757626105526907510197321350895873473656215941034605746494172316089636216915825022339855304925515685/56811706665210352283362623728191218698295056176625217939528332247537278605113496147630185544004654583441448319260578659922931798845493756189402805173037491645434052737405379674607517658118427614090338938517963215812444779184193933749520313676564187507594274551791388039139409235056119788261689087831209441779870873305232021728002651979776","3511806683161697708497547617957719390189982761002154386881580160856792742952365159764830433511949678304281539875366378131195670004345568047690216126001067194904446295336734931691743477531830892015690816210752795806120303198745685394015161323982229908105397857791180342330098240702332072396030780386362735967021055250450666535422528637737695053315137238368787607412459874094164027214953984/746741569878639983491390741637813989978804202898438708743258000150996080386381281307609038830698579358879333079215327202911977568726258527646560497079622703052765164031089590965199628534477381843079892123440214378949632707668935001371616475282883095939750704292616758568964786737752325652839226013335092148777788733453702438432279149298482004122593243860829060557386699231448957232420125","499543951252504651717279461487337168721376180441322735807713499521878076780205427598086756686061009718016175215146305489885835839673419698751530207404115002383180054704927695269921072232395828258826213554806570423602966743337801741633869267620843626804016742412046844770601322513184123515405692795346790813502805238635003099976693786012816/106032986203682550514602969462803214831559442358811656484036951559991322084935692953211120289352600484987931812632505499612220494311324679562152078883141464406938524087376964935494245010636163705698220308243980789514815579319533341929989455211613890905485981353837321342730307819060825125980500975023479813757024395422041501208805339176375","8540849722242122835873311629952985285477986765819584558233324868363310302206006773828897816547299245727087876984857726652932481899766510637403577175623031467933486823994040576431755172220921921877192006685053572215922347418846423419683723609799729359551828522978186208983138345476801247634773975311405913274552616037005854836040162212761099347518242200807692224460514057530656658616850816/1809694575992816440924165741094996511361288430727981159314194000585536832192004274726651828760263522962868944612215633976203596150606503849595633388319338251977160257979846235995654357082321611719654136058257458753105122024859078420173515189641515736029725847315662215778251370398007468665986604529263071981040014321717598469319370651877296085250322599247141397427185438573360443115234375","51377057693118720457387330519321684810411289582445982078756989158447711080414032055843805733348558621949380554029375294451303430269197115810494758213980833379214402452992657502777067850631862453239349835215260705131864911194740832694498014048717871429797341104227759557199716944554347879767916801106279081864127192611546757627038037780244683/10867246748205139797826516105458406878398263495890048637741584969144406206902037615496936724683237700974333817527350121106320991054058406504571347680049945745432432384570515723033245430148177097144850158758462968940525568041926860856763884474605057056550146491001458649244094211354153171337463406192651150028767064600270112838159624568832000","2517199821548153657910904242290029026229621935918771922146425373057248090467388430999870036608278542449661971830076845113363443421757278612394167195431759807908413353743377586893872930828548256216510734912027450642648789925142482023713336937258932978503310551945630359646777080073329099268529064437120002567758664419443374110941824106727218341795100740316967386497091058915066147604481280/531524260324016969370728057738851340792702640911631807178654723224511108065633433027773388768889035083734041289308124943130099580765995149865288328550751289346866467755881013217287175392101334538392596956248952430438673292186779006015549928829953979591250274457658042926539541422697852390294886719770034058916886894408015624288115732154492554105512936468520265305162358665491880968652687","937159485027553069020805864547349554547661693803137696125140510201297417077233061462068930061915381468160677500445535971818609631674361074587732183297775728389124966713749450996643183965795829780345678634356741756033039293590264355732129789110416943789326482663579413229893878422643110852069225671783017610387570935863228248464396615988222968188/197552642195166614912991396771845374656891854357948006221100585931656016640982345159207601253599235265353060942313995345483862152489766993442419668492877390774016299878943454249209917002169480134131612530977452579520564400124908392339263545911443803619972765231094502745980083350567509014991735227390978850048088378721210219321877150756855372125","5119346675109082499980756672052066247676641510661024682574296075659671743397880591881419516307292610449161239233139088348510165442597278965718490070997173182184417648987611422446347235659085092530927312760229499083348217392125906851921500360553758600756698605047197529446594606336369425040236883171542367713951500007600355406492128741649090501989105696576697387613035366083536629358444229248/1077349190930018641197987339365056771667455373500846354778079878558146320193384166982231171317419356136237346389570422332278447217033773023556383420372685049620361481309067017697564760747047839930422553324681218253359586320952896352245366885171583221864112040038531116947187482413031483309534553461613717398523132176948321964066833901215878133594739833910960843185464241840039390204295097875","58469980853327028628854378052548435225264353747414624620847476036979290604604988637469977624105451959796142112200285366199247075503424204044884512269071061176877225315884188402954249683107639777479663275428465242905314418930053869461904934138752031124685541853599407727446896558064252696813370692668496452783003306386669962110734257851955001481/12284458784412533668960387046583440199646081362484321078872891438551639470826582933879934711861551014258493898870867541349962531447724393381011633785884743889445407749238183080941846528000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","632694338036291086868292541736272151517212971647680989553388199374739841494700315711180961760384484042159533979873604395621016272772109619401112452105475906812313548587880899058905419220497456502543971131226430775692744506047039958551641270070996110661036371362526401525207493270590999387476275629412687473362310414634469788979236895300129227082421021999210841384596617452097273320509348159488/132710874087075221626157136110978536488168313127228703025408943153782802265472978945703742152954881438058373686972477195846162708986982742647038014147903817539418442869011995988024638278746664230046452545499722614320284478925059527086663455478374200352375121910000967044366831275681254530914306064535110528723482282501358749001657608122307686482720926189537227492041135055090784059994118192625","2022422468242151190347511883185841333968390991430363660248687284021524206079162212007263606819387821055183192871951076644707111802972354128011904720586729919826758651167984507804867954970064938022106484656560866447290934136610214175516487579122328055482392137619829739560923807880779865442016530712986750711199998190148885726144596663143651240/423528009127070458603837580844559347493775236970253513203186912091140251858605354218715508091394564000304400858761758838182654201653901408046974668599216804223721114331085507752600832390227068985693006017591304916519540245902645712532993889000048992026931475754508248265356181099817467608863068068953756055334213584649136541490530849577363647","150542201776735231618709653388506394887777837646651406023174643241783006776019388336318216053045300417086929061565868663031237502137150880313922488106751241006715449458736723129545400133450376339156062387859536289694727635468338235084533552501618659272047966040838509286942825414463511175531001410923014751124732748099355476332649458471135027773371541572374016038525336728276024676601778299264/31475618522527975728853391146702172347290819252268551219771201846701658848754300838383637247014705706066050673096278897933831272607774110183488615338021656923433335661890414740664480671162459271850877855521869741833030384682549648626038314686632195158507693321505500888988183270276134667071014075017317692121986144742473139078857816578133693776368882596780120407949076129685719314703426278875","162664351499283182546788129866259011542529017155637405328005084357078048074065548349602626724265307733005745244338982661090506394708170105916177679714664432754153795772811389612700051002336719842784098507498286260450939289109123759859710248621544296008356071415713931721102824434964336667980062728653562369697289761913925215639430496443820411811651/33956433298509232632327667206936379248172049619640091186698677954874297837764235300806836350019565970550533206216590639008637925266405524715041372407701947953283803854153876844320283735281209725651036513491246238622967031979233265136280687995181375582844780830517825595245506321879177965868747546127685256867456319112247572348416655367667187712000","27228583713734183629451808889147559240254570554044667607519238865891084165382075658707675405673276615039702916443152954157535195508033284355580742761569101934821088036084480297442018005972653124248838420021440899368869744141698556359295489470499243402799483082406238128875386939389123336303631993557844565927960009744780823166462314116039469622216263221278402673028225214534859076857413557466368/5675134787340359276387085910732530678163604187009567576895331134521132071092293139167824957253050637085885426100206370974479279292804959049999647539684766632278449357893560561608633329561385765035738071726214510832066885156767060324427330401967034889966727638276371320401053302413136551142103678412692111973028587922399670456670380189570979581674699102934733563330382821732200682163238525390625","1340937726818688387636018677960518622106989311577445614347061615417831160296369500704524022869612973331444242000788110133157689786976834913297544087249593601420972111789552905846168933014570399562460789075871112224533723259660967481288525220689577290386781169316008987012566216235876842757183233207943071523447855623001920854571597886491163165150556/279054368814522483241446594911968519760869180429079780837994812436395792594449929617293503975169489945136244602350941695478861584261665582123038340824700224583170270427163469762789603657025958695551448477050958557681299495041994050951692916032501884523150972841782658389836059236040091605838583126400660344344601879969354053137568588338096589095875","8910951660339249479517731530773509037034977353457185453617569046885132434552771722727442649095007828468878374139001808825741829728375370140505088133244952288239619141544661695065318568074863317054989982620944602245967155400712702259180443238473885690297281525960618905625084639870407113029712510345262279507055197024677292523214467306898573956604928730377318210588837126450942086527893437954864000/1851573255256476362977604759655284263358595254392797078730401113550522214182030016660458780180636930591149034499142464357511158868625309442843792189394292787657774627425816694628839987456477799348874853555586931850788645677998004186437300173080088839930384424797706381282430208961565555953254145002318893188197561315855286173276564036402546798318351229978103276843822345004757661005876638005274037","84997663352987536417038496128111159210386455419431137931308301989414462311135708114322046234708053448098538629166672456703651524480738219822858469100454933583774404032968304328859365484249897913676382909050450855222567147661842184538302991526635974158862033287154321908483007506326807469239745851379559259262425675035790574846229470041596801343087041/17634687575122715507915388096857069366146981156897230620371714518707518105157483283253374797127075689236298114335734874553183291806268149747826050838089931351158483980735336772879045027213982661634865556129548356487722537193914986994283729746578044621115589195066212043187229606921062007047940293972381121200723292297716621231320254309060321476608000","1648849257486312935416274009474520589799750757877252390543329851029437452988499485179026845292068377957697884739052491455807688429630524210823560524122596610276957537756142278585091315141096146341773982302888007751632401090642472506538817998043326415693840862261701364114923327286462650797963969289743571514890723145251583881752876340628073395708716735192690808352188867334842743895738955762067968/341580411902962140529547622267381834425264893226447658723654120920549166416114849731588552578626041597847002946105459812230979900480135423787717825697955152193526724029890829615845314765605770060975538542976523177976182401820926854406945392167140347444433885786340415437006775075196031433365827874254477351374236932624514469241634422312990555534789607377023339236417434574755566856489013828206625","4899626659231633406569362199187192352933567344960498139854460545644210119722856870634652562532083546344965166340063297647520613455037240144734014575196764021102614748218834054157165781057405100578668000290493431869797883155764963238760612333048336953434663867580862692267574574465371615023999531030446250351305046572267686566999209229202587258144318592/1013522377571209303732207048597964555261512342860326827024786500686692475697570284120359840724596444209277948648863014479460188496587721578075151793081823795161404110811480269106846359964436993190293615381593756076515012514100289406862487971220020752628653845345780766244842386136740768474703009091552043945843632199999007070800871588289737701416015625","362903847358088423032098939589019598036593525722040887883164115981767777873860799955715587436566233010543937498922435963385091400670303956612881974450548904906949032005878241638546734597308786514086678561900713741746905742866635779432216761799371793260025549698865319760786921444505323758235164807966277024031605673481480590193724980659448692487108892154809490199414370023696404259691299614147712/74959603173756091922435708504751461448318819548943586676159545028063979695880930926805574951275602951047845904770828900645717477098988124553474616764040938121171776556999069351772286262529729056288451037717198273521810585868307402693261479298923209587143468206907278220909447483738730657438961435587752873879244136801168836767273934997417156543866722171766794171623224855358640156858606843576125","8521348154958613550574095745596657249924328336262127244827955886474742319277424381360677655239017583606851483318951440691757875270001283229585075137091617073509041644097526047127618954293881264113694362598157456878784814696577083997902588926421675843291157049153701100218784481406086810264243143337016042301806376864424632290226377881206765051896745/1757584673254145109614914862134217345456065873908262753169404848658913774363650863904627183104777337461445063704655164325930891269843669860409763569362863600932267319335889540453302785099532688264425988677082044905948179153286276609910158854349711054144968131934713419772852663860893241364433872853338630216232313607969790083448433666334742108176384","1802461420562646993856730082999823508145602238125054717836501201545920604020389361370931345491160549787411668288359013059160331370751496329806488246135100776263777863399096485894306306621852596694700845918608199329091852956315870664531614358379176680326508877329862713333336188556181470928613423972314983964578645688876556351433429494008513812136152576866650152623510296911708111085518974142728903424/371238439252064016214448115231139360835481920731625321084601566992497057371416121407293286027832357816257507287295719261141426130159269433199862002841433235955835172774430690352481806933860390015899973299268361513643524088242973968537595085600335021120523852420135081643310663869327371821064862449426404044951571585406092523478861879148545678639697679215289523234342337347529225543852787599016265125","88795280670112240977945082069219541902481768504536167808816453021962616596410396813316064685579412429940019071114917828928080181638058444302439626425155946562362550070187433083541414569447612195370911498321149367969974762244140788494955146280201020345849385865084095189982291190135293114489407801749533448443222584092575861096946605418438181411489276/18262596223069549313969288693970246663726147886364354584825624311486557881239003216971630599389642752648815377795018130449384513824927138566203714891090017787258920529990523519479383032564209629983810866231367438270859421572641494420831435563580050954867101292568399107965982704216434467243223964964535464624988344342084084237484262612100980519602625","752911409358158070688133336918078236438086521781731735123294741731669530734909563155732092406099003582749182967246236657021875488130304108082404134004381196925042617909108654109138702993903561036987511410396567636331465803949049946947888490287210013788802287247422993384874670368649616782837096233384279817294778916419067404863458318451722971117669642134894906235066332205740872938406767767019265664/154635332883086377656813458754577288834216641577439356891585125701020579768315520324293435008561626926046988056302745604248220408154454267643222328696606367409715369481567213640103076112146615938180089303294709009813772509602954514391675152597458428326644988225555987883250642389550531163153338541870029415077982539614784206119074702022117790679351778993541426110436276530890609137713909149169921875","15286089077439918584953144558775765002061832952090847117286473868694909713791678395221438112006475047633028543501632631679316850512797978594476229228325228403849089079675681042224057234415951253954044235099139983386056610384489202589484570852048157272551098909455253037561994944665563291526597323199530997923272894119350512727802414680772513760081360291/3135161418037836259442831302977219750614726139657718770206960776514822107155928800694375522572523712277389679035632531727155957120566617736817225541673148354829212969778664144907503411589126111888917929495106029890532891919001138770210977012708107496187227751496980000137223047079127096028939624830654227758737339725345681745847598157538483308068864000","17723482381737693269787076798246423310802126092500438681864673375704464394105734049099094818738115345706100191580982712146882034618103161268453808819471603805345990162762722549964406042295355916458624836894291267553138041035528315839108252422478610879301656207772491548742981990469454529537049123948604931661837539943536878260665617524824604291547373872716194154198824107266275716083848262625068958720/3630091565725887087605600771358216927099748013831912080380983545872077197366172619225751217619097657405660172801849926220948413919823038425519006413005998509677472226729295278652284861834178791332630676772284971762683579047508016687969040658592436230062049051143001484384767836353233324570686249824980508520186643477313941054900197268584495128610811273834192099099592687485176400539748616360799518357","39160514032490258389003214587901781721548011632821053230881239001436341012396166857515197251499460842954863342641015306304854226194551189224721257664420778416733889030680295206179109679627522113592373938602737416822981698362363553492610842201005420727750505681358595340127099855823746410663750133019743170700888375554918213182862789028531284364877435896/8009919337434786244380818390213546866794958389603666737562053423775386173149395943310276429895991903753441584557917565343673605019989336264748588735390182130334278887642569515202100870042209261561001627386525182096090194076839370589780431326097965428311786635366819094633651297179987340498215947144870164066409654464551017761658775207392803825996394875","18188388167811476762477659006849121912679763597132233588170406666718758511478154418948855160838212151370453213943784067796172102916618102024199200086478021533171984254799008541948973652219533819511807681148179806051835318645591102296256347927018942348574774821478499092054497390790734798143983945096982240517058861467440217558586822663985584775920517755909444876443211404222400335500608733284461685888/3715278241795087610941547133490827711133909145414878217965273061493740719983191775105550559905283733134189195190321643965858771461560130864714477448011225816210219450040558581571206711791272284197614810026220745160693898421068168630870850392739817340370146186703867097982858560347971281142766235850971837330222970900661653800041795020382847588362774677568059355238174402415384788280852059532958121625","46353430636874284402376008361176880938798775506236714098123916668545331718677407145199311191108199195405139575147933283523305343027297808443653460575141799729554209181454676876263582758919969948546918471128299522715691694855904535448703118221685887195383025133924852224568922999317583667985459047407473419196367812949579858081181660610155317911318937349/9455890179897829052705408931064120820559254220394152447502395298827357144081378513080398823188243663943177539817982481713456798757563952162598464929784370305696420245648035222083207596797327498500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","13607414211126412689435920170832779523235279308039712294681570127241403406455725064605210473923965685858012114332021572088551127762628892611459785625407107300355287623761046438724706918300976102581928643740596336865698485838431972050267114940079353996100620311097561405192365496385584164725035842307146351211183443267583872067352881387294766804298681841402861626441205037637282007810811602289501477350144/2772205947240095684743358245950494400934136973845543049938212403703005150954425087866758842625041409060217562878157900197951382737615822655863548356735553650755342108183641353142157728364469706919993519071329069805875834057743793434164720370026073143626055293058601124362130539040404491770346043977106988100969901297669523170508321703496903672333781306743488573086901583022550356345156457496396749797875","23264350093315690507131500726914401771633259602904894387312742275462601574788485574913195967854009886824436237740789910851843045306673524324611130536719802717912615609109285261163220007241492964833933975789257681755002054890453747803418465119567389315754801791950553304034666399677630030683759466627797123971742061866928213780452325847848901682792886840980/4733430508316851445525799359992627142007028326865116523033957869609125212251136452396410236930025876982265915963089597825393317909648054808274488356887197933393799241941120691826916741647173843634076299630884655997401370400734954098249519111198509015387869462198674657171808841005212058822254513429836457539629035675822719720295352508916898476137111981397","538960934807826161927564251064896730663918579817797131801326848839524373936888402762331254883505157846659830555799909822861853145306547699817986010353774500545305596630924815657016569444824389893996399550343022444937690798126189162954188680257730893424775303801562327757655350002001080811866451425665301674688928515041429654624970707803336800125648742168380676815769457467038849213225206824671025803392/109517448833211208909213522579666376007937648875042608355810687327424621469323788799169718267715808580775296460944943658428295481347915131091297305260674731651980547668762317138753250458639043477453950774629862540017034566407286963562574188172753764978963685535201028286359818524519980885827473904574840285411260037264057197155527809916623487144493019982419606308144576939532055057697567269576800542875","24451481554350251656598350124163983489544445991992661049829014268366250968046589127810466483349378560701491445658725080497078590986743512397927747885285095846398852574219367580068049729894667374214861939897557930527646930793431512683750733092448862551580494245486308114129295467976874843852138144539250235632985676953662288536669286915983261820949386845806781/4962240683851186225340479316959605207278948397833849899236383273145853045488131674290332609876751222112917095096150531825255611911377071887145019702433883343849119017643117746273523770961304609989779231048095665388209125939879595509516490230961558353074751312876252070889983946768175488341370453053495319823381943793679003096504200440997908071027962806272000","166591964685609920525429719961758335887941461052357297159523350448241484106515158310298216150030768812873781356326923214637847449893575074813991141092681107583183275003570804134461187213143832123628701876041315736048451374824101256980832991214945762266748755723551899001458245164317581617731332466039757786839492869211248064662857987111284518155462148044812626055842061283907063784492325693994911811072/33765943466859756347231737285768516240749714264564410814839966011490233598006227246396923594069488496368994857718734549787000213944990695920130591750377483911116845697231074543526982580529937081378303555262933800375576494067959129682770065443667091668104132884375840812635624862495548888467575848428463895756394050252457592540570490061561616914443009224917652440212112452400106121785938739776611328125","142464729519206642943985715465196065680101634264787375740459792619754842396453535646509170066091478069799080172299369994438836484938378991283020978342879057271045033903518255546705211647900945143546293360496661466657600494787228476009216508124736254967761901224547269496682078470378676865981855568197705507111970901389105723589666709580851611656838285777566736/28839643075889294346635430272525349651555039807615358795334663734940126053968249608601725991946342449660829847322517564370606746964714098508298705743689729306507554363954348780144675937510900983622836770223945538844314468550644543502501484521561567788992156632892028591678742014134130878101553633195551605796158103033794695984958987367799607407626319024034625","380457154857422076784416625436182734840012277442496600178664323821064977485271288502806124740204295811759917468598315932331219906040253463960961995849761235911145436552991677050565022181516596464968316292789048809559129516930574340710998611088996508613850407294743457197519091160170604426002924022923388338999324182261954685794522778833029950214443271526469607532589775916381786492089432407550224137344640/76922142291839859196033215395526448408989799722090330866256930898223012427332209054699494033511478050536463051459450844520020426942553107946282832072826069342120835351421637970462054707566481086202287686453371483126873188020538661871147778312986131920021929455276187425940666580158173676284545586944833678819622895550345083175685846944633982680908505900099388037050135210936852210263717185637166725605577","79999800708369666670693340813609265988600461251844239982904928629083975986385235816587497657678297663151298709076884516168798694292862559083730259839524968813932151813233366175091317046758260934357096757322369138747731224414176608247605314668045838769433811781490030635374856042786947109101585097035794969502111354126773165391577217071956928171336060247633607/16154850265413610119312596299635391433380319311682208755390341659152160578366244774029302281068833963848811596545791104919556346810193385001196395489740571188884873246131813864782581356887110499639544662322008824704830818136660544673293865921754569356583698951612797219776290835161780326945625621758204931298948625885081325268123344406261740843197232316416000","26517014004241498798848003208133111307300592620947908933072661812816683085261359696887064436611747292468717739609776825664344064024535028242737616786238200200498291226984541942836459188328346609549239724653950302145388877472274074665166631509490297630344351573245265440164082334092997307729007429218385933622623935704482371360985836659823269511115937443161532987660855490906546130131716829909388620539153152/5348257529530073524280989257577050878033239486885664777340947102417077875628238501791711336803418503616042922880218860266611595594400020206192599559925169589023339295256084579966533260861249529670141854632965231468533448709363477120437277477668173149958267956654411822360053335695956270719680086524322530514249891157439878407417971839744392044064720476417844056346174795601710447583861127956455406902139625","71197348290771978405602732839537012310626009318133570890482364371056186523989330157966045289127980687764218363064941391483781008265266963537623770685390148810455244349859354857421474277963009857011653865476081389968122418691934354122230780300833008753686234433642072919923583176333668289998661499146617277981691372057042930131717336250309680764289256080895092/14342680993892886303954853579883363225921109635079605392320944523109187641283117181461662846411912306480691901515655220490850586434947504504317080144378185989596578890875561336496479576651516902048606328604696610314441229321219627021610788398730173161473456954861916116391687748151443335513249810808309201830214153565966339609616397865465842187404632568359375","342401018754023891059352629509715357053454506037284788725127073168445189422181540408896452651232759821766616850264122591225331120588918865882061344322996688880669665450231982002597398732201789017495427566260651180470635467002453249479483900268320570004293679361696197905823690145326531180324429318916092471863347575533714871355651558610515931373080997536792242278529575700808878786732127630024064418468916608/68894647682461956089382461406499759613691148650738957016015844830333168307020284281532026442272618372290646283794122772122665531108484704223311663270836645399554940741928358317884620420886609705267248656765357348477857852684140561714900614303731786621656041881975328169543884661780531057279582784036689401206706069028229798913082362331334839997133771880514515972024899408556517159759907883793675672065360125","190286571838805495686895463752492174798162827967490343625540320679760700551286395956241059969689020885714190883323266375067607282890063444652926151862650426323339187596278760962390404656342309737428214493422028545912504503974763216230927196187743439226243880933947417760147785405444976177822143722569696182520826218120595298059020305548681823408268556482981325/38242608291912408815838081993045123864617058390583394828737640036167893859507494091864963383596867701436244007905770284939991912884465101575490548813894148831966132970730263562113961685364216989999844961688441914455435934703797359360780356482629495214859917249465567846934284121032247250332634283689409883499295469118485912489058982596725212975311140618764288","15345379701153714436938289567639102307887273898834051456693981514956329731572600026866162286097662958712922836383881840211072389867463987895894067288699955858337488812343674818565432780224654423872618380928462939482247900055572079914753652915184313685270722583926261499687728814560680092231526501970431280783177357735398580700300402036873780385926225005561766822479878280891130232036389707452005183370152749056/3080426623087819678602049171756961824196425548529619576972793653585089380165862889092832375934535464160425580449193072125955685099151500755278763306599307218302635233595329082702148677300945556130106197481236122437978375963261172524503625593066102601042060541617791008722569799735202779005407381267021641545644264334109052258081225159748043792288699674153722046659880085850980843460715080965607434114275256125","36443601662144279337033484452272105547257065463167427418525882851507989449375452076227652634440476502702584889057376829320548464677623038648843251719168810701744338735202853412651160681259533015293997501525430222870696235141468274274064390273214484922080219643095978640300874086585386991338440415203863901714217818222666715642467237183267303214471854472286478344/7307237990148312451155090506264642657872224684879860008436735430879314349554023096366846856470375025555139219961666754780864835035902856314981482268319886395881809659368275720375576152008289949085453326722156553603358879420820012964006978808113307340321824660484441618487292138631579616351777191144073820686595597986548374588839763719082323114663844043046087375","1575294930860663922843149113097927168024893739962464327016763741314068438447271326302129681931564068796631337571133444163024224071270063174829664848259482066723104251718808936762938249028582992557822551950212098797718627418782376027133576209718376784834456568694813577764300716139817031545408608110880973380162736536313173329973171844528083756524804574267826691156368696436273087171467254161930265910972517504/315498546654512047637461608750018349421492986465373840347519942494904200733840189483934245529561231604050629653992944140351106887747105945984325466452136415067807666316202346895657914393512001212656936450425268507235863153258769360296536050028695266363553141327896064944506216017933135251875087069031098099192325817395958019524956320840925176589616439477134480262100237057953933117460110224783420562744140625","7692057599553133417225997786980128299372439542315125030077404519679450372805989755158000864378924877036225189784045171045139667691524763609840822628706422918926410377185494048355128046783294954373197082851501927410350313585640237550107070936498164597231431242858771457898152684298047446530220873884022213114819556822050178579707210264243087257050468000092842761/1538814487241112760739561704846381585063002784795057066438330325566843108114787083741788078680861495340026117682606689156065008672344707615420501964123121620401073675430690541617930520947170306763541251152854304975131871537939618684186766168376514664494488691311397307418298556185724993104760692216619178358268934740746932420562664234738576394742559349407744000","15190836470550557926140012263310230378455340797095100474720776113765300081463960235506950799869073894127884189857505951314428810423734978025409205413789025720642609035117121385453856877706229778165533034683130064865256448444765902482146676668197546098809055341050873494446231793312407516463576380102073171090898973046611572020564659042146465345334273595086941562425006763960197801018796906114925005810069684480/3035556598829526968124942916297025416522606357010637652635799096498208643970273828496655227572100159414352020909846298817521082538898702393916708804775798552206401718323929157863173504795127180177622667376867235806208021329981136637175570409791442328468473111768140746895005561471574356889047981458002257872092408771959478275534098789982899056118498417649167444480913552548249005268380838457505944462494874581","2923754549090941424546974281011770689534961442264350984393235983189168024079617848190236639328676436485460311093391982825027512234467853098757486086492333410753919927528867817406389678461354257841007722472106464785557179844602277350411593959136520732862935740433163383885526249897183805981219416420390137516812715245569037561966929572448247077578419534651990827044/583599691615378545100950777601104007812792435102945248411439102112424251478512952087517463400054567832353967731887062349496616445419782499817548928078665212077449420216892583997505908858360011413290038645573504472422610780073975450391707084016931661068694024023083417126286468909117254531307085545768412513447197205482285022417611018126886491416133665625891075125","441922815213568908489589193556560586318864326425397702047965372289295962228254658331201274291697626694859414786292266008476137667843874780506886929181835469302142365772763129838217316953835831059616268288399119642314758261677639945004547833810080700127847214666763863338091523753898362699222880772298183760217731228628442782431573977490761665091005756534420789258276075174436091798475838370152192077494553263232/88113527373573049332749294663402406454524640221866407165839162576979477138694653404281889227416977618913249275712917582743426231744980461918772793673202077716234026090308791893409200158969108910565467273725064769890443408324386897017825489615600787634985397885230455168591240328585041836771921929567914891379235573982442311269392541694564675053636078990836491104116280492254795616055818375774141667319774630875","91197133767962483852278456285591810579974783077874307589555559715577599604626819245000672929518645004771085106770784762994476973842713035791487204122653245797126906189270204029735872508462106527240320932458036231707311992868347221176460407003487373754014365881209649632547685657666691589606571865740595829983849941049450471212387808617247938941417000965198123059467/18163679611214677813643455199979098261849405189805364986036911945012016248297645596270602508015864371788974684317239728239847888960155365342460843559658233069613218442910226128113196984801126248862273503232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","733396724434554481470656964167233690851279923085197144879644750437402627936723531635898542414136943003236478432848965516925891956615111678444586384493883113385335463639674699443808084827715994137410743992130712903997815471369201406683862985677774155704267039224546352414417632475628136460919900347977754644214725932476856018335195927604771408949980634142255497812566866795799230501026066145434755838336990365184/145912495644159810313026420025053989609942265686388630266226856650796088768164358961644113076809511566125145395699271530802891523741636707532676065833327082092521989958971154798465784847092870457944857590623097781956884297103961713362268264159015928554707158239398721416218953003215109202771651993622244788505649098445109438104466256408060944298437033058380804126574878377874459371251056800895394904459469832875","167606423853658713615749101123336326908381619586838606922565378505211386185130407423587264776519589295420758009764678759213587906216543160801059029133457062067529468464636376639307690657945597847080706144898920305379653754920571797771178341550808041652360635584401789901525709166172283390177673009483341826911179861584213314395893323035527116283758445038413646757280/33310364848744488727470761889861069993071965180756187311178124887286133554324042422503263994717993129539448310743598138364172889305532401505890384806078790034557049074169245078416704866867380089103064821732673967120808611636618526737138435792818828990403374766228037003927569643972203993263329403469747342204808360947840103843317533210523853631711601450617095736473","22466735478643771803624909352181817912387732117378538284107485621001246177152644141853604633676939694208131243081227668237716194316732125445041260568403752325416203858329469477774720998849334961751541191761521224644520742691981372782009394826739249604257098248751626957528543558542443122470657230835176462612530464044652140581367666271771882198747182114685116336512604038833327707163107207664705120728068987996560512/4460342260599110071819142535903990817893424192972341872394014748315090430999224107274777695306032783105944721337053156074851240201179902835353097683269298594190456286888326067932777720561181760369783486872666974623910515795208353605697065447942804414120030678603538761538385793829787734830129764152263691296719726909633580318897787729004972323599773548689272008712427926734258913271101899780538635213826239542884125","1972862002066252798837977155272535342727415329632252213508267781390870646909686724955861608046325765650407340102472833428905279473185818898693854344138403744757857928883601637909604082588338869612221777263582365745419719805587946558326048087138197694016224613118304623864709183681172362693106460535117459192992832969130895829916210933710820035479169562970982784580861/391262854245936198649509275719624152305206807261382621390946060636032376057385723427601113233050260359684153963520782285097664628279596618521963444574543409076428660874564026651742234728997339844161514273669735686516761239076529088145208958938384732800586298943281728435207452253170935715239392534815683367114290676180839217919539381651841151674859715992309727232000","25408691426286653276004556426513401767718328640048945917745783225459709487487356095164164652218100925888847689099153320777389381851598236046402124684511968385325107497047025485302333503075085562533472482645023963717347867696861885363417595298751490212495932766872748125111115039311507374363000062513977436921772096443948159289707996749061007112458126301618769295162649600673247799961118662602756889448152517364992/5033870770817104909025512331238419776407331281944565644457345507262881100618908405924951559853352841154730802006750688581603270849880756026262217651685813584900300357685874044482329601894134443542753690048962260914642678445058891387041919581376195543193199307524572671344323361282633828144708683536721118910549933336800461248338059209853766305058943888965279863852107507075916981165164543199352920055389404296875","616565940481577765011174617619124841631603944267256178093555235591208387588894068005162766513720546626399308168923904625210748051788652328072241494243040185611373035059619136712559505023703153194815611268503291295059648269772663939137446253437248541496631852986499688052678961495116210133458596866684413931188348798244969797973846568160999564540652111599082181871436/122025682149627484528651507368051367620578469392233875493556828623437869650284356703295836998178256875766319508797903923638967073687991229708051285605187358616531926112736402511567721889845693991963610192161413692928378708223712791930113386840109729368772998347036090902364801014045328348830748307179590755723160142468563977011700764517880467116766150322736003147125","979882056834583241477188686550561625289337025747787132773853690143359657519481397575561812727394470125172272246774578404543257210124412718725081536309818383310896102958167337333430555168671327992395916735022711297435263157670501117734412587691271084981140167017421900852550822579410636184333142944411060788723653596377015359036101170054828623669169047118551010102258802465554033173968468183492058271365801755986560/193732066620504775981759812703028757608600125742477178751189607602983198559778039141192492589734277739017909889924488699372940787977794555519474807920198944109549023547259912324279741006975129518191081373554817584214941629021088206977532599055014150433581544599721903881284581257812850697423350805715586436114842183295730680490110793225514602133304729484547181740290534056445482186430729398701311563285494964645419","1138059441890428903336718712159907364975959482163004276901676063186939296217569849990951930955270849692775077813359573394435924934540269310629731801376134549169322946310756738187834128956671195358413024062230774111935109203207768898525882417078119314003162592087920755572050993355843681931139257303484526223461840939880759908449181135029327442039666513325916729112853/224777393704985303260433439401503507705148576727364388720387174977154204629336985298082893443205223017966145098064861566754244624732671470935725326043491911142467178027013112527668183783450932992534517827863293825061296257420183669383719043873666284378647952385401303733274771042385666436214517205678674213118374889121542369996042313879258622144464565403138392064000","614262617634904509410555695398092190166323289787703954329113412647342230855826568873946233136303566178604275296873234926652080462259552775254755109931312516616838091852915397846984381183732773411263828600108443070778861986849272794442105107285234729077818614332155890946804257724112143631642663084660012362691100872465148864413343598067567142977134846266425075195546265101720326272502009234689388355365794889444257557504/121200854655310345878069155190734381476914416893031941761756379148622591310152793328910334357724762079139509813381997287954319983165971628429295803162563856219211627796200599196263868781937234015821367575512548522790158101892507996780675863234181700253545912643548466256938936835469646114659598727592390628209362096738343417775009361678599075671154405137663077798419897932404104579113056038271753988669813988076515476125","106893445531995430131837569895703697604978445859412739331042151546083234373443601923983714252801103551874986033841637079479794895452077803182698291822629713500021995241940133037200268381793282318691568234728329378829301282121562652452936297422136961147432559766896143081059518238234777055931999714973999553456547746825617168005650221542417216291412324174772893635832/21070287546583154895102927029203125577385528350171457634203261197137238923923245382493868134869009844094435068284335909266152042903157700510534904847257436666980671067329084409346149729385625108233234542133838924281113454526471855573271066865534480974484196644173270141056470857666632902827625475719738076524047736123182255306429677688129231682978570461273193359375","1112742798776748551928744983308584493817112400536084744850969025063360679785378789764875076529575583792571198510306186417773101346425704969671256564494135750783642910394213727189639661184379341961737135764570942961692159177189753139209638929302928699705042832922774012622017270172331722295881412111812933593370743210214549038212395941675257558442878012136484052827439007483777859391215222647499741572327725689840850048/219121905514652575155579185322367175400669386131891843382447432851122462422992147756333729893028362013318264155489537138133372703295804002840920402482110260590055749843170064921843460498824128274420925357547023876488939786863662801268798987685503391058250902634999352652063668663245829496836853509616873246554292796823779397317819134891873583857621623143253788854530146303641400986028503534408870194989478421253057625","983995170259637497940121707857673268620603982844439610076334749792119502557380361624096960070148627663305171311646851566811683351232268240169848810658089698606409195744471343416197434926513684882439596141368794175162315633192028977211909698595778839497844847281262559899914504080092844816319298286511436690429175757804604673752838786852277255064434365401871903307643705/193579499709739777577893639665643417521924510242119561765932078835121983190401762561436208758210519231103767232899529457440602166918701550386152070813526760823513884391055054076485295945972185402977095815609448651316824455250005505410192101148149284756928250258632031981439345164037318129987999546683113483700660879431801728391911161900686707231543216283304182063038464","30691013076836380319652884848585431917439358375118437035944950498156836885409110087616602043242747413728866747975631727566613593257623099549583001362246649928075859944695060947434885707102684568632559339383409378997568182445019183928058902445738702610436187907199482604867148445903921474846103586253320950728989228898324829144701782792767763794895137313050381112872972806712570559942583906619373159053654481250809168128/6031936190594376585238407905469035598668211679521553144958053099463931217856780171872253258738635531385711702176347575597387389685526098889278278029314982721284691198967204664771178761416891317672705719303088746953644978471289001577698554025410820041497108311270431130911021653860874238212040640737171103823631718483572464361276703378587106311153455557896527384426327053165214814954154328483257657424873929502112904625","33633002641218571027682690377239300567277297301791434890431645909447040830457253186262970747405514897340315490970846553666201190386457221846694126637998462873786334837901001833771510353365825087187582807843940479192544772559118293851131234910638705258664901225494129023244916125545283621607920983287799648992632814461828998517949449887522866259724675318233522060729654796/6603800575190864815125307817934327053530311915572323544225173935830559756077637251538096164499112411672913910767032482188570876526606118068929913515497400397562722669603861813453418621246538114872330536044519242663538662076583511078523573320035084744399535581216815034837553165853576616422592790103728141443697362408727056813977234078214386771115586436985105038873998875","9090550743395453237608373761422705922989356346696677314277463900103283296889488490217663400349361962695279888433677856471792856853109469433355422802663947305503479561493033851081993247556828544308258821557994512133708656174864544457143793106703578476914924328960109390350040954158797845288786321215010324565010420734044059968931558099077932776525974187717655105951506223649947806568984848883258144616897526257038550656/1783219994432430133950472014582130883873515063182143523712063859964133099770763874744121895885645346884371273930727450069430704145915261127061538288702855011220545530326588799412076879985026006593893648911637986337776174555198865379578424838210466703683642106934154603710587408512357351455891557594977191641529451749437270208258072920514602243985184744955476557012910446023911358037761232253615162335336208343505859375","396226087129511787616470716244996965529391571019620342657409150252952330537366537352182763477820160355931003174946109480036915624974500187179367618457008802667089004678925595775249725629495848146669773574395699032785024522882892752987825063933573399691764866816284097232869198405981830106568826923407996367321353003569052419999880089180418759265274331299787468134974811/77651132902382550540201641628906752945078964002822585000619340261128555048628863996784740469908853602590877726845475670110127527874088625214912598995012971630852593597027649154487264595100300180591016581254965295280089902497540043916128232871685159131211213497239568483141031137909208031392464815187505714066235868748950184065923236670418822911614780061752905170944000","1288523130900767412477856952035690867153496584747510253984686336382980221603917538996138294311274357713893956725672062832264871415025750136690143411884111580335458539824573239771267043414225271729141508235839982033182605445173050590151912297720800168687369852280323356691345317649445843078291369394324862039143247087442309135074453265658730028145500871559458519282433012494054724678302957276371418936282902434203225600/252284450515080370603949213084529993395050575951188044032908270470514999880554862449223347761507020354321422785760279154913310488296485989979706208254206974075438570521939826124860483842758137231373182496438568202110337751291106165654945352183167578675508602832478752400011567482434301614269579368882858973850914513870297071866544875650189106576672289734326492492059816669288907018095832842249738081022227281715919357","559506782175368748187145067236900803925823792088293851453005882621173124590368101213652371965740365119375069053747415415684193092607523211636912074219215053809881814859129515591479780669511533619258835199715146655774919418434080807837587396115955105126806762961292429904380132116986984435528307613054828929294602185927322238461491059740342387266084431988727321711184308176/109446188216864405154936682374609448082436347600301765944233278303643744736544109262794383069197271409398615846380701459882784547857821831816863216080069944818453908760476475874319791512782445408136169878207358663250499628002971644430164185578966399908622640732411885568638054229180673755690889471388585521113862492432946110902070139679164884208988489955874131206343597375","365842109776085256207829452385781129402656684569922320812625438296958174120084800064669048017227033185969596458778213306152397766619692644694641677223213185977626940193107608138827771259334379895020377700759789774994800008933137569543592829220611543060189849601828342989023692876182148818363689293009174358168826340010491728715549904988196347316703985894355217235339548078187164176255405596310602921647203428200269666176/71497266937783826306774367225149833789788300609530680399994804704196212252148324552193149332755057982662844988588678159610516634667597707204818296457616315484973288944637139939912166034691155272078609876888919170894915224022982785138928008133003473320018151370486895637936102520353951511525996197267572355782608352075229547764732602557133494648237258900273354364050662921889937355682486287799239363976556848320046933875","59378684894605773397070783936113244261297966863668546282887298999811950599772732377979382620766180662159460666220894896896564357533604962977968843474062092083279165837424210591042655271577974272394203253875965589611493384384257117088518521598379301169916060951350650621757237206805037261878212424267780312614942173870651684587166691539909068452932891649554575072205080763/11593916877920131260484148322810317629326850763057953025674154928920977965095141485536566217873796019006709247938019404840440511433467040918770165456925609124166970862430104329357419669175323763143377917913760028500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","440706629842402075137926797732405268015915199334341565218443748798479563505125605478061664327658137598204192554352688830679475840386882350034150077506804799859586772904929402683276898098601814091430598259347980573084686932949502809068565420937301632494387691284902026088950093888426872222813857928092871267130505744095697172494119689779474840037266295586359244899477781345249657455186847452249040895151288114085352974933708544/85971876318334010542313048056773419567285701852816309711738644074302467763075671531248793080425349570584102078764464196653843973936119037322000695949209283327606280423406302517302874806092835694196353778161663338667091195199032831587897410329509487165187753418615356836636352319310103639079123698118997500068644500893282438137614420288839230827096109835206605385673197123994357393257304049093683934224826006704198171592304125","13220371178312284248107863849287558696210741535280184003301555188086761767176560823174196915070378763091889333203635784037294769747641959860810039816533609140662043493962707445564057197150603226797446933532133956054671103942520142568674339411250001585991743608723150284270101326419464088290151483823061613403673956918458456165552482913079283537536214967294211244361353060/2576683013797055224377707713704899315377379548630511095136568220145808780162671473907260623503552385384482723173913562423316997528913651044277418227616447815609873991028073011738113927961824632868956802271260292075825561646156680740323686126811928372672670917332613490241615850953660246271541592056143611581223295045062157404996958100136358649109693659623847024011265147","1538372578072246705266078247950089219881197139399081643650271348770110178217959856819170325400476655944115553238940541695152110949081675985299189913515975242840473616169775880272489805123124548256666658584129873597192213080038937409046114908719298170078476325423466734429870048697383304265342125425087105698152643145531760853127801123272389134514333752173173161562273487752064850461823726948588221913540799816489566883798912/299566102446745552813544808169323270315327122249327394279467999308669285416179486075255023523726449428151807672528368606071047812907935426406886253284580296349349558797128593446316786243666290649442956134448480598303527795996222703837663605600624271807461605295956674925277658331760000117761013381199880905748188151556184620779667670278558839116983636972680749836497346863752662521197700717702790359162307617024566689271625","281696937222363685333688097915539146272117417024070728031063821781398985795813333650547982965341298894634762289669256129805545549280355643122501181852136332529515756074502902204877664395456278205770206019663082511098956468724829475220996427130295010430751942126263620206886404244432409164651524408198286831329682605959881993845189585640874220032515465014097345759490750307207/54806274927935495596891312029173862473687610099325998583092091915101265393157631244775387832621032230434007486602816972765210205596482942091518459849775458089575743699797096697542306049628939919466378189656065461708686421130956996965004776108499273871055615413566043083634090083096967567965373203683231171594922347812966905149873265654962896456451681332216735396249206784000","228506238533410805238253122961471637501498406104430046727793420497895852412513560203475440156216063574654372726194215013407325207763369075250819386897086702757125418327084312933061738392406321003231853349865003322697360659712771167066453430309997639548320673279964210730701373707765051246595806673865646607841876463608039111252607452843372970797479959213447237540830563469297144446069689149549515457318899981763489792/44418759813188470246596822974281932219088697005123285598909329328419879212164564561558656547678211265529803086702843380128457744445765859393426675396393053094588240457569380155526179040891009717323059641035189017918495485630657360525410506453554255734005459614858972904374739673834145083512160883402151636664208253116362089211658645312778404886460203600762546810897889629330022309705583438699250109493732452392578125","2396110297187570506257836426251930521245117960980667897194680897478996322590925380310917400763581787981992131769075961259393685331523600287377841990678117113566991100720996059187144934569703045966210306282348527729533806882408323961336166190162075154579344185244957673138372347997134388801085788353482276257401005734929059700346687783400772331280644647089520646562669857652648/465370154262863030800729180763091967573522779260407615567563274096037297593764955820626213827962697601334935773802201919483657310282236100250543992334865461800976838791035335861420892967699843608855185710753433852279737724446294443337363478679601049432404435672469098850676302728116369979460222148206944323730586138087862719386327396334468302608499235112520318322763857676375","1188272888075247520453568790651819187486389546755745961952033150576243575862120569399808467067800830890874391487822723879717525264875722720416173276963170672622214121308038530968291758445510982186014289745026439477197148445087614813262170975056866881909056450023324743409114115141145340480846088869807540798073417035168139476153897066325127540609756310068558610112731607522096096821938163134080426356894899245575410494080/230586762395914863625709048789913840511134004337945700368117795195769576856434588144361459740833007125516905017415184787078710001969815416281381427387949263792200577791644278234661952852149216540491852757174842146376788280677956350901082838474705227642420261641783722891948710833898248566893322144435457967452449965772543077421407816225704952270697016152452032506898311260979594550143344971416786595888053149375287120733","1072184299258468249004114536023934869518152618369895613271618698908405514630154819453979477077738526673716264830106745031385951736108376866253955319711026042389282009348594845497252059906901748860111986811345742998968284077119165082435598381810306691078037018432766116865792677955520465319184311529667642995217214507658693259694586107847099911341219913576038605872218680562047/207882129535607118520818565811162643811811563516006836924341123976848022970024793004700710992938987476728640943834012473687892481059618823520721737479364352887178017866425027953255856440099446112508663603319745066750522936408781591578321031173620445865113295407603090322283539974563690157418931060565698315406021569491751612761888641141446406531645379264720684248398299136000","158094023904374464057702010126993231151433474361820266584020400101533651587072432728050776506672527718975042616651177034635188178967462982926261516748842073587981953038445977514446838733557926696939591069712397947055261777416704028506441173540338327591514650398349069348381309688677335132100441905603664282735310299686268721634369502296867409514777359935022301425165750780988231639828675424239931533849896744198012747670272/30626384366513923671063955469537776291182594080083494737341604579575446319190916924682809546024369330706012653799783122328775875399363759308193432327358837772825609356553955350401725689682838701996446404559005896479618311357573203081153855961484398360670837599853294627153740224543175497655414585918231215639906924313779933211774291565425360415684556655021031131349317390382320286092667852173815259422737956767922154798375","12216278924286401897470540169822542417611356797676160128176706721343511598951866107858729405615631246003458062949723290192242594609994613705183460814797527214549142043573863947658832694800184691222426521703728394203722420336773310908687071670107794543022567943478843065246011544888390757810534211554666736239506503613750756246364621509359804902243487113673014588325806249988332/2364584127734680580481708368927921125934330000162935118371174269642831409084634375654239735054363928748162229294829526339927907778510530444646754603322373712788147193691037688552857183116332292048731726305451516954679277320777955342295564000586923227775208580772868590742136150431152495718132142742153643081187691849828217592954519485869135930755646768375299870967864990234375","578939195017447864385837341975558679292903716580114421030538728778491606282153588930983966100514147976321305616196463174070345884292672842497715966933722088536619333912687108737657068701352918582656105418491672377271304970407730786932913490869797471081081431072836814581099271832696990064828717287258860166842791984158634684078346453202928137987930328826212011774670396356151265781053547412633310327737900786639842674288716416/111966291649651600701875186827360807558960817589719096407887999108024557254221008849510152469119211567152616745769256123968832250104006560061907741567034087109512483357851919402017950812795426393415409198268246337542639470834168040295134130657073201020340432236723824670803498949071870597039309004562024033656488150406105175401372709011082725359382691270659245312133919518760328422827067578306005644825927050994860723405473375","8041514821545833865350873212853873042112343327573364523948780030849543753072688526717886590013028227714585965095216381829914996539132359247488639692828639170075726301411777307168737667077730792892326979446426349813642680537699905651125068091362135055902152994216233622733424128982011248923051410141033146604688083721413402395290842738021365861670415833356403364696759583009635/1553937833499559104910551811592138833189892464446761247731330672284191313590708439680460540329836344767557599746234213006493842842879398684745864919973051635127080738612248150108793397855113122368507483429209127035263504194847798809612278864438287815470711036548695032421148125849669175729331459149833945183228413961985381338162155596008680906676498435954178226973272371625984","12059659399309169167301353842123191409306995788633965680414620302285606896146667751472818541537183787935352700725982053536032930866708413010971856856768384974849695774437178790890015242323873769697407411558706626105140596160049735605389301414460825674631122462760014451298494875244754354054447697502521388381253293175367558014453865905104467382184997528879171136492277222127399012368677604910497789360212571238146627048080568400384/2328494054002703067219004484782931471919751585969487160602269605916676223315055450845942763690581877771159615428854802721943114463834992106300185328876910271612375509166975628540839858771078495267566008071532876816826751069408153323840515037497664871689085370699991860738368371510578076683395101062439493831773194498579620513073693022191702398601471237166387045790480861932005012807234071429628725981935147069738988682858417182625","683009426705008850682549700382901603742691705123356866338951397347368059105140826655486518416578697931244347554322654428162554903861783227680935341690740579867651545205562690172425016836559678937794312287639193745517811234257062356826622207475918293015140472942579713388671782202262396642735640315948612572908444501108579457520714632371056288874351015666995549139003946314085696/131769214246522869780429817236150406548549044658474416909806179734873399109656411633488099249198882165279745627038984487365589625562901914030850178330133080409420340227179447548044572594184601425691821617928130423410997853384425373999967759499571890326740433081063424903098252502791477854302204200941376983295622430177445507316706609802292121282957519571162158620971952084486375","1418116259749091420309271913909337143756589314597557128553117870573928055109322864794169592355058370891251425125187770724828108988587888087023982451205475980371440423992838481547236638456717520835668859093413956339261802305597694403381021863258753441889536361061407579332570493634254542013337999844407181346815549594836374497512447969751514466481466717590255369810506813543577735080228718660747940956248427356785784199073569408/273368882980516556922532339653303822104510203916024760371844491705599093435133738774975538364241630079468712981056336655766117378160822393876348755370711942273876284944422610974149712212944211513462921649872232656449940987552227525504529710373144228818606127541937831103642415534318303187393593236209298242574677293352798419428712873685798636474667204083938875672934235816396371477146089168375198141802684403955936431884765625","546411077581845999248238069684194831621691193366466972898628141511422317954477211865167402284211971296286346492698354214043840080181702652132835681239302798339667835439189275457116051279366194551632712819028177402221815140045210690908631767786711675029194359998826252332434573121740830827417293557234891406021102083555472155479148332697839972702631641910213821827820374586459319/105246945889799140338072754365901705544530661781295362563214285953881890233987516230568663143342952799036341701952267011236663118111226623815975847494372076420199418712941018288738590264475520229651370015377608638075866459684692488079223686296541020897904588347083045723167762682959422858996673894180805702299907478685374065593161226849447131100462022089783265346597553176576000","2398330640958841474772606439916070050977544535580605737383995160447105736276950196885906408317628083110923322157113892928963237845914017845444295040924101784423382681801754191301860383927129006953354739240926643562987838836997453985855576402628166875869041032631651591871962852884189548538272285387092843044669499688035134181859376665409767886188304314888753894905317929877238322615838524354191263502347881033855441181420399360/461588070868590122892265681879734295007029130965626060552783760068897000195207878227714842617470320231527222074701444349530952699708435668339712860464533455345665068841333232359698449088497137068713309811942968433868609329301082001752617420002377892756821532220676085014874112083615054550278903960627185675459015343606391094523511117705747842645927349130302549554534056269331809016770715819934970200483161548527932617036185253","6041015879424725383006424536130409209607854044642113747266098198777011981328765528361630516108680392500990580908509403483891763219659726090675140672989657743882183951954294745396417829943469201306594018454995862321821016087416840247422350906412007336103086620396467456181771583200365740253389107968122850063607085957109965406634738740996318415514360956028575560979203447735121436/1161752799109428422288020947061281540989708937450568100764830251908850596717606701047413407636907934320789870175907792017513896999208892282137299070761467096211814586909598705615312819596495636017728313513520193786266452836805291464826226833593878504804389728477191170027729963773716267868284479768397603444919008915279522376004326398403851684761808785381609370767169521034383625","13240077436443988749179508462267267187169441948722358165090554769250505713747934643200804819418670147225695324432684266924694524337920816452346599774452681831320005286326986675907899608537972384924882996757503264622991355949039882526389342174307168805166215838138277557052303430492669193939212362638263582899713198716541723383138016564027766560215944409353427176135895982596327685665844815618402881202645610620284792793420780517248/2544223084468158291883698813309541801455311468982232546872485444308211415529998472787377800559884210837213042932180479090277285630234238711851480232520137856848809986631784843528381778520727465146661792797924458540957133423665746229799675650290296217658444899605236550972043549278128087645211909479009099766619355677984218929672461506691980442071860591767266913041147587815452007726513853820116629482732060593116624596368806566625","1953999166296955830935495158735359200362904181792947794529339487489730042568305997099959302322956898299616194932283060554261566410988618045107398092345476532371402134206635235570281738377188438407703089325315446371127042537576093536896282955524842632708645655481028161471313608974238110718242273935956977555610147714316158486553633871312187084618154014921190595222799283957140353/375191165084882521037046014569185165885459082629136124177286500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"];if(t[e])return De.quick.apply(null,t[e].split("/"));e=new De(e);for(var n=new De(0),r=e.subtract(new De(1)),i=e.add(new De(1)),s=0;s<80;s++)var o=new De(2*s+1),a=Te.bigpow(r.divide(i),o),a=o.clone().invert().multiply(a),n=n.add(a);return n.multiply(new De(2))},factorial:function(e){var t=e%1==0;if(t&&e<0)return NaN;if(!t)return Te.gamma(e+1);for(var n=1,r=2;r<=e;r++)n*=r;return n},dfactorial:function(e){if(ue(e)){var t=e%2==0,n=t?e/2:(e+1)/2,r=new De(1);if(t)for(var i=1;i<=n;i++)r=r.multiply(new De(2).multiply(new De(i)));else for(i=1;i<=n;i++)r=r.multiply(new De(2).multiply(new De(i)).subtract(new De(1)))}else r=Math.pow(2,(1+2*e-Math.cos(Math.PI*e))/4)*Math.pow(Math.PI,(Math.cos(Math.PI*e)-1)/4)*Te.gamma(1+e/2);return r},GCD:function(){for(var e=a([].slice.call(arguments).map(function(e){return Math.abs(e)})).sort(),t=Math.abs(e.shift()),n=e.length;0<n--;)for(var r=Math.abs(e.shift());;){if(0===(t%=r)){t=r;break}if(0===(r%=t))break}return t},QGCD:function(){for(var e=[].slice.call(arguments),t=e[0],n=1;n<e.length;n++){var r=e[n],i=t.isNegative()&&r.isNegative()?-1:1,t=r.gcd(t);i<0&&t.negate()}return t},LCM:function(e,t){return e*t/Te.GCD(e,t)},pow:function(e,t){return e<0&&Math.abs(t)<1?1/t%2==0?NaN:-Math.pow(Math.abs(e),t):Math.pow(e,t)},factor:function(e){e=Number(e);var t=Math.sign(e);e=Math.abs(e);var n,r=Te.ifactor(e),i=new Fe;for(n in i.symbols={},i.group=X,r){var s=new Fe(1);s.group=B,s.value=n,s.power=new Fe(r[n]),i.symbols[n]=s}return i.updateHash(),1===e&&(i=new Fe(e)),t<0&&i.negate(),i},sfactor:function(e,t){t=t||{};var n=Math.floor(Math.sqrt(e));o[o.length-1]<n&&e<1e6&&u(n);for(var r=o.length,i=0;i<r;i++)for(var s=o[i];e%s==0;)e/=s,t[s]=(t[s]||0)+1;return 1<e&&(t[e]=1),t},ifactor:function(a){var t=new S(a);if("0"===(a=String(a)))return{0:1};var e=(a=new S(a)).sign?-1:1;a=a.abs();var n={};if(a.lt("65536"))n=Te.sfactor(a,n);else{var r=function(e){e.isPrime()?n[e]=(n[e]||0)+1:n=Te.sfactor(e,n)};try{for(var u=1e3,l=0;!a.abs().equals(1);){if(a.isPrime()){r(a);break}var i=function e(t){for(var n=new S(t),r=2,i=new S(t),s=new S(1);s.equals(1);){for(var o=0;o<=r&&s.equals(1);o++){if(l++>u)throw new Error("stopping");i=i.pow(2).add(1).mod(a),s=S.gcd(i.minus(n).abs(),a)}r*=2,n=i}return s.equals(a)?e(t+1):s}(2);r(i),a=a.divide(i)}}catch(e){n={},r(t)}}return-1==e&&(e=c(q(n)),n["-"+e]=n[e],delete n[e]),n},boxfactor:function(e,t){t=t||200;for(var n,r,i=Math.floor(5/12*e),s=0,o=!1;n=Math.floor(e/i),0!=(r=e%i);){if(o)return[e,1];i=Math.max(r,i-r),o=t<++s}return[n,i,s]},fib:function(e){var t=Math.sign(e);e=Math.abs(e);for(var t=ge(e)?t:Math.abs(t),n=0,r=1,i=1,s=2;s<=e;s++)i=n+r,n=r,r=i;return i*t},mod:function(e,t){return e%t},integer_part:function(e){return Math.sign(e)*Math.floor(Math.abs(e))},simpson:function(e,t,n,r){function i(e,t,n){var r=e(t);return r=isNaN(r)?e(1===n?t+1e-12:t-1e-12):r}r=r||1e-4;var s=Math.abs(Math.floor((n-t)/r));s%2!=0&&s++;for(var o=(n-t)/s,a=i(e,t,1),u=!1,l=t+o,c=1;c<s;c++)a+=(u?2:4)*i(e,l,1),u=!u,l+=o;return(a+i(e,l,2))*(o/3)},num_integrate:function(t,n,r,e,i){if(i<0)throw new Error("max depth cannot be negative");function s(e,t,n,r,i){var s={maxDepthCount:0,nanEncountered:!1};void 0===r&&(r=1e-9),void 0===i&&(i=45);var o=e(t),a=e(.5*(t+n)),u=e(n),r=function e(t,n,r,i,s,o,a,u,l,c,p){if(p.nanEncountered)return NaN;var f,h,m,g=r-n,d=t(n+.25*g),v=t(r-.25*g);if(isNaN(d))p.nanEncountered=!0;else if(isNaN(v))p.nanEncountered=!0;else if(a=((h=(m=g*(i+4*d+s)/12)+(f=g*(s+4*v+o)/12))-a)/15,!(p.maxDepthCount>1e3*l))return l<c?(p.maxDepthCount++,h+a):Math.abs(a)<u?h+a:(m=e(t,n,g=n+.5*g,i,d,s,m,.5*u,l,c+1,p),isNaN(m)?(p.nanEncountered=!0,NaN):(c=e(t,g,r,s,v,o,f,.5*u,l,c+1,p),isNaN(c)?(p.nanEncountered=!0,NaN):m+c))}(e,t,n,o,a,u,(o+4*a+u)*(n-t)/6,r,i,1,s);if(0<s.maxDepthCount&&ee("integrate-adaptive-simpson: Warning: maximum recursion depth ("+i+") reached "+s.maxDepthCount+" times"),s.nanEncountered)throw new Error("Function does not converge over interval!");return r}var o;try{o=s(t,n,r,e,i)}catch(e){return Te.simpson(t,n,r)}return me(o,12)},Ci:function(e){for(var t=0,n=1;n<20;n++){var r=2*n;t+=Math.pow(-1,n)*Math.pow(e,r)/(r*Te.factorial(r))}return Math.log(e)+.5772156649015329+t},Si:function(e){for(var t=0,n=0;n<20;n++){var r=2*n;t+=Math.pow(-1,n)*Math.pow(e,1+r)/((1+r)*Te.factorial(1+r))}return t},Ei:function(e){if(0===Number(e))return-1/0;for(var t=0,n=1;n<30;n++)t+=Math.pow(e,n)/(n*Te.factorial(n));return.5772156649015329+Math.abs(Math.log(e))+t},Shi:function(e){for(var t,n,r=0,i=0;i<30;i++)n=1+(t=2*i),r+=Math.pow(e,n)/(n*n*Te.factorial(t));return r},Chi:function(e){var t=function(e){return(Math.cosh(e)-1)/e};return Math.log(e)+.5772156649015329+Te.num_integrate(t,.002,e,.001)},Li:function(e){return Te.Ei(Te.bigLog(e))},gamma_incomplete:function(e,t){for(var n=e-1,r=0,t=t||0,i=0;i<n;i++)r+=Math.pow(t,i)/Te.factorial(i);return Te.factorial(n)*Math.exp(-t)*r},step:function(e){return 0<e?1:e<0?0:.5},rect:function(e){return.5===(e=Math.abs(e))?e:.5<e?0:1},sinc:function(e){return e.equals(0)?1:Math.sin(e)/e},tri:function(e){return 1<=(e=Math.abs(e))?0:1-e},nthroot:function(e,t){if(e instanceof De||(e=new De(e.toString())),(t=!(t instanceof De)?new De(t.toString()):t).equals(1))return e;var n=e.divide(new De(2)),r=new De(1e-15),i=t.clone().invert(),s=t.subtract(new De(1));do{var o=Te.bigpow(n,s),a=i.multiply(e.divide(o).subtract(n)).toDecimal(25),o=De.create(a);if(u)break;var n=n.add(o),a=o.toDecimal(),u=!!l&&l===a,l=a}while(o.abs().gte(r));return n},sqrt:function(e){var t,n,r;e instanceof De||(e=new De(e));var i=0,s=!1,o=new De(1e-20),a=e.divide(new De(2));do{if(1e3<i)throw new Error("Unable to calculate square root for "+e)}while(a=a.add(e.divide(a)).divide(new De(2)),a=new De(a.decimal(30)),t=e.subtract(a.multiply(a)),r=!!n&&n.equals(t),(t.clone().abs().lessThan(o)||r)&&(s=!0),n=t,i++,!s);return a}};function Pe(e,m,t,n){var r="hash"===m,g=void 0,i=r?void 0:m,s="decimal"===i||"decimals"===i;function o(e){switch(m){case"decimals":case"decimal":return g=g||function(e){return!1},e.valueOf();case"recurring":g=g||function(e){return-1!==e.indexOf("'")};var t=e.toString();if(0===(f=/^-?\d+(?:\/\d+)?$/.exec(t)).length)return t;var n=f[0].split("/"),r=!1,i=Number(n[0]);i<0&&(i=-i,r=!0);var s=(s=Number(n[1]))||1,o=10*(i-(h=Math.floor(i/s))*s);for(h=h.toString()+".";o&&o<s;)o*=10,h+="0";for(var a="",u=[],l=0;;){if(void 0!==u[o])return(r?"-":"")+(h+a.slice(0,u[o])+"'"+a.slice(u[o])+"'").replace("'0'","").replace(/\.$/,"");var c=Math.floor(o/s),p=o-c*s;u[o]=l,a+=c.toString(),l+=1,o=10*p}case"mixed":g=g||function(e){return-1!==e.indexOf("/")};t=e.toString();if(0===(f=/^-?\d+(?:\/\d+)?$/.exec(t)).length)return t;var n=f[0].split("/"),t=new S(n[0]),f=new S(n[1]);f.equals(0)&&(f=new S(1));var t=t.divmod(f),h=t.quotient,f=t.remainder,t="-"===n[0][0]||h.equals(0)||f.equals(0)?"":"+";return(h.equals(0)?"":h.toString())+t+(f.equals(0)?"":f.toString()+"/"+n[1]);case"scientific":return g=g||function(e){return!1},new T(e.valueOf()).toString(D.SCIENTIFIC_MAX_DECIMAL_PLACES);default:return g=g||function(e){return-1!==e.indexOf("/")},e.toString()}}if(s&&void 0===n&&(n=D.DEFAULT_DECP),ne(e)){var a,u,l="",c="",p="",f=e.group||t,h=e.value;switch(r||("-1"==(a=o(e.multiplier))&&"-1"===String(e.multiplier)&&(p="-",a="1"),"1"!=a&&(l=a),"1"!=(u=e.power?o(e.power):"")&&(c=ne(u)?Pe(u,i):u)),f){case F:var l="",d=n&&s?e.multiplier.toDecimal(n):o(e.multiplier),h="-1"==String(e.multiplier)?"1":d,c="";break;case j:h=e.collectSymbols().map(function(e){e=Pe(e,i,t,n);return e="0"==e?"":e}).sort().join("+").replace(/\+\-/g,"-");break;case $:h=e.collectSymbols().map(function(e){e=Pe(e,i,t,n);return e="0"==e?"":e}).sort().join("+").replace(/\+\-/g,"-");break;case X:h=e.collectSymbols(function(e){var t=e.group;return(t===j||t===$)&&e.power.equals(1)&&e.multiplier.equals(1)?E(Pe(e,i)):Pe(e,i)}).join("*");break;case V:var v=e.previousGroup,d=e.power.group;v===j&&(h=e.collectSymbols(Pe,i).join("+").replace("+-","-")),v===F||v===G||v===H||r||(h=E(h)),d!==$&&d!==X&&d!==j&&"1"==e.power.multiplier.toString()||!c||(c=E(c))}f===H&&(h=e.fname+E(e.args.map(function(e){return Pe(e,i)}).join(","))),f===H&&e.fname in M&&(a=Pe(e.args[0]),u=Pe(e.args[1]),e.args[0].isComposite()&&(a=E(a)),e.args[1].isComposite()&&(u=E(u)),h=a+M[e.fname]+u),c&&f!==V&&g(c)&&(c=E(c)),((f===$||f===j)&&(l&&"1"!=l||"-"===p)||(f===X||f===$||f===j)&&c&&"1"!=c||!r&&f===B&&-1==h||e.fname===Z)&&(h=E(h));var w=p+(l=n&&("decimal"===m||"decimals"===m&&l)?me(l,n):l);if(l&&g(l)&&(w=E(w)),l&&(w+="*"),c=c<0?E(c):c){if("e"===h&&D.E_TO_EXP)return w+"exp"+E(c);c=D.POWER_OPERATOR+c}f=w+(h=f===V&&"-"===h.charAt(0)?E(h):h);return(f=e.parens?E(f):f)+c}if(re(e)){for(var y=e.elements.length,w=[],b=0;b<y;b++)w.push(e.elements[b].text(m));return"["+w.join(",")+"]"}try{return e.toString()}catch(e){return""}}function ke(e){if(g(e))return[e];for(var t=e,n=1,r=[];n<t;){var i=e/n,s=Math.floor(i);if(i-s<=2220446049250313e-31&&1<n){if(g(n)&&(-1===o.indexOf(n)&&o.push(n),r.push(n)),g(s)){r.push(s);break}t=s}n++}return r.sort(function(e,t){return e-t})}function R(e){this.symbol=e}function T(e){return this instanceof T?((e=String(void 0===e?0:e)).startsWith("-")?(this.sign=-1,e=e.substr(1,e.length)):this.sign=1,T.isScientific(e)?this.fromScientific(e):this.convert(e),this):new T(e)}function De(t){if(t instanceof De)return t;if(void 0===t)return this;try{if(ue(t))try{this.num=S(t),this.den=S(1)}catch(e){return De.simple(t)}else{var e=t instanceof k?Be.quickConversion(t):Be.convert(t);this.num=new S(e[0]),this.den=new S(e[1])}}catch(e){return De.simple(t)}}function Fe(e){var t="Infinity"===e;return this instanceof Fe?(e instanceof k&&(e=e.toString()),/^(\-?\+?\d+)\.?\d*e?\-?\+?\d*/i.test(e)||e instanceof k?(this.group=F,this.value=l,this.multiplier=new De(e)):(this.group=G,m(e),this.value=e,this.multiplier=new De(1),this.imaginary=e===D.IMAGINARY,this.isInfinity=t),this.power=new De(1),this):new Fe(e)}function P(){var C=this,n={},o={names:[],actions:[]};function x(e,t){this.start=e,this.end=t}function L(){this.elements=[]}function A(e,t,n){if(this.type=t,this.value=e,void 0!==n&&(this.column=n+1),t===A.OPERATOR){var r,i=E[e];for(r in i)this[r]=i[r]}else t===A.FUNCTION&&(this.precedence=A.MAX_PRECEDENCE,this.leftAssoc=!1)}x.prototype.isConstant=function(){return this.start.isConstant()&&this.end.isConstant()},x.prototype.text=function(){return Pe(this.start)+":"+Pe(this.end)},L.prototype.append=function(e){this.elements.push(e)},L.prototype.getItems=function(){return this.elements},L.prototype.toString=function(){return C.pretty_print(this.elements)},L.create=function(e){var t=new L;return e&&t.append(e),t},A.prototype.toString=function(){return this.value},A.prototype.toString=function(){return this.is_prefix?"`"+this.value:this.value},A.OPERATOR="OPERATOR",A.VARIABLE_OR_LITERAL="VARIABLE_OR_LITERAL",A.FUNCTION="FUNCTION",A.UNIT="UNIT",A.KEYWORD="KEYWORD",A.MAX_PRECEDENCE=999,this.classes={Collection:L,Slice:x,Token:A};var b={prec:void 0,cos:function(e,t){var n=C.parse(Math.cos(e)*Math.cosh(t)),t=C.parse(Math.sin(e)*Math.sinh(t));return C.subtract(n,C.multiply(t,Fe.imaginary()))},sin:function(e,t){var n=C.parse(Math.sin(e)*Math.cosh(t)),t=C.parse(Math.cos(e)*Math.sinh(t));return C.subtract(n,C.multiply(t,Fe.imaginary()))},tan:function(e,t){var n=C.parse(Math.sin(2*e)/(Math.cos(2*e)+Math.cosh(2*t))),t=C.parse(Math.sinh(2*t)/(Math.cos(2*e)+Math.cosh(2*t)));return C.add(n,C.multiply(t,Fe.imaginary()))},sec:function(e,t){t=this.removeDen(this.cos(e,t));return C.subtract(t[0],C.multiply(t[1],Fe.imaginary()))},csc:function(e,t){t=this.removeDen(this.sin(e,t));return C.add(t[0],C.multiply(t[1],Fe.imaginary()))},cot:function(e,t){t=this.removeDen(this.tan(e,t));return C.subtract(t[0],C.multiply(t[1],Fe.imaginary()))},acos:function(e,t){var e=this.fromArray([e,t]),t=C.pow(e.clone(),new Fe(2)),t=C.expand(t),t=C.multiply(O(C.subtract(new Fe(1),t)),Fe.imaginary()),t=R(C.expand(C.add(e.clone(),t)));return C.expand(C.multiply(Fe.imaginary().negate(),t))},asin:function(e,t){return C.subtract(C.parse("pi/2"),this.acos(e,t))},atan:function(e,t){if(e.equals(0)&&(t.equals(1)||t.equals(-1)))return C.parse(`${Fe.infinity()}*${D.IMAGINARY}*${t}`);var e=b.fromArray([e,t]),t=C.expand(C.multiply(Fe.imaginary(),e.clone())),e=R(C.expand(C.subtract(new Fe(1),t.clone()))),t=R(C.expand(C.add(new Fe(1),t.clone())));return C.expand(C.multiply(C.divide(Fe.imaginary(),new Fe(2)),C.subtract(e,t)))},asec:function(e,t){t=this.removeDen([e,t]);return t[1].negate(),this.acos.apply(this,t)},acsc:function(e,t){t=this.removeDen([e,t]);return t[1].negate(),this.asin.apply(this,t)},acot:function(e,t){t=this.removeDen([e,t]);return t[1].negate(),this.atan.apply(this,t)},cosh:function(e,t){var n=C.parse(Math.cosh(e)*Math.cos(t)),t=C.parse(Math.sinh(e)*Math.sin(t));return C.add(n,C.multiply(t,Fe.imaginary()))},sinh:function(e,t){var n=C.parse(Math.sinh(e)*Math.cos(t)),t=C.parse(Math.cosh(e)*Math.sin(t));return C.add(n,C.multiply(t,Fe.imaginary()))},tanh:function(e,t){var n=C.parse(Math.sinh(2*e)/(Math.cos(2*t)+Math.cosh(2*e))),e=C.parse(Math.sin(2*t)/(Math.cos(2*t)+Math.cosh(2*e)));return C.subtract(n,C.multiply(e,Fe.imaginary()))},sech:function(e,t){t=this.removeDen(this.cosh(e,t));return C.subtract(t[0],C.multiply(t[1],Fe.imaginary()))},csch:function(e,t){t=this.removeDen(this.sinh(e,t));return C.subtract(t[0],C.multiply(t[1],Fe.imaginary()))},coth:function(e,t){t=this.removeDen(this.tanh(e,t));return C.add(t[0],C.multiply(t[1],Fe.imaginary()))},acosh:function(e,t){var n=this.fromArray([e,t]),e=O(C.add(n.clone(),new Fe(1))),t=O(C.subtract(n.clone(),new Fe(1)));return C.expand(R(C.add(n,C.expand(C.multiply(e,t)))))},asinh:function(e,t){e=this.fromArray([e,t]),t=O(C.add(new Fe(1),C.expand(C.pow(e.clone(),new Fe(2)))));return C.expand(R(C.add(e,t)))},atanh:function(e,t){var e=this.fromArray([e,t]),t=R(C.add(e.clone(),new Fe(1))),e=R(C.subtract(new Fe(1),e));return C.expand(C.divide(C.subtract(t,e),new Fe(2)))},asech:function(e,t){t=this.removeDen([e,t]);return t[1].negate(),this.acosh.apply(this,t)},acsch:function(e,t){t=this.removeDen([e,t]);return t[1].negate(),this.asinh.apply(this,t)},acoth:function(e,t){t=this.removeDen([e,t]);return t[1].negate(),this.atanh.apply(this,t)},sqrt:function(e){var t=e.realpart(),n=e.imagpart(),e=Fe.hyp(t,n),t=C.add(t.clone(),e),e=O(C.multiply(new Fe(2),t.clone()));return C.add(C.divide(t.clone(),e.clone()),C.multiply(C.divide(n,e),Fe.imaginary()))},log:function(e,t){var n=R(Fe.hyp(e,t)),e=D.USE_BIG?Fe(k.atan2(t.multiplier.toDecimal(),e.multiplier.toDecimal())):Math.atan2(t,e),e=C.parse(e);return C.add(n,C.multiply(Fe.imaginary(),e))},erf(e,t){return C.symfunction("erf",[e])},removeDen:function(e){var t,n=ae(e)?(t=e[0],e[1]):(t=e.realpart(),e.imagpart()),e=Math.pow(t,2)+Math.pow(n,2);return[C.parse(t/e),C.parse(n/e)]},fromArray:function(e){return C.add(e[0],C.multiply(Fe.imaginary(),e[1]))},evaluate:function(e,t){var n,r,i=e.power.sign();return e.power=e.power.abs(),e.power.greaterThan(1)&&(e=C.expand(e)),r=i<0?(n=(r=this.removeDen(e))[0],r[1]):(n=e.realpart(),e.imagpart()),n.isConstant("all")&&r.isConstant("all")?this[t].call(this,n,r):C.symfunction(t,[e])}},I=this.trig={cos:function(e){if(e.equals("pi")&&e.multiplier.den.equals(2))return new Fe(0);if(D.PARSE2NUMBER){if(e.equals(new Fe(D.PI/2)))return new Fe(0);if(e.isConstant())return D.USE_BIG?new Fe(k.cos(e.multiplier.toDecimal())):new Fe(Math.cos(e.valueOf()));if(e.isImaginary())return b.evaluate(e,"cos")}if(e.equals(0))return new Fe(1);var t,n=!1,r=g(e.multiplier.toDecimal()),i=e.multiplier.abs();return e.multiplier=i,e.isPi()&&e.isLinear()&&(ue(i)?t=new Fe(ge(i)?1:-1):(Number(i.num),2===(i=Number(i.den))?t=new Fe(0):3===i?(t=C.parse("1/2"),n=!0):4===i?(t=C.parse("1/sqrt(2)"),n=!0):6===i?(t=C.parse("sqrt(3)/2"),n=!0):t=C.symfunction("cos",[e]))),!n||2!==r&&3!==r||t.negate(),t=t||C.symfunction("cos",[e])},sin:function(e){if(D.PARSE2NUMBER){if(e.isConstant())return e%Math.PI==0?new Fe(0):D.USE_BIG?new Fe(k.sin(e.multiplier.toDecimal())):new Fe(Math.sin(e.valueOf()));if(e.isImaginary())return b.evaluate(e,"sin")}if(e.equals(0))return new Fe(0);var t,n=!1,r=g(e.multiplier.toDecimal()),i=e.multiplier.sign(),s=e.multiplier.abs();return e.multiplier=s,e.equals("pi")?t=new Fe(0):e.isPi()&&e.isLinear()&&(ue(s)?t=new Fe(0):(s.num,2==(s=s.den)?(t=new Fe(1),n=!0):3==s?(t=C.parse("sqrt(3)/2"),n=!0):4==s?(t=C.parse("1/sqrt(2)"),n=!0):6==s?(t=C.parse("1/2"),n=!0):t=C.multiply(new Fe(i),C.symfunction("sin",[e])))),t=t||C.multiply(new Fe(i),C.symfunction("sin",[e])),!n||3!==r&&4!==r||t.negate(),t},tan:function(e){if(D.PARSE2NUMBER){if(e%Math.PI==0&&e.isLinear())return new Fe(0);if(e.isConstant())return D.USE_BIG?new Fe(k.tan(e.multiplier.toDecimal())):new Fe(Math.tan(e.valueOf()));if(e.isImaginary())return b.evaluate(e,"tan")}var t,n=!1,r=g(e.multiplier.toDecimal()),i=e.multiplier;if(e.multiplier=i,e.isPi()&&e.isLinear())if(ue(i))t=new Fe(0);else{i.num;i=i.den;if(2==i)throw new Ae("tan is undefined for "+e.toString());3==i?(t=C.parse("sqrt(3)"),n=!0):4==i?(t=new Fe(1),n=!0):6==i?(t=C.parse("1/sqrt(3)"),n=!0):t=C.symfunction("tan",[e])}return t=t||C.symfunction("tan",[e]),!n||2!==r&&4!==r||t.negate(),t},sec:function(e){if(D.PARSE2NUMBER)return e.isConstant()?D.USE_BIG?new Fe(new k(1).dividedBy(k.cos(e.multiplier.toDecimal()))):new Fe(Te.sec(e.valueOf())):e.isImaginary()?b.evaluate(e,"sec"):C.parse(ce("1/cos({0})",e));var t,n=!1,r=g(e.multiplier.toDecimal()),i=e.multiplier.abs();if(e.multiplier=i,e.isPi()&&e.isLinear())if(ue(i))t=new Fe(ge(i)?1:-1);else{i.num;i=i.den;if(2==i)throw new Ae("sec is undefined for "+e.toString());3==i?(t=new Fe(2),n=!0):4==i?(t=C.parse("sqrt(2)"),n=!0):6==i?(t=C.parse("2/sqrt(3)"),n=!0):t=C.symfunction("sec",[e])}return!n||2!==r&&3!==r||t.negate(),t=t||C.symfunction("sec",[e])},csc:function(e){if(D.PARSE2NUMBER)return e.isConstant()?D.USE_BIG?new Fe(new k(1).dividedBy(k.sin(e.multiplier.toDecimal()))):new Fe(Te.csc(e.valueOf())):e.isImaginary()?b.evaluate(e,"csc"):C.parse(ce("1/sin({0})",e));var t,n=!1,r=g(e.multiplier.toDecimal()),i=e.multiplier.sign(),s=e.multiplier.abs();if(e.multiplier=s,e.isPi()&&e.isLinear()){if(ue(s))throw new Ae("csc is undefined for "+e.toString());s.num;s=s.den;2==s?(t=new Fe(1),n=!0):3==s?(t=C.parse("2/sqrt(3)"),n=!0):4==s?(t=C.parse("sqrt(2)"),n=!0):6==s?(t=new Fe(2),n=!0):t=C.multiply(new Fe(i),C.symfunction("csc",[e]))}return t=t||C.multiply(new Fe(i),C.symfunction("csc",[e])),!n||3!==r&&4!==r||t.negate(),t},cot:function(e){if(D.PARSE2NUMBER)return e%(Math.PI/2)==0?new Fe(0):e.isConstant()?D.USE_BIG?new Fe(new k(1).dividedBy(k.tan(e.multiplier.toDecimal()))):new Fe(Te.cot(e.valueOf())):e.isImaginary()?b.evaluate(e,"cot"):C.parse(ce("1/tan({0})",e));var t,n=!1,r=g(e.multiplier.toDecimal()),i=e.multiplier;if(e.multiplier=i,e.isPi()&&e.isLinear()){if(ue(i))throw new Ae("cot is undefined for "+e.toString());i.num;i=i.den;2==i?t=new Fe(0):3==i?(t=C.parse("1/sqrt(3)"),n=!0):4==i?(t=new Fe(1),n=!0):6==i?(t=C.parse("sqrt(3)"),n=!0):t=C.symfunction("cot",[e])}return t=t||C.symfunction("cot",[e]),!n||2!==r&&4!==r||t.negate(),t},acos:function(e){if(D.PARSE2NUMBER){if(e.isConstant()){if(e.gt(1)||e.lt(-1)){var t=e.toString();return T(Se(`pi/2-asin(${t})`))}return D.USE_BIG?new Fe(k.acos(e.multiplier.toDecimal())):new Fe(Math.acos(e.valueOf()))}if(e.isImaginary())return b.evaluate(e,"acos")}return C.symfunction("acos",arguments)},asin:function(e){if(D.PARSE2NUMBER){if(e.isConstant()){if(e.gt(1)||e.lt(-1)){var t=D.IMAGINARY,n=e.multiplier.toDecimal();return T(Se(`${t}*log(sqrt(1-${n}^2)-${t}*${n})`))}return D.USE_BIG?new Fe(k.asin(e.multiplier.toDecimal())):new Fe(Math.asin(e.valueOf()))}if(e.isImaginary())return b.evaluate(e,"asin")}return C.symfunction("asin",arguments)},atan:function(e){var t;if(e.equals(0))t=new Fe(0);else{if(D.PARSE2NUMBER)return e.isConstant()?D.USE_BIG?new Fe(k.atan(e.multiplier.toDecimal())):new Fe(Math.atan(e.valueOf())):e.isImaginary()?b.evaluate(e,"atan"):C.symfunction("atan",arguments);t=e.equals(-1)?C.parse("-pi/4"):C.symfunction("atan",arguments)}return t},asec:function(e){if(D.PARSE2NUMBER){if(e.equals(0))throw new Ce("Input is out of the domain of sec!");if(e.isConstant())return I.acos(e.invert());if(e.isImaginary())return b.evaluate(e,"asec")}return C.symfunction("asec",arguments)},acsc:function(e){if(D.PARSE2NUMBER){if(e.isConstant())return I.asin(e.invert());if(e.isImaginary())return b.evaluate(e,"acsc")}return C.symfunction("acsc",arguments)},acot:function(e){if(D.PARSE2NUMBER){if(e.isConstant())return new C.add(C.parse("pi/2"),I.atan(e).negate());if(e.isImaginary())return b.evaluate(e,"acot")}return C.symfunction("acot",arguments)},atan2:function(e,t){if(e.equals(0)&&t.equals(0))throw new Ae("atan2 is undefined for 0, 0");return D.PARSE2NUMBER&&e.isConstant()&&t.isConstant()?new Fe(Math.atan2(e,t)):C.symfunction("atan2",arguments)}},e=this.trigh={cosh:function(e){if(D.PARSE2NUMBER){if(e.isConstant())return new Fe(Math.cosh(e.valueOf()));if(e.isImaginary())return b.evaluate(e,"cosh")}return C.symfunction("cosh",arguments)},sinh:function(e){if(D.PARSE2NUMBER){if(e.isConstant())return new Fe(Math.sinh(e.valueOf()));if(e.isImaginary())return b.evaluate(e,"sinh")}return C.symfunction("sinh",arguments)},tanh:function(e){if(D.PARSE2NUMBER){if(e.isConstant())return new Fe(Math.tanh(e.valueOf()));if(e.isImaginary())return b.evaluate(e,"tanh")}return C.symfunction("tanh",arguments)},sech:function(e){return D.PARSE2NUMBER?e.isConstant()?new Fe(Math.sech(e.valueOf())):e.isImaginary()?b.evaluate(e,"sech"):C.parse(ce("1/cosh({0})",e)):C.symfunction("sech",arguments)},csch:function(e){return D.PARSE2NUMBER?e.isConstant()?new Fe(Math.csch(e.valueOf())):e.isImaginary()?b.evaluate(e,"csch"):C.parse(ce("1/sinh({0})",e)):C.symfunction("csch",arguments)},coth:function(e){return D.PARSE2NUMBER?e.isConstant()?new Fe(Math.coth(e.valueOf())):e.isImaginary()?b.evaluate(e,"coth"):C.parse(ce("1/tanh({0})",e)):C.symfunction("coth",arguments)},acosh:function(e){e=D.PARSE2NUMBER&&e.isImaginary()?b.evaluate(e,"acosh"):D.PARSE2NUMBER?Se(C.parse(ce(D.LOG+"(({0})+sqrt(({0})^2-1))",e.toString()))):C.symfunction("acosh",arguments);return e},asinh:function(e){e=D.PARSE2NUMBER&&e.isImaginary()?b.evaluate(e,"asinh"):D.PARSE2NUMBER?Se(C.parse(ce(D.LOG+"(({0})+sqrt(({0})^2+1))",e.toString()))):C.symfunction("asinh",arguments);return e},atanh:function(e){e=D.PARSE2NUMBER&&e.isImaginary()?b.evaluate(e,"atanh"):D.PARSE2NUMBER?Se(C.parse(ce("(1/2)*"+D.LOG+"((1+({0}))/(1-({0})))",e.toString()))):C.symfunction("atanh",arguments);return e},asech:function(e){e=D.PARSE2NUMBER&&e.isImaginary()?b.evaluate(e,"asech"):D.PARSE2NUMBER?Se(R(C.add(e.clone().invert(),O(C.subtract(C.pow(e,new Fe(-2)),new Fe(1)))))):C.symfunction("asech",arguments);return e},acsch:function(e){e=D.PARSE2NUMBER&&e.isImaginary()?b.evaluate(e,"acsch"):D.PARSE2NUMBER?Se(C.parse(ce(D.LOG+"((1+sqrt(1+({0})^2))/({0}))",e.toString()))):C.symfunction("acsch",arguments);return e},acoth:function(e){e=D.PARSE2NUMBER&&e.isImaginary()?b.evaluate(e,"acoth"):D.PARSE2NUMBER?e.equals(1)?Fe.infinity():Se(C.divide(R(C.divide(C.add(e.clone(),new Fe(1)),C.subtract(e.clone(),new Fe(1)))),new Fe(2))):C.symfunction("acoth",arguments);return e}},E={"\\":{precedence:8,operator:"\\",action:"slash",prefix:!0,postfix:!(this.units={}),leftAssoc:!0,operation:function(e){return e}},"!!":{precedence:7,operator:"!!",action:"dfactorial",prefix:!1,postfix:!0,leftAssoc:!0,operation:function(e){return C.symfunction(D.DOUBLEFACTORIAL,[e])}},"!":{precedence:7,operator:"!",action:"factorial",prefix:!1,postfix:!0,leftAssoc:!0,operation:u},"^":{precedence:6,operator:"^",action:"pow",prefix:!1,postfix:!1,leftAssoc:!0},"**":{precedence:6,operator:"**",action:"pow",prefix:!1,postfix:!1,leftAssoc:!0},"%":{precedence:4,operator:"%",action:"percent",prefix:!1,postfix:!0,leftAssoc:!0,overloaded:!0,overloadAction:"mod",overloadLeftAssoc:!1,operation:function(e){return C.divide(e,new Fe(100))}},"*":{precedence:4,operator:"*",action:"multiply",prefix:!1,postfix:!1,leftAssoc:!1},"/":{precedence:4,operator:"/",action:"divide",prefix:!1,postfix:!1,leftAssoc:!1},"+":{precedence:3,operator:"+",action:"add",prefix:!0,postfix:!1,leftAssoc:!1,operation:function(e){return e}},plus:{precedence:3,operator:"plus",action:"add",prefix:!0,postfix:!1,leftAssoc:!1,operation:function(e){return e}},"-":{precedence:3,operator:"-",action:"subtract",prefix:!0,postfix:!1,leftAssoc:!1,operation:function(e){return e.negate()}},"=":{precedence:2,operator:"=",action:"equals",prefix:!1,postfix:!1,leftAssoc:!1},"==":{precedence:1,operator:"==",action:"eq",prefix:!1,postfix:!1,leftAssoc:!1},"<":{precedence:1,operator:"<",action:"lt",prefix:!1,postfix:!1,leftAssoc:!1},"<=":{precedence:1,operator:"<=",action:"lte",prefix:!1,postfix:!1,leftAssoc:!1},">":{precedence:1,operator:">",action:"gt",prefix:!1,postfix:!1,leftAssoc:!1},"=>":{precedence:1,operator:"=>",action:"gte",prefix:!1,postfix:!1,leftAssoc:!1},",":{precedence:0,operator:",",action:"comma",prefix:!1,postfix:!1,leftAssoc:!1},":":{precedence:0,operator:",",action:"assign",prefix:!1,postfix:!1,leftAssoc:!1,vectorFn:"slice"},":=":{precedence:0,operator:",",action:"function_assign",prefix:!1,postfix:!1,leftAssoc:!0}},q={"(":{type:"round",id:1,is_open:!0,is_close:!1},")":{type:"round",id:2,is_open:!1,is_close:!0},"[":{type:"square",id:3,is_open:!0,is_close:!1,maps_to:"vector"},"]":{type:"square",id:4,is_open:!1,is_close:!0},"{":{type:"curly",id:5,is_open:!0,is_close:!1,maps_to:"Set"},"}":{type:"curly",id:6,is_open:!1,is_close:!0}},U=this.functions={cos:[I.cos,1],sin:[I.sin,1],tan:[I.tan,1],sec:[I.sec,1],csc:[I.csc,1],cot:[I.cot,1],acos:[I.acos,1],asin:[I.asin,1],atan:[I.atan,1],arccos:[I.acos,1],arcsin:[I.asin,1],arctan:[I.atan,1],asec:[I.asec,1],acsc:[I.acsc,1],acot:[I.acot,1],atan2:[I.atan2,2],acoth:[e.acoth,1],asech:[e.asech,1],acsch:[e.acsch,1],sinh:[e.sinh,1],cosh:[e.cosh,1],tanh:[e.tanh,1],asinh:[e.asinh,1],sech:[e.sech,1],csch:[e.csch,1],coth:[e.coth,1],acosh:[e.acosh,1],atanh:[e.atanh,1],log10:[,1],exp:[function(e){if(e.fname===D.LOG&&e.isLinear())return C.pow(e.args[0],Fe.create(e.multiplier));return C.parse(ce("e^({0})",e))},1],radians:[function(e){return C.parse(ce("({0})*pi/180",e))},1],degrees:[function(e){return C.parse(ce("({0})*180/pi",e))},1],min:[function(){var e=[].slice.call(arguments);return w(e)?e[0]:Me(e)?new Fe(Math.min.apply(null,e)):D.SYMBOLIC_MIN_MAX&&Ne(e)?h("min",e):C.symfunction("min",e)},-1],max:[function(){var e=[].slice.call(arguments);return w(e)?e[0]:Me(e)?new Fe(Math.max.apply(null,e)):D.SYMBOLIC_MIN_MAX&&Ne(e)?h("max",e):C.symfunction("max",e)},-1],erf:[,1],floor:[,1],ceil:[,1],trunc:[,1],Si:[,1],step:[,1],rect:[,1],sinc:[function(e){if(D.PARSE2NUMBER)return e.isConstant()?new Fe(Te.sinc(e)):C.parse(ce("sin({0})/({0})",e));return C.symfunction("sinc",[e])},1],tri:[,1],sign:[function(e){return e.isConstant(!0)?new Fe(Math.sign(Se(e))):C.symfunction("sign",arguments)},1],Ci:[,1],Ei:[,1],Shi:[,1],Chi:[,1],Li:[,1],fib:[,1],fact:[u,1],factorial:[u,1],continued_fraction:[function(e,t){e=Se(e);if(e.isConstant()){e=Te.continuedFraction(e,t),t=Ve.fromArray(e.fractions.map(function(e){return new Fe(e)}));return Ve.fromArray([new Fe(e.sign),new Fe(e.whole),t])}return C.symfunction("continued_fraction",arguments)},[1,2]],dfactorial:[,1],gamma_incomplete:[,[1,2]],round:[m,[1,2]],scientific:[function(e,t){return e.scientific=t||10,e},[1,2]],mod:[t,2],pfactor:[N,1],vector:[function(){return new Ve([].slice.call(arguments))},-1],matrix:[function(){return He.fromArray(arguments)},-1],Set:[function(){return je.fromArray(arguments)},-1],imatrix:[function(e){return He.identity(e)},-1],parens:[function(e){if(D.PARSE2NUMBER)return e;return C.symfunction("parens",[e])},-1],sqrt:[O,1],cbrt:[i,1],nthroot:[s,2],log:[R,[1,2]],expand:[function(e,t){return T(e,t=t||{expand_denominator:!0,expand_functions:!0})},1],abs:[_,1],invert:[function(e){if(ie(e))return e.invert();K("invert expects a matrix")},1],determinant:[function(e){if(ie(e))return e.determinant();return e},1],size:[function(e){var t;ie(e)?t=[new Fe(e.cols()),new Fe(e.rows())]:re(e)||se(e)?t=new Fe(e.elements.length):K("size expects a matrix or a vector");return t},1],transpose:[function(e){if(ie(e))return e.transpose();K("function transpose expects a matrix")},1],dot:[function(e,t){if(re(e)&&re(t))return e.dot(t);K("function dot expects 2 vectors")},2],cross:[function(e,t){if(re(e)&&re(t))return e.cross(t);K("function cross expects 2 vectors")},2],vecget:[function(e,t){return t.isConstant()&&ue(t)?e.elements[t]:C.symfunction("vecget",arguments)},2],vecset:[function(e,t,n){return t.isConstant?(e.elements[t]=n,e):C.symfunction("vecset",arguments)},3],vectrim:[function(e,n){return n=void 0===n?1e-14:n,e=e.clone(),n=Number(n),e.elements.sort(function(e,t){return t.group-e.group}),e.elements=ve(e.elements,function(e,t){return Number(C.subtract(Se(e),Se(t)).abs())<=n}),e},[1,2]],matget:[function(e,t,n){return t.isConstant()&&n.isConstant()?e.elements[t][n]:C.symfunction("matget",arguments)},3],matset:[function(e,t,n,r){return e.elements[t][n]=r,e},4],matgetrow:[function(e,t){return t.isConstant()?new He(e.elements[t]):C.symfunction("matgetrow",arguments)},2],matsetrow:[function(e,t,n){if(!t.isConstant())return C.symfunction("matsetrow",arguments);if(e.elements[t].length!==n.elements.length)throw new _e("Matrix row must match row dimensions!");e=e.clone();return e.elements[t]=n.clone().elements,e},3],matgetcol:[function(e,r){if(!r.isConstant())return C.symfunction("matgetcol",arguments);r=Number(r);var i=He.fromArray([]);return e.each(function(e,t,n){n===r&&i.elements.push([e.clone()])}),i},2],matsetcol:[function(n,r,e){if(!r.isConstant())return C.symfunction("matsetcol",arguments);if(r=Number(r),n.rows()!==e.elements.length)throw new _e("Matrix columns must match number of columns!");return e.each(function(e,t){n.set(t-1,r,e.elements[0].clone())}),n},3],rationalize:[r,1],IF:[function(e,t,n){"boolean"!=typeof e&&oe(e)&&(e=!!Number(e));return e?t:n},3],is_in:[function(e,t){if(ie(e)){for(var n=0,r=e.rows();n<r;n++)for(var i=0,s=e.cols();i<s;i++)if(e.elements[n][i].equals(t))return new Fe(1)}else if(e.elements)for(n=0,r=e.elements.length;n<r;n++)if(e.elements[n].equals(t))return new Fe(1);return new Fe(0)},2],realpart:[l,1],imagpart:[c,1],conjugate:[p,1],arg:[f,1],polarform:[function(e){var t;return t=Fe.toPolarFormArray(e),e=t[1],t=t[0],e=C.parse(ce("e^({0}*({1}))",D.IMAGINARY,e)),C.multiply(t,e)},1],rectform:[function(e){var t,n,r,i,s,o=e.clone();try{return t=he(e,"e",!0),n=C.divide(t.x.power,Fe.imaginary()),r=Se(I.tan(n)),C.pow(t.a,new Fe(2)),i=r.getDenom(!0),s=r.getNum(),Fe.hyp(s,i).equals(t.a)?C.add(i,C.multiply(Fe.imaginary(),s)):o}catch(e){return o}},1],sort:[function(e,n){n=n?n.toString():"asc";var r=function(e){return e.group===F?e.multiplier:e.group===H?""===e.fname?r(e.args[0]):e.fname:e.group===G?e.power:e.value};return new Ve((re(e)?e.elements:e.collectSymbols()).sort(function(e,t){e=r(e),t=r(t);return"desc"===n?t-e:e-t}))},[1,2]],integer_part:[,1],union:[function(e,t){return e.union(t)},2],contains:[function(e,t){return e.contains(t)},2],intersection:[function(e,t){return e.intersection(t)},2],difference:[function(e,t){return e.difference(t)},2],intersects:[function(e,t){return new Fe(Number(e.intersects(t)))},2],is_subset:[function(e,t){return new Fe(Number(e.is_subset(t)))},2],print:[function(){be(arguments).map(function(e){console.log(e.toString())})},-1]};this.error=K;this.override=function(e,t){n[e]||(n[e]=[]),n[e].push(this[e]),this[e]=t},this.restore=function(e){this[e]&&(this[e]=n[e].pop())},this.extend=function(e,n,r){var i,s=this;"function"==typeof this[e]&&"function"==typeof n&&(i=this[e],this[e]=function(e,t){return ne(e)&&ne(t)&&!r?i.call(s,e,t):n.call(s,e,t,i)})},this.symfunction=function(e,t){var n=new Fe(e);return n.group=H,"object"==typeof t&&(t=[].slice.call(t)),n.args=t,n.fname=e===Z?"":e,n.updateHash(),n},this.callfunction=function(e,t,n){var r=U[e];r||K("Nerdamer currently does not support the function "+e);var i,s=r[1]||n,o=r[0];t instanceof Array||(t=void 0!==t?[t]:[]),-1!==s&&(i=(a=ae(s))?s[0]:s,n=a?s[1]:s,s=e+" requires a {0} of {1} arguments. {2} provided!",(a=t.length)<i&&K(ce(s,"minimum",i,a)),n<a&&K(ce(s,"maximum",n,a)));var a=Me(t);return o?o.apply(r[2],t):(o=function(e){for(var t=D.FUNCTION_MODULES,n=t.length,r=0;r<n;r++){var i=t[r];if(e in i)return i[e]}K("The function "+e+" is undefined!")}(e),D.PARSE2NUMBER&&a?d(o.apply(o,t)):C.symfunction(e,t))},this.operator_filter_regex=(e="^\\"+Object.keys(E).filter(function(e){if(1===e.length)return e}).join("\\"),new RegExp("(["+e+"])\\s+(["+e+"])")),this.setOperator=function(e,t,n){var r=e.operator;if(E[r]=e,t&&(this[e.action]=t),C[r]=e.operation,e.action||e.prefix||e.postif||(e.action=r),"over"===n||"under"===n){var i,s=e.precedence;for(i in E){var o=E[i];("over"===n?o.precedence>=s:o.precedence>s)&&o.precedence++}}},this.getOperator=function(e){return E[e]},this.aliasOperator=function(e,t){var n,r={},i=E[e];for(n in i)r[n]=i[n];r.operator=t,this.setOperator(r)},this.getOperators=function(){return E},this.getBrackets=function(){return q};function a(e){this.type=e.type,this.value=e.value,this.left=e.left,this.right=e.right}this.initConstants=function(){this.CONSTANTS={E:new Fe(D.E),PI:new Fe(D.PI)}},this.pretty_print=function(e){if(Array.isArray(e)){var t=e.map(e=>C.pretty_print(e)).join(", ");return"vector"===e.type?"vector<"+t+">":"("+t+")"}return e.toString()},this.peekers={pre_operator:[],post_operator:[],pre_function:[],post_function:[]},this.callPeekers=function(e){if(D.callPeekers)for(var t=this.peekers[e],n=be(arguments).slice(1).map(le),r=0;r<t.length;r++)t[r].apply(null,n)},this.tokenize=function(n){for(var e in n=(n=String(n)).trim().replace(/\s+/g," "),q){var t=new RegExp(q[e].is_close?"\\s+\\"+e:"\\"+e+"\\s+","g");n=n.replace(t,e)}for(var u=0,r=n.length,i=0,s=[],o=[s],a=o[0],l=0,c=[],p=!1,f=function(e,t){var n=[];void 0!==e&&(n.type=e),n.column=t,o.push(n),a.push(n),a=n,l++},h=function(){o.pop(),a=o[--l]},m=function(e,t){(t=void 0===t?n.substring(i,e):t)in C.units?a.push(new A(t,A.UNIT,i)):""!==t&&a.push(new A(t,A.VARIABLE_OR_LITERAL,i))},g=function(e){a.push(new A(e,A.FUNCTION,i))},d=function(e){i=e+1};u<r;u++){var v=n.charAt(u);if(v in E){m(u);var w=a[0]&&te(a[0]);p&&i<u&&","!==v&&!(w&&"*"===v)&&(p=!1,h()),d(u+1);var y=function(e){for(var t=(e=void 0!==e?e:u)+1;n.charAt(t++)in E;);return n.substring(e,t-1)}(u),u=(i=i+y.length-2)-1;a.push.apply(a,function(e){for(var t=u-e.length,n=[],r=e.charAt(0),i=1,s=e.length;i<s;i++)var o=e.charAt(i),a=r+o,r=(a in E?a:(n.push(new A(r,A.OPERATOR,t+i)),o));return n.push(new A(r,A.OPERATOR,t+i)),n}(y))}else if(v in q){var b,S=q[v];if(S.is_open)c.push([S,i]),(b=n.substring(i,u))in U?g(b):""!==b&&a.push(new A(b,A.VARIABLE_OR_LITERAL,i)),f(S.maps_to,u);else if(S.is_close){var M=c.pop();if(!M)throw new Le("Missing open bracket for bracket at: "+(u+1));if(M[0].id!==S.id-1)throw new Le("Parity error");m(u),h()}d(u)}else" "===v&&(M=n.substring(i,u),S=n.charAt(u+1),p?(M in E?a.push(new A(M,A.OPERATOR,u)):(m(void 0,M),h(),((v=S in E)&&"-"===E[S].value||!v)&&a.push(new A("*",A.OPERATOR,u))),p=!1):(b=n.substring(i,u))in U?(p=!0,g(b),f()):b in E?a.push(new A(b,A.OPERATOR,u)):(m(void 0,b),S=n.charAt(u+1),""===M||""===S||M in E||S in E||a.push(new A("*",A.OPERATOR,u))),d(u))}if(c.length){var N=c.pop();throw new Le("Missing closed bracket for bracket at "+(N[1]+1))}return m(u),s},this.toRPN=function(e){for(var t=e.type,n=e.length,r=[],i=[],s=[],o=function(e,t){for(;e.length;)t.push(e.pop())},a=0;a<n;a++){var u=e[a];if(u.type!==A.OPERATOR)break;if(!u.prefix)throw new Ie("Not a prefix operator");u.is_prefix=!0,i.push(u)}for(;a<n;a++){var l=e[a];if(l.type===A.OPERATOR){var c=l;for(c.overloaded&&(h=e[a+1])&&h.type===A.VARIABLE_OR_LITERAL&&(c.postfix=!1,c.action=c.overloadAction,c.leftAssoc=c.overloadLeftAssoc);i.length;){var p=i[i.length-1];if(!(p.precedence>c.precedence||!c.leftAssoc&&p.precedence===c.precedence))break;r.push(i.pop())}if(("vector"===t||"set"===t)&&"vectorFn"in c&&(c.action=c.vectorFn),c.postfix){var f=e[a-1];if(!f)throw new Ie("Unexpected prefix operator '"+l.value+"'! at "+l.column);if(f.type===A.OPERATOR&&!f.postfix)throw new Ie("Unexpected prefix operator '"+f.value+"'! at "+f.column)}else do{var h,m=!!(h=e[a+1])&&h.type===A.OPERATOR;if(m){if(!h.prefix)throw new Ie("A prefix operator was expected at "+h.column);h.is_prefix=!0,s.push(h),a++}}while(m);for((c.is_prefix?s:i).push(c);s.length&&(c.leftAssoc||!c.leftAssoc&&s[s.length-1].precedence>=c.precedence);)i.push(s.pop())}else l.type===A.VARIABLE_OR_LITERAL?(0===r.length&&o(s,i),r.push(l),(f=i[i.length-1])&&f.leftAssoc||o(s,r)):l.type===A.FUNCTION?i.push(l):l.type===A.UNIT&&r.push(l);Array.isArray(l)&&(r.push(this.toRPN(l)),l.type&&r.push(new A(l.type,A.FUNCTION,l.column)))}return o(i,r),o(s,r),r},this.parseRPN=function(e,t){try{for(var n in t=t||{})t[n]=C.parse(t[n],{});D.PARSE2NUMBER&&("e"in t||(t.e=new Fe(D.E)),"pi"in t||(t.pi=new Fe(D.PI)));for(var r=[],i=0,s=e.length;i<s;i++){var o=e[i];if(o=Array.isArray(o)?this.parseRPN(o,t):o)if(o.type===A.OPERATOR)if(o.is_prefix||o.postfix)r.push(o.operation(r.pop()));else{var a=r.pop(),u=r.pop();if(void 0===u)throw new Ie(o+" is not a valid postfix operator at "+o.column);var l="comma"===o.action;u instanceof je&&!l&&(u=Ve.fromSet(u)),a instanceof je&&!l&&(a=Ve.fromSet(a)),this.callPeekers("pre_operator",u,a,o);var c=C[o.action](u,a);this.callPeekers("post_operator",c,u,a,o),r.push(c)}else if(o.type===A.FUNCTION){var p=r.pop(),f=p.parent;p instanceof L||(p=L.create(p));var h=o.value,m=p.getItems();this.callPeekers("pre_function",h,m);var g=C.callfunction(h,m);this.callPeekers("post_function",g,h,m);var d=r[r.length-1],v=e[i+1];if(!(v&&v.type===A.OPERATOR&&","===v.value)&&g instanceof Ve&&d&&d.elements&&!(d instanceof L)){var w=r.pop(),y=g.elements[0];if(y.isConstant())if(y instanceof x)r.push(Ve.fromArray(w.elements.slice(y.start,y.end)));else{var b=Number(y),S=w.elements.length;if((b=b<0?S+b:b)<0||S<=b)throw new Ue("Index out of range "+(o.column+1));var M=w.elements[b];w.getter=b,M.parent=w,r.push(M)}else w.getter=y,r.push(w),r.push(g)}else f&&(g.parent=f),r.push(g)}else{var N,E=o.value;E in D.ALIASES?o=C.parse(D.ALIASES[o]):o.type===A.VARIABLE_OR_LITERAL?o=new Fe(E):o.type===A.UNIT&&((o=new Fe(E)).isUnit=!0),E in C.CONSTANTS?(N=o,o=new Fe(C.CONSTANTS[E])):E in t&&E!==t[E].toString()?(N=o,o=t[E].clone()):E in J&&(N=o,o=J[E].clone()),N&&(o.subbed=N),r.push(o)}}var q=r[0];if(-1!==["undefined","string","number"].indexOf(typeof q))throw new Re("Unexpected token!");return q}catch(t){throw[Ce].forEach(function(e){if(t instanceof e)throw new e(t.message+": "+o.column)}),new xe(t.message+": "+o.column)}},a.prototype.toString=function(){var e=this.left?this.left.toString()+"---":"",t=this.right?"---"+this.right.toString():"";return e+"("+this.value+")"+t},a.prototype.toHTML=function(e,t){e=e||0,t=void 0===t?4:t;function n(e){return" ".repeat(t*e)}var r="",i=this.left?n(e+1)+"<li>\n"+this.left.toHTML(e+2,t)+n(e+1)+"</li> \n":"",s=this.right?n(e+1)+"<li>\n"+this.right.toHTML(e+2,t)+n(e+1)+"</li>\n":"",r=n(e)+'<div class="'+this.type.toLowerCase()+'"><span>'+this.value+"</span></div>"+n(e)+"\n";return(i||s)&&(r+=n(e)+"<ul>\n"+i+s+n(e)+"</ul>\n"),r+=""},this.tree=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];if(Array.isArray(r))r=this.tree(r),t.push(r);else if(r.type===A.OPERATOR)r.is_prefix||r.postfix?(s=r.is_prefix?"left":"right",i=t.pop(),(r=new a(r))[s]=i):((r=new a(r)).right=t.pop(),r.left=t.pop()),t.push(r);else if(r.type===A.FUNCTION){r=new a(r);var i,s=t.pop();if(r.right=s,"object"===r.value)if(i=t[t.length-1]){for(;i.right;)i=i.right;i.right=r;continue}t.push(r)}else t.push(new a(r))}return t[0]},this.parse=function(e,t){e=function(e){e=String(e);for(var t=0;t<o.actions.length;t++)e=o.actions[t].call(this,e);for(e=e.replace(/\s+/g," "),e=(e=/e/gi.test(e)?e.replace(/\-*\d+\.*\d*e\+?\-?\d+/gi,function(e){return y(e)}):e).replace(D.IMPLIED_MULTIPLICATION_REGEX,function(){var e=arguments[4],t=arguments[1],n=arguments[2],r=arguments[3],i="",s="*";return t+(s=(i=!e.charAt(r).match(/[\+\-\/\*]/)?e.charAt(r-1):i).match(/[a-z]/i)?"":s)+n}).replace(/([a-z0-9_]+)/gi,function(e,t){return!(!1!==D.USE_MULTICHARACTER_VARS||t in U)&&isNaN(t)?t.split("").join("*"):t}).replace(/\)\(/g,")*(")||"0";;)if(e===(e=e.replace(/([a-z0-9_]+)(\()|(\))([a-z0-9]+)/gi,function(e,t,n,r,i){r=t||r,i=n||i;return r in U?r+i:r+"*"+i})))break;return e}(e),t=t||{};e=this.tokenize(e),e=this.toRPN(e);return this.parseRPN(e,t)},this.toObject=function(e){var a=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i,s=e[n],o=s.value;s.type===A.VARIABLE_OR_LITERAL?t.push(new Fe(o)):s.type===A.FUNCTION?(n++,(i=C.symfunction(o,a(e[n]))).isConversion=!0,t.push(i)):s.type===A.OPERATOR?t.push(o):t.push(a(s))}return t};return a(C.tokenize(e))};function S(e){for(var t=0,n=[[]],r=0,i=e.length;r<i;r++)","===e[r]?n[++t]=[]:n[t].push(e[r]);return n}function M(e){return e.replace(/^\\left\((.+)\\right\)$/g,function(e,t){return t||e})}function _(e){if(e.isInfinity)return Fe.infinity();if(e.multiplier.lessThan(0)&&e.multiplier.negate(),e.isImaginary()){var t=e.realpart(),n=e.imagpart();if(t.isConstant()&&n.isConstant())return O(C.add(C.pow(t,new Fe(2)),C.pow(n,new Fe(2))))}else if(oe(e)||ge(e.power))return e;var r;e.isComposite()&&(r=[],e.each(function(e){r.push(e.multiplier)}),Te.QGCD.apply(null,r).lessThan(0)&&(e.multiplier=e.multiplier.multiply(new De(-1)),e.distributeMultiplier()));n=C.parse(e.multiplier);return e.toUnitMultiplier(),C.multiply(n,C.symfunction(Q,[e]))}function u(e){if(re(e)){var n=new Ve;return e.each(function(e,t){n.set(t-1,u(e))}),n}if(ie(e)){var r=new He;return e.each(function(e,t,n){r.set(t,n,u(e))}),r}if(D.PARSE2NUMBER&&e.isConstant())return d(ue(e)?Te.bigfactorial(e):Te.gamma(e.multiplier.add(new De(1)).toDecimal()));if(e.isConstant()&&e.getDenom().equals(2)){var t,i=e.getNum(),s=e.multiplier.isNegative()?(s=C.subtract(i.negate(),new Fe(1)).multiplier.divide(new De(2)),t=C.pow(new Fe(-4),new Fe(s)).multiplier.multiply(Te.bigfactorial(s)),Te.bigfactorial(new De(2).multiply(s))):(s=C.add(i,new Fe(1)).multiplier.divide(new De(2)),t=Te.bigfactorial(new De(2).multiply(s)),C.pow(new Fe(4),new Fe(s)).multiplier.multiply(Te.bigfactorial(s))),s=t.divide(s);return C.multiply(C.parse("sqrt(pi)"),new Fe(s))}return C.symfunction(Y,[e])}function t(e,t){if(e.isConstant()&&t.isConstant()){var n=new Fe(1);return n.multiplier=n.multiplier.multiply(e.multiplier.mod(t.multiplier)),n}n=C.divide(e.clone(),t.clone());return ue(n)?new Fe(0):C.symfunction("mod",[e,t])}function r(e){if(e.isComposite()){var t,n,r,i,s=new Fe(0);return e.each(function(e){r=e.getNum(),i=e.getDenom(),n=s.getNum(),t=s.getDenom(),n=C.multiply(i,n),r=C.multiply(r,t),r=C.expand(C.add(n,r)),i=C.multiply(t,i),s=C.divide(r,i)},!0),s}return e}function O(e){if((e=!ne(e)?C.parse(e):e).group===V)return C.symfunction(z,[e]);var t=(e=""===e.fname&&e.power.equals(1)?e.args[0]:e).multiplier.sign()<0;if(D.PARSE2NUMBER){if(e.isConstant()&&!t)return new Fe(k.sqrt(e.multiplier.toDecimal()));if(e.isImaginary())return b.sqrt(e);if(e.group===G)return C.symfunction("sqrt",[e])}var n,r=e.isConstant();if(e.group===X&&e.isLinear()){var i=O(Fe(e.multiplier));for(o in e.symbols){var s=e.symbols[o];i=C.multiply(i,O(s))}l=i}else if(e.fname===z){var o=e.args[0],a=e.multiplier;o.setPower(e.power.multiply(new De(.25))),l=o,a.equals(1)||(l=C.multiply(O(C.parse(a)),l))}else if(e.power.isInteger())if(e.multiplier<0&&e.group===G)var u=C.parse(e.multiplier).negate(),a=C.parse(e).toUnitMultiplier().negate(),l=C.multiply(C.symfunction(D.SQRT,[a]),O(u));else{u=e.power.sign();e.power=e.power.abs(),r&&e.multiplier.lessThan(0)&&(n=Fe.imaginary(),e.multiplier=e.multiplier.abs());var c=e.multiplier.toDecimal(),r=Math.abs(c),r=Math.sqrt(r);if(ue(r))i=new Fe(r);else if(ue(c)){var p=Te.ifactor(c),f=1;for(s in p){var h,m=(g=p[s])-g%2;m&&(h=Math.pow(s,m),f*=Math.pow(s,m/2),c/=h)}i=C.multiply(C.symfunction(z,[new Fe(c)]),new Fe(f))}else{for(var g,d=[new Fe(e.multiplier.num),new Fe(e.multiplier.den)],v=[new Fe(1),new Fe(1)],w=[new Fe(1),new Fe(1)],y=0;y<2;y++)N(g=d[y]).each(function(e){var t=(e=Fe.unwrapPARENS(e)).clone().toLinear(),n=Number(e.power),e=n%2;v[y]=C.multiply(v[y],C.pow(t,new Fe((n-e)/2))),w[y]=C.multiply(w[y],O(C.pow(t,new Fe(e))))});i=C.divide(C.multiply(v[0],w[0]),C.multiply(v[1],w[1]))}l=(e=e.toUnitMultiplier(!0)).isOne()?e:ge(e.power.toString())?C.pow(e.clone(),new Fe(.5)):C.symfunction(z,[e]),u<0&&l.power.negate(),i&&(l=C.multiply(i,l)),n&&(l=C.multiply(n,l))}else e.setPower(e.power.multiply(new De(.5))),l=e;return t&&D.PARSE2NUMBER?C.parse(l):l}function i(e){if(e.isConstant(!0))return s(e,new Fe(3));var t,n=e.power/3,r=C.pow(C.parse(e.multiplier),new Fe(1/3)),e=e.toUnitMultiplier();return ue(n)?t=C.pow(e.toLinear(),C.parse(n)):e.group===X?(t=new Fe(1),e.each(function(e){t=C.multiply(t,i(e))})):t=C.symfunction("cbrt",[e]),C.multiply(r,t)}function s(e,t,n,r){if((t=Se(C.parse(t))).equals(0))throw new Ae("Unable to calculate nthroots of zero");if(e<0&&ge(t))throw new Error("Cannot calculate nthroot of negative number for even powers");if(!e.isConstant(!0))return C.symfunction("nthroot",arguments);void 0===r&&(r=!0),n=n||25;var i=(e=e.group!==F?Se(e):e).sign();if(i<0&&(e=_(e)),ue(e)&&t.isConstant()){var s,t=e<0x10000000000000000?De.create(Math.pow(e,1/t)):Te.nthroot(e,t);return r&&(s=new Fe(t)),s=new Fe(t.toDecimal(n)),C.multiply(new Fe(i),s)}}function N(e){if(e.greaterThan(9999999999998891e26)||e.equals(-1))return e;if(e.equals(Math.PI))return new Fe(Math.PI);if((e=Se(e.clone())).isConstant()){var t=new Fe(1),n=e.toString();if(ue(n)){var r,i=Te.ifactor(n);for(r in i)var s=i[r],t=C.multiply(t,C.symfunction("parens",[new Fe(r).setPower(new De(s))]))}else{n=N(new Fe(e.multiplier.num)),e=N(new Fe(e.multiplier.den));t=C.multiply(C.symfunction("parens",[n]),C.symfunction("parens",[e]).invert())}}else t=C.symfunction("pfactor",arguments);return t}function l(e){return e.realpart()}function c(e){return e.imagpart()}function p(e){var t=e.realpart(),e=e.imagpart();return C.add(t,C.multiply(e.negate(),Fe.imaginary()))}function f(e){var t=e.realpart(),e=e.imagpart();return t.isConstant()&&e.isConstant()?new Fe(Math.atan2(e,t)):C.symfunction("atan2",[e,t])}function f(e){var t=e.realpart(),e=e.imagpart();return t.isConstant()&&e.isConstant()?e.equals(0)&&t.equals(-1)?C.parse("pi"):e.equals(1)&&t.equals(0)?C.parse("pi/2"):e.equals(1)&&t.equals(1)?C.parse("pi/4"):new Fe(Math.atan2(e,t)):C.symfunction("atan2",[e,t])}function h(e,t){var n,r;for(t.map(function(e){e.numVal=Se(e).multiplier});;){if((r=t.length)<2)return t[0];n=t.pop(),r=t[r-2],("min"===e?n.numVal<r.numVal:n.numVal>r.numVal)&&(t.pop(),t.push(n))}}function R(e,t){if(e.equals(1))return new Fe(0);var n,r,i;if(e.fname===z&&e.multiplier.equals(1))return n=C.divide(R(e.args[0]),new Fe(2)),e.power.sign()<0&&n.negate(),n;if(e.equals(0))throw new Ae(D.LOG+"(0) is undefined!");return e.isImaginary()?b.evaluate(e,D.LOG):(e.isConstant()&&void 0!==t&&t.isConstant()?n=new Fe(Math.log(e)/Math.log(t)):e.group===V&&e.power.multiplier.lessThan(0)||"-1"===e.power.toString()?(e.power.negate(),n=R(e).negate()):"e"===e.value&&e.multiplier.equals(1)?(t=e.power,n=ne(t)?t:new Fe(t)):e.group===H&&"exp"===e.fname?(i=e.args[0],n=e.multiplier.equals(1)?C.multiply(i,new Fe(e.power)):C.symfunction(D.LOG,[e])):D.PARSE2NUMBER&&oe(e)?((e=C.parse(e)).multiplier.lessThan(0)&&(e.negate(),r=C.multiply(new Fe(Math.PI),new Fe("i"))),n=new Fe(Math.log(e.multiplier.toDecimal())),r&&(n=C.add(n,r))):(e.power.equals(1)||e.contains("e")||(i=e.group===V?e.power:new Fe(e.power),e.toLinear()),n=1<arguments.length&&w(arguments)?new Fe(1):C.symfunction(D.LOG,arguments),i&&(n=C.multiply(i,n))),n)}function m(e,t){var n=t&&t.isConstant()||void 0===t;if(e.isConstant()&&n){var r,n=e;return t&&t.lessThan(0)&&(t=_(t),n=(r=Number(e).toExponential().toString().split("e"))[0],r=r[1]),t=new Fe(me(n,Number(t||0))),C.multiply(t,C.pow(new Fe(10),new Fe(r||0)))}return C.symfunction("round",arguments)}function g(e){e%=2;return 0<=(e=e<0?2+e:e)&&e<=.5?1:.5<e&&e<=1?2:1<e&&e<=1.5?3:4}function d(t){if(!isFinite(t)){var e=Math.sign(t),n=new Fe(String(Math.abs(t)));return n.multiplier=n.multiplier.multiply(new De(e)),n}if(ne(t))return t;if("number"==typeof t)try{t=De.simple(t)}catch(e){t=new De(t)}n=new Fe(0);return n.multiplier=t,n}function T(e,t){if(Array.isArray(e))return e.map(function(e){return T(e,t)});if(t=t||{},e.group===H&&""===e.fname){var n=T(e.args[0],t),r=T(C.pow(n,C.parse(e.power)),t);return C.multiply(C.parse(e.multiplier),r).distributeMultiplier()}if(-1!==[F,B,G].indexOf(e.group))return e;r=e.clone();try{var i,s,o,a=e.multiplier.toString(),u=Number(e.power),l=e;if(e.isComposite()&&ue(e.power)&&0<e.power){var c=u-1,n=new Fe(0);e.each(function(e){n=C.add(n,T(C.parse(e),t))});for(var p=C.parse(n),f=0;f<c;f++)p=Ee(p,n,t);l=C.multiply(C.parse(a),p).distributeMultiplier()}else e.group===H&&!0===t.expand_functions?(i=[],e.args.forEach(function(e){i.push(T(e,t))}),l=C.pow(C.symfunction(e.fname,i),C.parse(e.power)),l=C.multiply(l,C.parse(e.multiplier))):e.isComposite()&&ue(e.power)&&e.power<0&&!0===t.expand_denominator?(e=e.invert(),(l=T(e,t)).invert()):e.group===X?(s=function(e){switch(e.group){case $:return 0;case j:return 1;case X:return 2;case H:return 3;default:return 4}},o=e.collectSymbols().sort(function(e,t){return s(t)-s(e)}).map(function(e){return T(C.pow(e,C.parse(u)),t)}),n=o.pop(),(l=n.isComposite()&&n.isLinear()?(o.forEach(function(e){n=Ee(n,e,t)}),n.isComposite()?(1<n.power&&(n=T(C.pow(n,C.parse(n.power)),t)),C.multiply(C.parse(a),n).distributeMultiplier()):n):(l=n,o.forEach(function(e){l=C.multiply(l,e)}),C.multiply(l,C.parse(a)).distributeMultiplier())).group===X&&(l=C.parse(l))):l=e;return l}catch(e){return r}return r}function P(e){if(ne(e.power)||!e.power.absEquals(.5))return e;var t=e.power.sign(),e=O(e.group===B?new Fe(e.value):e.toLinear());return t<0&&e.invert(),e}this.toTeX=function(e,t){var n=!0===(t=t||{}).decimals?"decimals":void 0,r="string"==typeof e?this.toObject(e):e,i=[],s=void 0===t.cdot?"\\cdot":t.cdot,r=function(e){for(var t=[];e.length;){var n,r,i=e.shift(),s=e[0],o=ae(s),a="-"===s;"^"===i&&("+"===s?e.shift():o&&"+"===s[0]&&s.shift(),o&&1===s.length&&e.unshift(e.shift()[0])),"^"===i&&(o&&"-"===s[0]||a)?(n=t.pop(),r="1","*"===(a=t[t.length-1])?(t.pop(),r=t.pop()):ae(a)&&(r=t.pop()),t.push(r,"/",n,i),(o?s:e).shift(),o&&1===s.length&&t.push(e.shift()[0])):t.push(i)}return t}(r);if(ae(r)){for(var o,a,u=[],l=0;l<r.length;l++)o=r[l],"^"===r[l+1]?(a=r[l+2],u.push(Ge.braces(this.toTeX([o]))+"^"+Ge.braces(this.toTeX([a]))),l+=2):u.push(o);r=u}for(var l=0,c=r.length;l<c;l++){var p=r[l];if(ne(p="*"===p?s:p))if(p.group===H){var f,h=p.fname;if(h===z)g="\\sqrt"+Ge.braces(this.toTeX(p.args));else if(h===Q)g=Ge.brackets(this.toTeX(p.args),"abs");else if(h===Z)g=Ge.brackets(this.toTeX(p.args),"parens");else if(h===D.LOG10)g="\\"+D.LOG10_LATEX+"\\left( "+this.toTeX(p.args)+"\\right)";else if("integrate"===h)var m=S(p.args),g="\\int "+(d=Ge.braces(this.toTeX(m[0])))+"\\, d"+(v=this.toTeX(m[1]));else if("defint"===h){var m=S(p.args),d=Ge.braces(this.toTeX(m[0])),v=this.toTeX(m[3]);g="\\int\\limits_{"+this.toTeX(m[1])+"}^{"+this.toTeX(m[2])+"} "+d+"\\, d"+v}else if("diff"===h){m=S(p.args),v="",d=Ge.braces(this.toTeX(m[0]));if(1===m.length){for(var w=[],y=0;y<m[0].length;y++)3===m[0][y].group&&w.push(m[0][y].value);w.sort(),v=0<w.length?"\\frac{d}{d "+w[0]+"}":"\\frac{d}{d x}"}else v=2===m.length?"\\frac{d}{d "+m[1]+"}":"\\frac{d^{"+m[2]+"}}{d "+this.toTeX(m[1])+"^{"+m[2]+"}}";g=v+"\\left("+d+"\\right)"}else if("sum"===h||"product"===h){var b=[[],[],[],[]],y=0;for(l=0;l<p.args.length;l++)","!==p.args[l]?b[y].push(p.args[l]):y++;g=("sum"===h?"\\sum_":"\\prod_")+Ge.braces(this.toTeX(b[1])+" = "+this.toTeX(b[2])),g+="^"+Ge.braces(this.toTeX(b[3]))+Ge.braces(this.toTeX(b[0]))}else g="limit"===h?(f=S(p.args).map(function(e){return Array.isArray(e)?C.toTeX(e.join("")):C.toTeX(String(e))}),"\\lim_"+Ge.braces(f[1]+"\\to "+f[2])+" "+Ge.braces(f[0])):h===Y||h===W?this.toTeX(p.args)+(h===Y?"!":"!!"):Ge.latex(p,n);i.push(g)}else i.push(Ge.latex(p,n));else ae(p)?i.push(Ge.brackets(this.toTeX(p))):"/"===p?i.push(Ge.frac(M(i.pop()),M(this.toTeX([r[++l]])))):i.push(p)}return i.join(" ")},this.expand=T,this.round=m,this.clean=function t(e){var n,r,i,s,o,a,u,l=e.group;return l===$?(r=e.getNum(),i=e.getDenom()||new Fe(1),s=Number(e.power),o=new Fe(1),1===Math.abs(s)&&(i.each(function(e){e.group===X?o=C.multiply(o,t(e.getDenom())):e.power.lessThan(0)&&(o=C.multiply(o,t(e.clone().toUnitMultiplier())))}),a=new Fe(0),i.each(function(e){a=C.add(C.divide(e,o.clone()),a)}),o.invert(),r.isComposite()?(u=new Fe(0),r.each(function(e){u=C.add(C.multiply(t(e),o.clone()),u)})):u=C.multiply(o,r),n=C.divide(u,a))):l===X?(n=new Fe(1),e.each(function(e){n=C.multiply(n,C.clean(e))})):l===H&&1===e.args.length&&e.args[0].isConstant()&&(n=ye("PARSE2NUMBER",function(){return C.parse(e)},!0)),n=n||e},this.sqrt=O,this.cbrt=i,this.abs=_,this.log=R,this.rationalize=r,this.nthroot=s,this.arg=f,this.conjugate=p,this.imagpart=c,this.realpart=l,this.getFunction=function(e){return U[e][0]},this.addPreprocessor=function(e,t,n,r){var i=o.names,s=o.actions;if("function"!=typeof t)throw new PreprocessorError("Incorrect parameters. Function expected!");n?r?(i.splice(n,0,e),s.splice(n,0,t)):(i[n]=e,s[n]=t):(i.push(e),s.push(t))},this.getPreprocessors=function(){for(var e={},t=0,n=e.names.length;t<n;t++)e[e.names[t]]={order:t,action:e.actions[t]};return e},this.removePreprocessor=function(e,t){e=o.names.indexOf(e);t?(we(o.names,e),we(o.actions,e)):(o.names[e]=void 0,o.actions[e]=void 0)},this.mapped_function=function(){for(var e={},t=this.params,n=0;n<t.length;n++)e[t[n]]=String(arguments[n]);return C.parse(this.body,e)},this.add=function(i,n){var e=ne(i),t=ne(n);if(e&&t){if(i.unit||n.unit)return C.Unit.add(i,n);if(i.isInfinity||n.isInfinity){var r=i.multiplier.lessThan(0),s=n.multiplier.lessThan(0);if(i.isInfinity&&n.isInfinity&&r!==s)throw new Ae("("+i+")+("+n+") is not defined!");var o=Fe.infinity();return s&&o.negate(),o}if(i.isComposite()&&i.isLinear()&&n.isComposite()&&n.isLinear()&&(i.distributeMultiplier(),n.distributeMultiplier(),n.length>i.length&&i.group===n.group&&([i,n]=[n,i])),i.multiplier.equals(0))return n;if(n.multiplier.equals(0))return i;if(i.isConstant()&&n.isConstant()&&D.PARSE2NUMBER)return h=new Fe(i.multiplier.add(n.multiplier).toDecimal(D.PRECISION));var a=i.group,u=n.group,l=i.power.toString(),c=n.power.toString();if(a<u||a===u&&c<l&&0<c)return this.add(n,i);a===X&&u===j&&i.value===n.value&&(w=i,a=(i=n).group,u=(n=w).group,l=i.power.toString(),c=n.power.toString());var p,f,h,m=l===c,r=i.value,s=n.value,o=i.isComposite(),l=n.isComposite();if(o&&(p=Pe(i,"hash")),l&&(f=Pe(n,"hash")),a===$&&u===$&&n.isLinear()&&!i.isLinear()&&p!==f)return this.add(n,i);a===j&&u===j&&(r=p,s=f);var g,c=a===B&&u===F,l=i.value===n.multiplier.toString(),l=r===s||p===f&&void 0!==p||c&&l;if(l&&m&&a===u)if(c&&(n=n.convert(B)),a!==j||u!==G&&u!==B)if((h=i).multiplier.isOne()&&n.multiplier.isOne()&&a===$&&i.isLinear()&&n.isLinear())for(var d in n.symbols){var v=n.symbols[d];h.attach(v)}else h.multiplier=h.multiplier.add(n.multiplier);else i.distributeMultiplier(),h=i.attach(n);else if(l&&a!==j)a===$&&u===j?(n.insert(i,"add"),h=n):(h=Fe.shell(j).attach([i,n])).value=a===j?p:r;else if(o&&i.isLinear()){r=a===u,o=a===j&&u===j;if(o&&(r=i.value===n.value),i.distributeMultiplier(),n.isComposite()&&n.isLinear()&&r){for(var d in n.distributeMultiplier(),n.symbols){v=n.symbols[d];i.attach(v)}h=i}else o&&i.value!==f||a===j&&!l?(h=Fe.shell($).attach([i,n])).updateHash():h=i.attach(n)}else a===H&&i.fname===z&&u!==V&&n.power.equals(.5)&&(g=n.multiplier.clone(),(n=O(n.toUnitMultiplier().toLinear())).multiplier=g),2===i.length&&2===n.length&&ge(i.power)&&ge(n.power)?h=C.add(T(i),T(n)):(h=Fe.shell($).attach([i,n])).updateHash();return 1===(h=h.multiplier.equals(0)?new Fe(0):h).length&&(g=h.multiplier,(h=pe(h.symbols)).multiplier=h.multiplier.multiply(g)),h}t&&!e&&(w=i,i=n,n=w,w=t,t=e,e=w);var w=ie(n);if(e&&w){var y=new He;n.eachElement(function(e,t,n){y.set(t,n,C.add(i.clone(),e))}),n=y}else if(ie(i)&&w)n=i.add(n);else if(e&&re(n))n.each(function(e,t){n.elements[--t]=C.add(i.clone(),n.elements[t])});else if(re(i)&&re(n))n.each(function(e,t){n.elements[--t]=C.add(i.elements[t],n.elements[t])});else{if(re(i)&&ie(n))return C.add(n,i);if(ie(i)&&re(n)){if(n.elements.length===i.rows()){var y=new He,b=i.cols();return n.each(function(e,t){for(var n=[],r=0;r<b;r++)n.push(C.add(i.elements[t-1][r].clone(),e.clone()));y.elements.push(n)}),y}K("Dimensions must match!")}}return n},this.subtract=function(i,r){var e=ne(i),t=ne(r);if(e&&t)return i.unit||r.unit?C.Unit.subtract(i,r):this.add(i,r.negate());if(t&&re(i))r=i.map(function(e){return C.subtract(e,r.clone())});else if(e&&re(r))r=r.map(function(e){return C.subtract(i.clone(),e)});else if(re(i)&&re(r))i.dimensions()===r.dimensions()?r=i.subtract(r):C.error("Unable to subtract vectors. Dimensions do not match.");else if(ie(i)&&re(r)){if(r.elements.length===i.rows()){var s=new He,o=i.cols();return r.each(function(e,t){for(var n=[],r=0;r<o;r++)n.push(C.subtract(i.elements[t-1][r].clone(),e.clone()));s.elements.push(n)}),s}K("Dimensions must match!")}else{if(re(i)&&ie(r)){var s=r.clone().negate();return C.add(s,i)}ie(i)&&ie(r)?r=i.subtract(r):ie(i)&&t?(s=new He,i.each(function(e,t,n){s.set(t,n,C.subtract(e,r.clone()))}),r=s):e&&ie(r)&&(s=new He,r.each(function(e,t,n){s.set(t,n,C.subtract(i.clone(),e))}),r=s)}return r},this.multiply=function(i,n){var e=ne(i),t=ne(n);if(e&&n instanceof L)return n.elements.push(i),n;if(e&&t){if(n.isUnit){var r=i.clone();return i.unit=n,r}if(i.unit||n.unit)return C.Unit.multiply(i,n);if(i.isInfinity||n.isInfinity){if(i.equals(0)||n.equals(0))throw new Ae(i+"*"+n+" is undefined!");if(n.power.lessThan(0)){if(i.isInfinity)throw new Ae("Infinity/Infinity is not defined!");return new Fe(0)}var s=i.multiplier.multiply(n.multiplier).sign(),o=Fe.infinity();if(i.isConstant()||n.isConstant()||i.isInfinity&&n.isInfinity)return s<0&&o.negate(),o}if(i.isConstant()&&n.isConstant()&&D.PARSE2NUMBER)return new Fe(p=new k(i.multiplier.toDecimal()).times(new k(n.multiplier.toDecimal())).toFixed());if(i.isOne())return n.clone();if(n.isOne())return i.clone();if(i.multiplier.equals(0)||n.multiplier.equals(0))return new Fe(0);if(n.group>i.group&&n.group!==$)return this.multiply(n,i);i.group===X&&n.group===j&&i.value===n.value&&(p=i,i=n,n=p);var a=i.group,u=n.group,l=n.multiplier.num,c=n.multiplier.den;a!==H||i.fname!==z||n.isConstant()||i.args[0].value!==n.value||i.args[0].multiplier.lessThan(0)?a===H&&i.fname===z&&i.multiplier.equals(1)&&i.power.equals(-1)&&n.isConstant()&&i.args[0].equals(n)&&(i=C.symfunction(z,[n.clone()]),n=new Fe(1)):(m=i.power,h=C.parse(i.multiplier),(i=C.multiply(h,i.args[0].clone())).setPower(new De(.5).multiply(m)),a=i.group);var p,f=i.value,o=n.value,s=new De(i.sign()),h=a===B&&u===F&&n.multiplier.equals(i.value),m=(h?new De(1).multiply(i.multiplier):i.multiplier.multiply(n.multiplier)).abs(),r=i.clone().toUnitMultiplier();if(n=n.clone().toUnitMultiplier(!0),a===H&&u===H){var g=i.args[0].clone(),d=n.args[0].clone();if(i.fname===z&&n.fname===z&&i.isLinear()&&n.isLinear()){var v=C.divide(g,d).invert();v.gt(1)&&ue(v)&&(r=C.multiply(i.args[0].clone(),O(v.clone())),n=new Fe(1))}else if(i.fname===Y&&n.fname===Y&&!g.isConstant()&&!d.isConstant()&&n.power<0){v=C.subtract(g.clone(),d.clone());if(v.isConstant())if(p=new Fe(1),v<0){for(var w=0,y=Math.abs(v);w<=y;w++){var b=C.add(g.clone(),new Fe(w));p=C.multiply(p,b)}r=C.multiply(C.pow(g,new Fe(i.power)),C.pow(p,new Fe(n.power))),n=new Fe(1)}else{for(w=0,y=Math.abs(v);w<=y;w++){b=C.add(d.clone(),new Fe(w));p=C.multiply(p,b)}r=C.multiply(C.pow(p,new Fe(i.power)),C.pow(d,new Fe(n.power))),n=new Fe(1)}}}if(f===o&&a===j&&a===u&&(f=i.text("hash"),o=n.text("hash")),(f=u===V&&n.previousGroup===j&&a===j?Pe(i,"hash",V):f)!==o&&!h||a===j&&(u===G||u===B||u===H)||a===j&&u===X)if(a===X&&i.isLinear())if(u===X&&n.distributeExponent(),u===X&&n.isLinear()){for(var b in n.symbols){var S=n.symbols[b];r=r.combine(S)}r.multiplier=r.multiplier.multiply(n.multiplier)}else r.combine(n);else a!==F?a===X?(r.distributeExponent(),r.combine(n)):n.isOne()||(E=n.multiplier.clone(),n.toUnitMultiplier(),(r=Fe.shell(X).combine([r,n])).multiplier=r.multiplier.multiply(E)):r=n.clone().toUnitMultiplier();else{var M=i.power,N=n.power,E=ne(M),q=ne(N),q=E||q;a===j&&u!==j&&n.previousGroup!==j&&M.equals(1)?(r=new Fe(0),i.each(function(e){r=C.add(r,C.multiply(e,n.clone()))},!0)):(r.power=q?C.add(ne(M)?M:new Fe(M),ne(N)?N:new Fe(N)):a===F?M:M.add(N),r.power.equals(0)&&(r=r.convert(F)),q&&r.convert(V),i.imaginary&&n.imaginary&&ge(r.power%2)&&(r=new Fe(1),m.negate()),r.group!==V&&r.previousGroup&&(r.previousGroup=void 0),r.multiplier=r.multiplier.multiply(n.multiplier))}r.group===B&&(a=Math.log(r.value),M=Math.log(l)/a,N=Math.log(c)/a,q=m.num/l,a=m.den/c,0!=M&&ue(M)&&ue(q)&&(r.power=r.power.add(new De(M)),m.num/=l),0!=N&&ue(N)&&ue(a)&&(r.power=r.power.subtract(new De(N)),m.den/=c)),1===r.length&&(p=r.multiplier,(r=pe(r.symbols)).multiplier=r.multiplier.multiply(p));c=r.power.toString();return ge(c)&&r.fname===z?(s*=r.sign(),c=r.power,r=r.args[0],r=C.multiply(new Fe(m),C.pow(r,new Fe(c.divide(new De(2))))),s<0&&r.negate()):(r.multiplier=r.multiplier.multiply(m).multiply(s),r.group===$&&r.isImaginary()&&r.distributeMultiplier()),r=r.group===B&&ue(r.power.toDecimal())?r.convert(F):r}t&&!e&&(p=i,i=n,n=p,p=t,t=e,e=p);s=ie(n),t=ie(i);if(e&&s){var x=new He;n.eachElement(function(e,t,n){x.set(t,n,C.multiply(i.clone(),e))}),n=x}else if(t&&s)n=i.multiply(n);else if(e&&re(n))n.each(function(e,t){n.elements[--t]=C.multiply(i.clone(),n.elements[t])});else if(re(i)&&re(n))n.each(function(e,t){n.elements[--t]=C.multiply(i.elements[t],n.elements[t])});else{if(re(i)&&ie(n))return this.multiply(n,i);if(ie(i)&&re(n)){if(n.elements.length===i.rows()){var x=new He,A=i.cols();return n.each(function(e,t){for(var n=[],r=0;r<A;r++)n.push(C.multiply(i.elements[t-1][r].clone(),e.clone()));x.elements.push(n)}),x}K("Dimensions must match!")}}return n},this.divide=function(r,i){var e=ne(r),t=ne(i);if(e&&t){if(r.unit||i.unit)return C.Unit.divide(r,i);if(i.equals(0))throw new qe("Division by zero not allowed!");return r.isConstant()&&i.isConstant()?(n=r.clone()).multiplier=n.multiplier.divide(i.multiplier):(i.invert(),n=C.multiply(r,i)),n}var n,s,o=re(r),a=re(i);return e&&a?i=i.map(function(e){return C.divide(r.clone(),e)}):o&&t?i=r.map(function(e){return C.divide(e,i.clone())}):o&&a?r.dimensions()===i.dimensions()?i=i.map(function(e,t){return C.divide(r.elements[--t],e)}):C.error("Cannot divide vectors. Dimensions do not match!"):(n=ie(r),o=ie(i),n&&t?(s=new He,r.eachElement(function(e,t,n){s.set(t,n,C.divide(e,i.clone()))}),i=s):e&&o?(s=new He,i.eachElement(function(e,t,n){s.set(t,n,C.divide(r.clone(),e))}),i=s):n&&o?(s=new He,r.rows()===i.rows()&&r.cols()===i.cols()?(r.eachElement(function(e,t,n){s.set(t,n,C.divide(e,i.elements[t][n]))}),i=s):C.error("Dimensions do not match!")):n&&a&&(r.cols()===i.dimensions()?(s=new He,r.eachElement(function(e,t,n){s.set(t,n,C.divide(e,i.elements[t].clone()))}),i=s):C.error("Unable to divide matrix by vector."))),i},this.pow=function(r,i){var s,e=ne(r),t=ne(i);if(e&&t){if(r.unit||i.unit)return C.Unit.pow(r,i);if(r.group===H&&r.fname===Q&&ge(i)){var n=r.multiplier.clone(),o=C.pow(r.args[0],i);return o.multiplier=n,o}if(r.isInfinity||i.isInfinity){if(r.isInfinity&&i.isInfinity)throw new Ae("("+r+")^("+i+") is undefined!");if(r.isConstant()&&i.isInfinity){if(r.equals(0)){if(i.lessThan(0))throw new Ae("0^Infinity is undefined!");return new Fe(0)}if(r.equals(1))throw new Ae("1^"+i.toString()+" is undefined!");if(i.lessThan(0))return new Fe(0);if(!r.lessThan(0))return Fe.infinity()}if(r.isInfinity&&i.isConstant()){if(i.equals(0))throw new Ae(r+"^0 is undefined!");return i.lessThan(0)?new Fe(0):C.multiply(Fe.infinity(),C.pow(new Fe(r.sign()),i.clone()))}}var a=r.equals(0),u=i.equals(0);if(a&&u)throw new Ae("0^0 is undefined!");if(a&&i.isConstant()&&i.multiplier.greaterThan(0))return new Fe(0);if(u)return new Fe(1);var l,c=i.isConstant(),p=r.isConstant(),o=i.isInteger(),n=r.multiplier,a=r.clone();if(p&&c&&r.equals(0)&&i.lessThan(0))throw new Ae("Division by zero is not allowed!");if(D.PARSE2NUMBER&&p&&c&&r.sign()<0&&de(i)){var f=Math.PI*i;return b=new Fe(Math.cos(f)),v=C.multiply(Fe.imaginary(),new Fe(Math.sin(f))),C.add(b,v)}if(D.PARSE2NUMBER&&r.isImaginary()&&c&&ue(i)&&!i.lessThan(0))if(b=r.realpart(),v=r.imagpart(),b.isConstant("all")&&v.isConstant("all"))return u=D.USE_BIG?Fe(k.atan2(d.multiplier.toDecimal(),y.multiplier.toDecimal()).times(i.toString())):Math.atan2(v,b)*i,l=new Fe(u),y=C.pow(Fe.hyp(b,v),i),f=C.multiply(y.clone(),C.trig.cos(l.clone())),u=C.multiply(y,C.trig.sin(l)),C.add(f,C.multiply(Fe.imaginary(),u));if(a.toUnitMultiplier(),a.group!==H||a.fname!==z||c?(A=n.sign(),de(i)&&A<0&&(a.negate(),(a=C.symfunction(Z,[a])).negate()),a.multiplyPower(i)):((N=a.args[0]).multiplyPower(new Fe(.5)),N.multiplier.multiply(a.multiplier),N.multiplyPower(i),a=N),p&&c&&D.PARSE2NUMBER)A<0&&(r.negate(),m=i.multiplier.den.equals(2)?new Fe(D.IMAGINARY):ue(i.multiplier)?ge(i.multiplier)?new Fe(1):new Fe(-1):ge(i.multiplier.den)?C.pow(C.symfunction(Z,[new Fe(A)]),i.clone()):new Fe(Math.pow(A,i.multiplier.num))),a=new Fe(Math.pow(r.multiplier.toDecimal(),i.multiplier.toDecimal())),m&&(a=C.multiply(a,m));else if(o&&!n.equals(1)){if(i.abs().gt(D.MAX_EXP))return i.sign()<0?new Fe(0):Fe.infinity();var h=i.multiplier.toDecimal(),m=Math.sign(h);h=Math.abs(h);var g=new De(1);g.num=n.num.pow(h),g.den=n.den.pow(h),m<0&&g.invert(),a.multiplier=a.multiplier.multiply(g)}else{var d,v,w,y,b,S,M,N,E,q,x,A=r.sign();i.isConstant()&&r.isConstant()&&!i.multiplier.den.equals(1)&&A<0?a=i.multiplier.den.equals(2)?(d=new Fe(D.IMAGINARY),r.negate(),i.lessThan(0)&&(d.negate(),i.negate()),C.multiply(C.pow(r,i),d)):((w=r.clone()).multiplier.negate(),a=C.pow(C.symfunction(Z,[new Fe(A)]),i.clone()),g=C.pow(new Fe(w.multiplier.num),i.clone()),d=C.pow(new Fe(w.multiplier.den),i.clone()),y=C.divide(g,d),C.multiply(a,y)):D.PARSE2NUMBER&&i.isImaginary()?(b=i.realpart(),v=i.imagpart(),w=r.clone().toLinear(),y=C.pow(w.clone(),b),E=R(w.clone()),b=I.cos(C.multiply(v.clone(),E)),E=C.multiply(I.sin(C.multiply(v,R(w))),Fe.imaginary()),a=C.multiply(y,C.add(b,E)),a=C.expand(C.parse(a))):(S=P(new Fe((E=r.group===F&&A<0)?n.num:Math.abs(n.num)).setPower(i.clone())),M=P(new Fe(n.den).setPower(i.clone()).invert()),r.imaginary&&(o?(N=Math.sign(i),h=_(i),a=new Fe(ge(q=h%4)?-1:D.IMAGINARY),(0===q||N<0&&1===q||0<N&&3===q)&&a.negate()):(o=i.multiplier.multiply(De.quick(1,2)),N=Math.pow(-1,o.num),a=ge(o.den)?new Fe(-1).setPower(o,!0):new Fe(N))),A<0&&!E&&a.negate(),c&&r.group!==V&&(A=ge(i.multiplier.den),E=ge(r.power),q=a.power.toDecimal(),c=ge(q),A&&E&&!c&&(a=1===q?C.symfunction(Q,[a]):ue(q)?C.multiply(C.symfunction(Q,[a.clone().toLinear()]),a.clone().setPower(new De(q-1))):(h=a.power,C.symfunction(Q,[a.toLinear()]).setPower(h)),D.POSITIVE_MULTIPLIERS&&a.fname===Q&&(a=a.args[0]))),i.equals(2)&&a.group===X&&(x=new Fe(1),a.each(function(e){x=C.multiply(x,C.pow(e,i))}),a=x))}return a=P(a),(a=S&&M?C.multiply(a,function(e){if(e.group===B){var t=e.value,n=ke(t)[0];if(!n)return ee("Unable to compute prime factors. This should not happen. Please review and report."),e;t=new De(Math.log(t)/Math.log(n)).multiply(e.power);if(t.den>e.power.den)return e;e=ue(t)?Fe(Math.pow(n,t)):new Fe(n).setPower(t)}return e}(C.multiply(S,M))):a).fname===z?(M=((S=a.group===V)?a.power.multiplier:a.power).toString(),ge(M)&&(S=S?C.divide(a.power,new Fe(2)):new Fe(a.power.divide(new De(2))),n=a.multiplier,(a=C.pow(a.args[0],S)).multiplier=a.multiplier.multiply(n))):!D.IGNORE_E&&a.isE()&&a.group===V&&a.power.contains("pi")&&a.power.contains(D.IMAGINARY)&&i.group===X&&(l=i.stripVar(D.IMAGINARY),a=C.add(I.cos(l),C.multiply(Fe.imaginary(),I.sin(l)))),a}return re(r)&&t?r=r.map(function(e){return C.pow(e,i.clone())}):ie(r)&&t?(s=new He,r.eachElement(function(e,t,n){s.set(t,n,C.pow(e,i.clone()))}),r=s):e&&ie(i)&&(s=new He,i.eachElement(function(e,t,n){s.set(t,n,C.pow(r.clone(),e))}),r=s),r},this.comma=function(e,t){return(e=!(e instanceof L)?L.create(e):e).append(t),e},this.mod=t,this.slice=function(e,t){return new x(e,t)},this.equals=function(e,t){return e.group===G||e.isLinear()||K("Cannot set equality for "+e.toString()),J[e.value]=t.clone(),t},this.percent=function(e){return C.divide(e,new Fe(100))},this.assign=function(e,n){if(e instanceof L&&n instanceof L)return e.elements.map(function(e,t){return C.assign(e,n.elements[t])}),Ve.fromArray(n.elements);if(e.parent){var t=e.parent;return t.elements[t.getter]=n,delete t.getter,t}if(e.group!==G)throw new Oe("Cannot complete operation. Incorrect LH value for "+e);return J[e.value]=n},this.function_assign=function(e,t){var n=e.elements.pop();return fe(n,e.elements,t)};function v(e){return new Fe(!0===e?1:0)}this.eq=function(e,t){return v(e.equals(t))},this.gt=function(e,t){return v(e.gt(t))},this.gte=function(e,t){return v(e.gte(t))},this.lt=function(e,t){return v(e.lt(t))},this.lte=function(e,t){return v(e.lte(t))},this.factorial=function(e){return this.symfunction(Y,[e])},this.dfactorial=function(e){return this.symfunction(W,[e])}}D.FUNCTION_MODULES.push(Te),x(Te),Math.sign=Math.sign||function(e){return 0===(e=+e)||isNaN(e)?e:0<e?1:-1},Math.cosh=Math.cosh||function(e){e=Math.exp(e);return(e+1/e)/2},Math.sech=Math.sech||function(e){return 1/Math.cosh(e)},Math.csch=Math.csch||function(e){return 1/Math.sinh(e)},Math.coth=Math.coth||function(e){return 1/Math.tanh(e)},Math.sinh=Math.sinh||function(e){e=Math.exp(e);return(e-1/e)/2},Math.tanh=Math.tanh||function(e){if(e===1/0)return 1;if(e===-1/0)return-1;e=Math.exp(2*e);return(e-1)/(e+1)},Math.asinh=Math.asinh||function(e){return e===-1/0?e:Math.log(e+Math.sqrt(e*e+1))},Math.acosh=Math.acosh||function(e){return Math.log(e+Math.sqrt(e*e-1))},Math.atanh=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},Math.log10=Math.log10||function(e){return Math.log(e)*Math.LOG10E},Math.trunc=Math.trunc||function(e){return isNaN(e)?NaN:0<e?Math.floor(e):Math.ceil(e)},ke(314146179365),R.getExpression=function(e,t){"last"!==e&&e||(e=p.length);e=p[(e="first"===e?1:e)-1];return e&&new R(e)},(R.prototype={text:function(e,t){return t=t||D.EXPRESSION_DECP,e=e||"decimals",this.symbol.text_?this.symbol.text_(e):Pe(this.symbol,e,void 0,t)},latex:function(e){return this.symbol.latex?this.symbol.latex(e):Ge.latex(this.symbol,e)},valueOf:function(){return this.symbol.valueOf()},evaluate:function(){if(re(this.symbol)&&0===this.symbol.dimensions())return this;var e,t=arguments[0],n=1;"string"==typeof t?e="%"===t.charAt(0)?R.getExpression(t.substr(1)).text():t:t instanceof R||ne(t)?e=t.text():(e=this.symbol.text(),n--);var r=arguments[n]||{};return new R(ye("PARSE2NUMBER",function(){return d.parse(e,r)},!0))},buildFunction:function(e){return Xe.build(this.symbol,e)},isNumber:function(){return oe(this.symbol)},isInfinity:function(){return Math.abs(this.symbol.multiplier)===1/0},isImaginary:function(){return Se(d.parse(this.symbol)).isImaginary()},variables:function(){return b(this.symbol)},toString:function(){try{return ae(this.symbol)?"["+this.symbol.toString()+"]":this.symbol.toString()}catch(e){return""}},toDecimal:function(e){D.precision=e;e=Pe(this.symbol,"decimals");return D.precision=void 0,e},isFraction:function(){return v(this.symbol)},isPolynomial:function(){return this.symbol.isPoly()},sub:function(e,t){return new R(this.symbol.sub(d.parse(e),d.parse(t)))},operation:function(e,t){return i(t)?t=t.symbol:ne(t)||(t=d.parse(t)),new R(d[e](this.symbol.clone(),t.clone()))},add:function(e){return this.operation("add",e)},subtract:function(e){return this.operation("subtract",e)},multiply:function(e){return this.operation("multiply",e)},divide:function(e){return this.operation("divide",e)},pow:function(e){return this.operation("pow",e)},expand:function(){return new R(d.expand(this.symbol))},each:function(e,t){if(this.symbol.each)this.symbol.each(e,t);else if(ae(this.symbol))for(t=0;t<this.symbol.length;t++)e.call(this.symbol,this.symbol[t],t);else e.call(this.symbol)},eq:function(e){ne(e)||(e=d.parse(e));try{return d.subtract(this.symbol.clone(),e).equals(0)}catch(e){return!1}},lt:function(e){ne(e)||(e=d.parse(e));try{return Se(d.subtract(this.symbol.clone(),e)).lessThan(0)}catch(e){return!1}},gt:function(e){ne(e)||(e=d.parse(e));try{return Se(d.subtract(this.symbol.clone(),e)).greaterThan(0)}catch(e){return!1}},gte:function(e){return this.gt(e)||this.eq(e)},lte:function(e){return this.lt(e)||this.eq(e)},numerator:function(){return new R(this.symbol.getNum())},denominator:function(){return new R(this.symbol.getDenom())},hasFunction:function(e){return this.symbol.containsFunction(e)},contains:function(e){return this.symbol.contains(e)}}).toTeX=R.prototype.latex,T.prototype={fromScientific:function(e){e=String(e).toLowerCase().split("e");return this.coeff=e[0],this.exponent=e[1],this},convert:function(e){var t=e.split("."),n=t[0]||"",r=t[1]||"",n=T.removeLeadingZeroes(n),r=T.removeTrailingZeroes(r),i=n.length,e=n+r,t=T.leadingZeroes(e).length;this.exponent=i-(t+1);e=T.removeLeadingZeroes(e);this.coeff=e.charAt(0)+"."+(e.substr(1,e.length)||"0");e=this.coeff.split(".")[1]||"";return this.decp="0"===e?0:e.length,this.dec=r,this.wholes=n,this},round:function(e){var t,n,r=this.copy();return 0===(e=Number(e))?r.coeff=r.coeff.charAt(0):(t=this.coeff.substring(0,e+1),e=(n=this.coeff.substring(e+1,e+3)).charAt(0),4<n.charAt(1)&&e++,r.coeff=t+e),r},copy:function(){var e=new T(0);return e.coeff=this.coeff,e.exponent=this.exponent,e.sign=this.sign,e},toString:function(e){var t;return t=D.SCIENTIFIC_IGNORE_ZERO_EXPONENTS&&0===this.exponent&&this.decp<e?0===this.decp?this.wholes:this.coeff:(t=void 0===e?this.coeff:T.round(this.coeff,Math.min(e,this.decp||1)),0===this.exponent?t:t+"e"+this.exponent),(-1===this.sign?"-":"")+t}},T.isScientific=function(e){return/\d+\.?\d*e[\+\-]*\d+/i.test(e)},T.leadingZeroes=function(e){e=e.match(/^(0*).*$/);return e?e[1]:""},T.removeLeadingZeroes=function(e){e=e.match(/^0*(.*)$/);return e?e[1]:""},T.removeTrailingZeroes=function(e){var t=e.match(/0*$/);return t?e.substring(0,e.length-t[0].length):""},T.round=function(e,t){e=me(e,t),t-=String(e).split(".").pop().length;return 0<t&&(e+=new Array(1+t).join(0)),e},De.create=function(e){if(e instanceof De)return e;var t="-"===(e=e.toString()).charAt(0),e=new De(e=t?e.substr(1,e.length-1):e);return t&&e.negate(),e},De.isFrac=function(e){return e instanceof De},De.quick=function(e,t){var n=new De;return n.num=new S(e),n.den=new S(t),n},De.simple=function(e){for(var t=String(y(e)).split("."),e=t.join(""),n=1,r=(t[1]||"").length,i=0;i<r;i++)n+="0";return De.quick(e,n).simplify()},De.prototype={multiply:function(e){if(this.isOne())return e.clone();if(e.isOne())return this.clone();var t=this.clone();return t.num=t.num.multiply(e.num),t.den=t.den.multiply(e.den),t.simplify()},divide:function(e){if(e.equals(0))throw new qe("Division by zero not allowed!");return this.clone().multiply(e.clone().invert()).simplify()},subtract:function(e){return this.clone().add(e.clone().neg())},neg:function(){return this.num=this.num.multiply(-1),this},add:function(e){var t=this.den,n=e.den,r=this.clone(),i=r.num,e=e.num;return t.equals(n)?r.num=i.add(e):(r.num=i.multiply(n).add(e.multiply(t)),r.den=t.multiply(n)),r.simplify()},mod:function(e){var t=this.clone(),e=e.clone();return t.num=t.num.multiply(e.den),t.den=t.den.multiply(e.den),e.num=e.num.multiply(this.den),e.den=e.den.multiply(this.den),t.num=t.num.mod(e.num),t.simplify()},simplify:function(){var e=S.gcd(this.num,this.den);return this.num=this.num.divide(e),this.den=this.den.divide(e),this},clone:function(){var e=new De;return e.num=new S(this.num),e.den=new S(this.den),e},decimal:function(e){var t=this.num.isNegative()?"-":"";if(this.num.equals(this.den))return"1";e=e||D.PRECISION,e++;for(var n=[],r=this.num.abs(),i=this.den,s=0;s<e;s++){var o=r.divide(i),a=r.subtract(o.multiply(i));if(n.push(o),a.equals(0))break;r=a.times(10)}var u=n.shift();if(0===n.length)return t+u.toString();if(s===e){for(var l=[],s=0;s<2;s++)l.unshift(n.pop());n.push(Math.round(l.join(".")))}return t+(u.toString()+"."+n.join(""))},toDecimal:function(e){return(e=e||D.PRECISION)?this.decimal(e):this.num/this.den},qcompare:function(e){return[this.num.multiply(e.den),e.num.multiply(this.den)]},equals:function(e){isNaN(e)||(e=new De(e));e=this.qcompare(e);return e[0].equals(e[1])},absEquals:function(e){isNaN(e)||(e=new De(e));e=this.qcompare(e);return e[0].abs().equals(e[1])},greaterThan:function(e){isNaN(e)||(e=new De(e));e=this.qcompare(e);return e[0].gt(e[1])},gte:function(e){return this.greaterThan(e)||this.equals(e)},lte:function(e){return this.lessThan(e)||this.equals(e)},lessThan:function(e){isNaN(e)||(e=new De(e));e=this.qcompare(e);return e[0].lt(e[1])},isInteger:function(){return this.den.equals(1)},negate:function(){return this.num=this.num.multiply(-1),this},invert:function(){var e,t=this.den;return this.num.equals(0)||(e=this.num.isNegative(),this.den=this.num.abs(),this.num=t,e&&(this.num=this.num.multiply(-1))),this},isOne:function(){return this.num.equals(1)&&this.den.equals(1)},sign:function(){return this.num.isNegative()?-1:1},abs:function(){return this.num=this.num.abs(),this},gcd:function(e){return De.quick(S.gcd(e.num,this.num),S.lcm(e.den,this.den))},toString:function(){return this.den.equals(1)?this.num.toString():this.num.toString()+"/"+this.den.toString()},valueOf:function(){return D.USE_BIG?new k(this.num.toString()).div(new k(this.den.toString())):this.num/this.den},isNegative:function(){return this.toDecimal()<0}},Fe.imaginary=function(){var e=new Fe(D.IMAGINARY);return e.imaginary=!0,e},Fe.infinity=function(e){var t=new Fe("Infinity");return-1===e&&t.negate(),t},Fe.shell=function(e,t){t=new Fe(t);return t.group=e,t.symbols={},t.length=0,t},Fe.unwrapSQRT=function(e,t){var n,r=e.power;return e.fname===z&&(e.isLinear()||t)&&((n=e.args[0].clone()).power=n.power.multiply(new De(.5)),n.multiplier=n.multiplier.multiply(e.multiplier),e=n,t&&(e.power=r.multiply(new De(.5)))),e},Fe.hyp=function(e,t){return e=e||new Fe(0),t=t||new Fe(0),d.sqrt(d.add(d.pow(e.clone(),new Fe(2)),d.pow(t.clone(),new Fe(2))))},Fe.toPolarFormArray=function(e){var t=e.realpart(),e=e.imagpart();return[Fe.hyp(t,e),t.equals(0)?d.parse("pi/2"):d.trig.atan(d.divide(e,t))]},Fe.unwrapPARENS=function(e){if(""!==e.fname)return e;var t=e.args[0];return t.power=t.power.multiply(e.power),t.multiplier=t.multiplier.multiply(e.multiplier),""===e.fname?Fe.unwrapPARENS(t):t},Fe.create=function(e,t){return d.parse("("+e+")^("+(t=void 0===t?1:t)+")")},Fe.prototype={getNth:function(e){var t=Se(d.pow(d.parse(this.multiplier),d.parse(e).invert())),n=d.parse(me(t));return Se(d.pow(n,d.parse(e))).equals(d.parse(this.multiplier))?n:t},isToNth:function(t){var n,e=this.getNth(t),e=ue(e);return this.group===X?(n=!0,this.each(function(e){e.isToNth(t)||(n=!1)})):n=this.group===F||ue(d.divide(d.parse(this.power),d.parse(t))),e&&n},isSquare:function(){return this.isToNth(2)},isCube:function(){return this.isToNth(3)},isSimple:function(){return this.power.equals(1)&&this.multiplier.equals(1)},powSimp:function(){if(this.group!==X)return this.clone();var t=[],e=this.multiplier.sign();this.each(function(e){e=e.power;if(ne(e)||e.equals(1))return this.clone();t.push(e)});var n,r=new De(c(t)),e=this.multiplier.sign(),i=this.multiplier.clone().abs(),s=Te.ifactor(i),o=new De(1),a=new De(1);for(n in s){var u=new De(s[n]);u.lessThan(r)||(u=u.divide(r).subtract(new De(1)),a=a.multiply(new De(n))),o=o.multiply(d.parse(E(n)+"^"+E(u)).multiplier)}var l=new Fe(a);this.each(function(e){(e=e.clone()).power=e.power.divide(r),l=d.multiply(l,e)});i=d.symfunction(Z,[l]);return i.power=r,i.multiplier=e<0?o.negate():o,i},equals:function(e){return ne(e)||(e=new Fe(e)),this.value===e.value&&this.power.equals(e.power)&&this.multiplier.equals(e.multiplier)&&this.group===e.group},abs:function(){var e=this.clone();return e.multiplier.abs(),e},gt:function(e){return ne(e)||(e=new Fe(e)),this.isConstant()&&e.isConstant()&&this.multiplier.greaterThan(e.multiplier)},gte:function(e){return ne(e)||(e=new Fe(e)),this.equals(e)||this.isConstant()&&e.isConstant()&&this.multiplier.greaterThan(e.multiplier)},lt:function(e){return ne(e)||(e=new Fe(e)),this.isConstant()&&e.isConstant()&&this.multiplier.lessThan(e.multiplier)},lte:function(e){return ne(e)||(e=new Fe(e)),this.equals(e)||this.isConstant()&&e.isConstant()&&this.multiplier.lessThan(e.multiplier)},isPoly:function(e){var t=this.group,n=this.power;if(!ue(n)||n<0)return!1;if(t===F||t===G||this.isConstant(!0))return!0;n=b(this);if(t===X&&1===n.length){var r=n[0];if(!r)return!0;for(s in this.symbols){var i=this.symbols[s];if(i.group===H&&!i.args[0].isConstant())return!1;if(!i.contains(r)&&!i.isConstant(!0))return!1}return!0}if(this.isComposite()||t===X&&e){if(!e&&1<n.length)return!1;for(var s in this.symbols)if(!this.symbols[s].isPoly(e))return!1;return!0}return!1},stripVar:function(t,e){var n;return this.group!==j&&this.group!==G||this.value!==t?this.group===X&&this.isLinear()?(n=new Fe(1),this.each(function(e){e.contains(t,!0)||(n=d.multiply(n,e.clone()))}),n.multiplier=n.multiplier.multiply(this.multiplier)):this.group!==$||this.isLinear()?this.group===$&&this.isLinear()?(n=new Fe(0),this.each(function(e){e.contains(t)||((e=e.clone()).multiplier=e.multiplier.multiply(this.multiplier),n=d.add(n,e))}),n.equals(0)&&(n=new Fe(this.multiplier))):n=this.group===V&&this.power.contains(t,!0)||this.group===H&&this.contains(t)?new Fe(this.multiplier):this.clone():n=new Fe(this.multiplier):n=new Fe(e?0:this.multiplier),n},toArray:function(n,r){r=r||{arr:[],add:function(e,t){var n=this.arr[t];this.arr[t]=n?d.add(n,e):e}};var e=this.group;if(e===G&&this.contains(n))r.add(new Fe(this.multiplier),this.power);else if(e===X){var t=this.stripVar(n),i=d.divide(this.clone(),t.clone()),i=i.isConstant()?0:i.power;r.add(t,i)}else if(e===j&&this.value===n)this.each(function(e,t){r.add(e.stripVar(n),t)});else if(e===$)this.each(function(e){e.toArray(n,r)});else{if(this.contains(n))throw new I("Cannot convert to array! Exiting");r.add(this.clone(),0)}r=r.arr;for(var s=0;s<r.length;s++)r[s]||(r[s]=new Fe(0));return r},hasFunc:function(e){var t=this.group===H||this.group===V;if(t&&!e||t&&this.contains(e))return!0;if(this.symbols)for(var n in this.symbols)if(this.symbols[n].hasFunc(e))return!0;return!1},sub:function(t,n){t=ne(t)?t.clone():d.parse(t),n=ne(n)?n.clone():d.parse(n),t.group!==F&&t.group!==B||K("Cannot substitute a number. Must be a variable");var r,e=!1,i=t.multiplier.equals(1),s=this.multiplier.clone();if(this.value===t.value&&(this.group!==j&&t.group!==j||this.group===j&&t.group===j))(i||t.multiplier.equals(this.multiplier))&&(t.isLinear()?r=n:t.power.equals(this.power)&&(r=n,e=!0),t.multiplier.equals(this.multiplier)&&(s=new De(1)));else if(this.group===X||this.previousGroup===X)r=new Fe(1),this.each(function(e){e=d.parse(e.sub(t,n));r=d.multiply(r,e)});else if(this.isComposite()){var o=this.clone();if(t.isComposite()&&o.isComposite()&&o.isLinear()&&t.isLinear()){var a,u=function(e,t){for(var n in e.symbols){n=e.symbols[n];if(n.isComposite()&&u(n,t)||n.equals(t))return!0}return!1};for(a in t.symbols)if(!u(o,t.symbols[a]))return o.clone();r=d.add(d.subtract(o.clone(),t),n)}else r=new Fe(0),o.each(function(e){r=d.add(r,e.sub(t,n))})}else if(this.group===V)r=d.parse(this.value).sub(t,n);else if(this.group===H){for(var l=[],c=0;c<this.args.length;c++){var p=this.args[c];ne(p)||(p=d.parse(p)),l.push(p.sub(t,n))}r=d.symfunction(this.fname,l)}return r?(e||(e=this.group===V?this.power.sub(t,n):d.parse(this.power),r=d.pow(r,e)),r.multiplier=r.multiplier.multiply(s),r):this.clone()},isMonomial:function(){if(this.group===G)return!0;if(this.group!==X)return!1;for(var e in this.symbols)if(this.symbols[e].group!==G)return!1;return!0},isPi:function(){return this.group===G&&"pi"===this.value},sign:function(){return this.multiplier.sign()},isE:function(){return"e"===this.value},isSQRT:function(){return this.fname===z},isConstant:function(t,n){if(n&&this.group===X)for(var e in this.symbols)if(this.symbols[e].isConstant(!0))return!0;if("functions"===t&&this.isComposite()){var r=!0;return this.each(function(e){e.isConstant(t,n)||(r=!1)},!0),r}if("all"===t&&(this.isPi()||this.isE()))return!0;if(t&&this.group===H){for(var i=0;i<this.args.length;i++)if(!this.args[i].isConstant(t))return!1;return!0}return t?oe(this):this.value===l},isImaginary:function(){if(this.imaginary)return!0;if(this.symbols)for(var e in this.symbols)if(this.symbols[e].isImaginary())return!0;return!1},realpart:function(){if(this.isConstant())return this.clone();if(this.imaginary)return new Fe(0);if(this.isComposite()){var t=new Fe(0);return this.each(function(e){t=d.add(t,e.realpart())}),t}return this.isImaginary()?new Fe(0):this.clone()},imagpart:function(){if(this.group===G&&this.isImaginary())return new Fe(this.multiplier);if(this.isComposite()){var t=new Fe(0);return this.each(function(e){t=d.add(t,e.imagpart())}),t}return this.group===X?this.stripVar(D.IMAGINARY):new Fe(0)},isInteger:function(){return this.isConstant()&&this.multiplier.isInteger()},isLinear:function(e){if(e){if(this.isConstant())return!0;if(this.group===G)return this.value!==e||this.power.equals(1);if(this.isComposite()&&this.power.equals(1)){for(var t in this.symbols)if(!this.symbols[t].isLinear(e))return!1;return!0}return this.group===X&&this.symbols[e]?this.symbols[e].isLinear(e):!1}return this.power.equals(1)},containsFunction:function(e){if("string"==typeof e&&(e=[e]),this.group===H&&-1!==e.indexOf(this.fname))return!0;if(this.symbols)for(var t in this.symbols)if(this.symbols[t].containsFunction(e))return!0;return!1},multiplyPower:function(e){if(this.group===F&&this.multiplier.equals(1))return this;var t,n=this.power;return this.group!==V&&e.group===F?(t=e.multiplier,this.group!==F||t.isInteger()||this.convert(B),this.power=n.equals(1)?t.clone():n.multiply(t),this.group===B&&ue(this.power)&&(this.value=Math.pow(this.value,this.power),this.toLinear(),this.convert(F))):(this.group!==V&&(n=new Fe(n),this.convert(V)),this.power=d.multiply(n,e)),this},setPower:function(e,t){return this.group===F&&this.multiplier.equals(1)||(this.group!==V||ne(e)?(n=!1,ne(e)&&(e.group===F?e=e.multiplier:n=!0),n=n?V:B,this.power=e,this.group===F&&n&&this.convert(n,t)):(this.group=this.previousGroup,delete this.previousGroup,this.group===F?(this.multiplier=new De(this.value),this.value=l):this.power=e)),this;var n},isInverse:function(){return this.group===V?this.power.multiplier.lessThan(0):this.power<0},clone:function(e){var t,n=e||new Fe(0),r=["value","group","length","previousGroup","imaginary","fname","args","isInfinity","scientific"],i=r.length;if(this.symbols)for(var s in n.symbols={},this.symbols)n.symbols[s]=this.symbols[s].clone();for(t=0;t<i;t++)void 0!==this[r[t]]&&(n[r[t]]=this[r[t]]);return n.power=this.power.clone(),n.multiplier=this.multiplier.clone(),this.isConversion&&(n.isConversion=this.isConversion),this.isUnit&&(n.isUnit=this.isUnit),n},toUnitMultiplier:function(e){return this.multiplier.num=new S(this.multiplier.num.isNegative()&&e?-1:1),this.multiplier.den=new S(1),this},toLinear:function(){return this.power.equals(1)||this.setPower(new De(1)),this},each:function(e,t){if(this.symbols)for(var n in this.symbols){var r=this.symbols[n];if(r.group===j&&t)for(var i in r.symbols)e.call(n,r.symbols[i],i);else e.call(this,r,n)}else e.call(this,this,this.value)},valueOf:function(){return this.group===F?this.multiplier.valueOf():0===this.power?1:0===this.multiplier?0:Pe(this,"decimals")},contains:function(e,t){e=String(e);var n=this.group;if(this.value===e)return!0;if(this.symbols)for(var r in this.symbols)if(this.symbols[r].contains(e,t))return!0;if(n===H||this.previousGroup===H)for(var i=0;i<this.args.length;i++)if(this.args[i].contains(e,t))return!0;if(n===V){if(t&&this.power.contains(e,t))return!0;if(this.value===e)return!0}return this.value===e},negate:function(){return this.multiplier.negate(),this.group!==$&&this.group!==j||this.distributeMultiplier(),this},invert:function(e,t){return e||(this.multiplier=this.multiplier.invert()),ne(this.power)?this.power.negate():this.group===X&&t?this.each(function(e){return e.invert()}):this.power&&this.group!==F&&this.power.negate(),this},distributeMultiplier:function(e){e=e?this.power.absEquals(1):this.power.equals(1);if(this.symbols&&e&&this.group!==X&&!this.multiplier.equals(1)){for(var t in this.symbols){t=this.symbols[t];t.multiplier=t.multiplier.multiply(this.multiplier),t.distributeMultiplier()}this.toUnitMultiplier()}return this},distributeExponent:function(){if(!this.power.equals(1)){var e,t=this.power;for(e in this.symbols){var n=this.symbols[e];n.group===V?n.power=d.multiply(n.power,new Fe(t)):this.symbols[e].power=this.symbols[e].power.multiply(t)}this.toLinear()}return this},convert:function(e,t){var n;return H<e?(n=this.clone(),this.symbols={},(e===X?n:this).toUnitMultiplier(),this.group===H&&(n.args=this.args,delete this.args,delete this.fname),this.isImgSymbol&&delete this.isImgSymbol,this.toLinear(),this.symbols[n.keyForGroup(e)]=n,this.group=e,this.length=1):e===V?this.group===F&&this.multiplier.equals(1)||(this.group!==V&&(this.previousGroup=this.group),this.group===F?(this.value=this.multiplier.num.toString(),this.toUnitMultiplier()):this.value=Pe(this,"hash"),this.group=V):e===F?(n=this.multiplier.toDecimal(),this.symbols&&(this.symbols=void 0),new Fe(this.group===B?n*Math.pow(this.value,this.power):n).clone(this)):e===B&&this.group===F&&(this.value=t?this.multiplier.num.toString():Math.abs(this.multiplier.num.toString()),this.toUnitMultiplier(!t),this.group=B),this},insert:function(e,t){var n,r;return ne(e)||K("Object "+e+" is not of type Symbol!"),this.symbols&&(r=this.group,H<r&&(r=(n=e.keyForGroup(r))in this.symbols&&this.symbols[n],"add"===t?(t=n,r?(this.symbols[t]=d.add(r,e),this.symbols[t].multiplier.equals(0)&&(delete this.symbols[t],this.length--,0===this.length&&(this.convert(F),this.multiplier=new De(0)))):(this.symbols[n]=e,this.length++)):(e.group===B&&ue(e.power)&&e.convert(F),e.group!==V?(this.multiplier=this.multiplier.multiply(e.multiplier),e.toUnitMultiplier()):(e.parens=e.multiplier.lessThan(0),this.multiplier=this.multiplier.multiply(e.multiplier.clone().abs()),e.toUnitMultiplier(!0)),r&&((e=d.multiply(we(this.symbols,n),e)).isConstant()&&(this.multiplier=this.multiplier.multiply(e.multiplier),e=new Fe(1)),this.length--),e.isOne(!0)?e.multiplier.lessThan(0)&&this.negate():(this.symbols[n]=e,this.length++)),0===this.length&&this.convert(F),this.group!==$&&this.group!==X||this.updateHash())),this},attach:function(e){if(ae(e)){for(var t=0;t<e.length;t++)this.insert(e[t],"add");return this}return this.insert(e,"add")},combine:function(e){if(ae(e)){for(var t=0;t<e.length;t++)this.insert(e[t],"multiply");return this}return this.insert(e,"multiply")},updateHash:function(){if(this.group!==F)if(this.group===H){for(var e="",t=this.args,n=this.fname===Z,r=0;r<t.length;r++)e+=(0===r?"":",")+Pe(t[r]);var i=n?"":this.fname;this.value=i+(n?e:E(e))}else this.group!==G&&this.group!==j&&(this.value=Pe(this,"hash"))},keyForGroup:function(e){var t,n=this.group;if(n===F)t=this.value;else if(n===G||n===B)t=e===j?this.power.toDecimal():this.value;else if(n===H)t=e===j?this.power.toDecimal():Pe(this,"hash");else{if(n===j)return t=e===X?Pe(this,"hash"):e===$?this.power.equals(1)?this.value:E(Pe(this,"hash"))+D.POWER_OPERATOR+this.power.toDecimal():e===j?this.power.toString():this.value;n===$?(e===$&&(t=Pe(this,"hash")),t=e===j?this.power.toDecimal():this.value):n===X?t=e===j?this.power.toDecimal():Pe(this,"hash"):n===V&&(t=e===j?Pe(this.power):Pe(this,"hash"))}return t},collectSymbols:function(e,t,n,r){var i=[];if(this.symbols)for(var s in this.symbols){s=this.symbols[s];!r||s.group!==j&&s.group!==$?i.push(e?e(s,t):s):i=i.concat(s.collectSymbols())}else i.push(this);return i.sort(n=null===n?void 0:n)},latex:function(e){return Ge.latex(this,e)},text:function(e){return Pe(this,e)},isOne:function(e){return this.group===F?this.multiplier[e?"absEquals":"equals"](1):this.power.equals(0)},isComposite:function(){var e=this.group,t=this.previousGroup;return e===$||e===j||t===j||t===$},isCombination:function(){var e=this.group,t=this.previousGroup;return e===X||t===X},lessThan:function(e){return this.multiplier.lessThan(e)},greaterThan:function(e){return ne(e)||(e=new Fe(e)),!(!this.isConstant(!0)||!e.isConstant(!0))&&this.multiplier.greaterThan(e.multiplier)},getDenom:function(){var e=this.clone();if((e=this.group===X&&this.power.lessThan(0)?d.expand(e):e).power.lessThan(0)||e.group===V&&e.power.multiplier.lessThan(0)){var t,n=d.parse(e.multiplier.den);(t=e.toUnitMultiplier()).power.negate(),t=d.multiply(n,t)}else if(e.group===X)for(var r in t=d.parse(e.multiplier.den),e.symbols){var i=e.symbols[r];(i.power<0||i.group===V&&i.power.multiplier.lessThan(0))&&(t=d.multiply(t,e.symbols[r].clone().invert()))}else t=d.parse(e.multiplier.den);return t},getNum:function(){var t,e=this.clone();return(e=e.group===X&&e.power.lessThan(0)?d.expand(e):e).power.greaterThan(0)&&e.group!==X||e.group===V&&e.power.multiplier.greaterThan(0)?t=d.multiply(d.parse(e.multiplier.num),e.toUnitMultiplier()):e.group===X?(t=d.parse(e.multiplier.num),e.each(function(e){(0<e.power||e.group===V&&0<e.power.multiplier)&&(t=d.multiply(t,e.clone()))})):t=d.parse(e.multiplier.num),t},toString:function(){return this.text()}};var Be={convert:function(e,t){var n,r,i,s;return 0===e?s=[0,1]:e<1e-6||1e20<e?(n=this.quickConversion(Number(e)))[1]<=1e20?(i=e/(r=Math.abs(e)),(s=this.fullConversion(r.toFixed((n[1]+"").length-1)))[0]=s[0]*i):s=n:s=this.fullConversion(e),s},quickConversion:function(e){return function(e){T.isScientific(e)&&(e=y(e));var t=1===(n=(e=(n="","-"===(e=(t="string"!=typeof(t=e)?t.toString():t).charAt(0))?(t=t.substr(1,t.length),n="-"):"+"===e&&(t=t.substr(1,t.length)),{sign:n,value:t})).value.split(".")).length?n[0]:n[0]+n[1],n=n[1]?n[1].length:0,n=`1${"0".repeat(n)}`;return"0"!==t&&(t=t.replace(/^0+/,"")),[e.sign+t,n]}(e)},fullConversion:function(e){for(var t=!1,n=0,r=1,i=1,s=0,o=0,a=e;!t;){1e4<++o&&(t=!0);var u=Math.floor(a),l=n+u*i,c=r+u*s,u=a-u;u<1e-16&&(t=!0),a=1/u,n=i,r=s,i=l,s=c,(Math.abs(l/c-e)<1e-16||30<o)&&(t=!0)}return[l,c]}},Ge={parser:function(){var e,t=["classes","setOperator","getOperators","getBrackets","tokenize","toRPN","tree","units"],n=new P;for(e in n)-1===t.indexOf(e)&&delete n[e];return n.setOperator({precedence:8,operator:"\\",action:"slash",prefix:!0,postfix:!1,leftAssoc:!0,operation:function(e){return e}}),n.setOperator({precedence:8,operator:"\\,",action:"slash_comma",prefix:!0,postfix:!1,leftAssoc:!0,operation:function(e){return e}}),n.getBrackets()["{"].maps_to=void 0,n}(),space:"~",dot:" \\cdot ",latex:function(e,t){if((e=e.clone?e.clone():e)instanceof d.classes.Collection&&(e=e.elements),ae(e)){for(var n=[],r=0;r<e.length;r++){var i=e[r];ne(i)||(i=d.parse(i)),n.push(this.latex(i,t))}return this.brackets(n.join(", "),"square")}if(ie(e)){for(var s="\\begin{pmatrix}\n",r=0;r<e.elements.length;r++){for(var o=[],a=e.elements[r],u=0;u<a.length;u++)o.push(this.latex(a[u],t));s+=o.join(" & "),r<e.elements.length-1&&(s+="\\\\\n")}return s+="\\end{pmatrix}"}if(re(e)){for(s="\\left[",r=0;r<e.elements.length;r++)s+=this.latex(e.elements[r],t)+" "+(r!==e.elements.length-1?",\\,":"");return s+="\\right]"}if(se(e)){for(s="\\{",r=0;r<e.elements.length;r++)s+=this.latex(e.elements[r],t)+" "+(r!==e.elements.length-1?",\\,":"");return s+="\\}"}var l,c="decimal"===t||"decimals"===t,p=(e=e.clone()).power,f=A(p),h=e.multiplier.lessThan(0);if(e.group===B&&c)return String(e.multiplier.toDecimal()*Math.pow(e.value,e.power.toDecimal()));e.multiplier=e.multiplier.abs(),l=c?[String(e.multiplier.toDecimal()),""]:[e.multiplier.num,e.multiplier.den];var m,g=this.value(e,f,t,h);f&&p.negate(),c?(m=ne(p)?Ge.latex(p,t):String(p.toDecimal()),"1"===String(m)&&(m="")):m=ne(p)?this.latex(p,t):this.formatFrac(p,!0);p=["",""];return p[f?1:0]=m,((h?"-":"")+this.set(l,g,p,e.group===X)).replace(/\+\-/gi,"-")},greek:{alpha:"\\alpha",beta:"\\beta",gamma:"\\gamma",delta:"\\delta",epsilon:"\\epsilon",zeta:"\\zeta",eta:"\\eta",theta:"\\theta",iota:"\\iota",kappa:"\\kappa",lambda:"\\lambda",mu:"\\mu",nu:"\\nu",xi:"\\xi",omnikron:"\\omnikron",pi:"\\pi",rho:"\\rho",sigma:"\\sigma",tau:"\\tau",upsilon:"\\upsilon",phi:"\\phi",chi:"\\chi",psi:"\\psi",omega:"\\omega",Gamma:"\\Gamma",Delta:"\\Delta",Epsilon:"\\Epsilon",Theta:"\\Theta",Lambda:"\\Lambda",Xi:"\\Xi",Pi:"\\Pi",Sigma:"\\Sigma",Phi:"\\Phi",Psi:"\\Psi",Omega:"\\Omega"},symbols:{arccos:"\\arccos",cos:"\\cos",csc:"\\csc",exp:"\\exp",ker:"\\ker",limsup:"\\limsup",min:"\\min",sinh:"\\sinh",arcsin:"\\arcsin",cosh:"\\cosh",deg:"\\deg",gcd:"\\gcd",lg:"\\lg",ln:"\\ln",Pr:"\\Pr",sqrt:"\\sqrt",sup:"\\sup",arctan:"\\arctan",cot:"\\cot",det:"\\det",hom:"\\hom",lim:"\\lim",log:"\\log",LN:"\\LN",sec:"\\sec",tan:"\\tan",arg:"\\arg",coth:"\\coth",dim:"\\dim",inf:"\\inf",liminf:"\\liminf",max:"\\max",sin:"\\sin",tanh:"\\tanh"},value:function(n,e,r,t){var i,s,o,a,u,l,c=n.group,p=n.previousGroup,f=["",""],h=e?1:0;if(n.isInfinity)f[h]="\\infty";else if(c===G||c===B||p===G||p===B||p===F){(x=this.formatSubscripts(n.value)).replace&&(x=x.replace(/(.+)_$/,"$1\\_"));var m=String(x).split("_"),e=this.greek[m[0]];e&&(m[0]=e,x=m.join("_")),(n=this.symbols[m[0]])&&(m[0]=n,x=m.join("_")),f[h]=x}else if(c===H||p===H){for(var g,d,v,w,y=[],m=n.fname,b=0;b<n.args.length;b++){var S,M="string"==typeof(S=n.args[b])?S:this.latex(S,r);y.push(M)}m===z?f[h]="\\sqrt"+this.braces(y.join(",")):m===Q?f[h]=this.brackets(y.join(","),"abs"):m===Z?f[h]=this.brackets(y.join(","),"parens"):"limit"===m?f[h]=" \\lim\\limits_{"+y[1]+" \\to "+y[2]+"} "+y[0]:"integrate"===m?f[h]="\\int"+this.braces(y[0])+this.braces("d"+y[1]):"defint"===m?f[h]="\\int\\limits_"+this.braces(y[1])+"^"+this.braces(y[2])+" "+y[0]+" d"+y[3]:m===Y||m===W?((S=n.args[0]).power.equals(1)&&(S.isComposite()||S.isCombination())&&(y[0]=this.brackets(y[0])),f[h]=y[0]+(m===Y?"!":"!!")):"floor"===m?f[h]="\\left \\lfloor"+this.braces(y[0])+"\\right \\rfloor":"ceil"===m?f[h]="\\left \\lceil"+this.braces(y[0])+"\\right \\rceil":m===D.LOG&&1<y.length?f[h]="\\mathrm"+this.braces(D.LOG)+"_"+this.braces(y[1])+this.brackets(y[0]):m===D.LOG10?f[h]="\\mathrm"+this.braces(D.LOG)+"_"+this.braces(10)+this.brackets(y[0]):"sum"===m?(g=y[0],d=y[1],v=y[2],w=y[3],f[h]="\\sum\\limits_{"+this.braces(d)+"="+this.braces(v)+"}^"+this.braces(w)+" "+this.braces(g)):"product"===m?(g=y[0],d=y[1],v=y[2],w=y[3],f[h]="\\prod\\limits_{"+this.braces(d)+"="+this.braces(v)+"}^"+this.braces(w)+" "+this.braces(g)):"nthroot"===m?f[h]="\\sqrt["+y[1]+"]"+this.braces(y[0]):"mod"===m?f[h]=y[0]+" \\bmod "+y[1]:"realpart"===m?f[h]="\\operatorname{Re}"+this.brackets(y[0]):"imagpart"===m?f[h]="\\operatorname{Im}"+this.brackets(y[0]):(m=""!==m?"\\mathrm"+this.braces(m.replace(/_/g,"\\_")):"",n.isConversion?f[h]=m+this.brackets(y.join(""),"parens"):f[h]=m+this.brackets(y.join(","),"parens"))}else if(n.isComposite()){for(var N=n.collectSymbols().sort(c===$||p===$?function(e,t){return t.group-e.group}:function(e,t){e=ne(e.power)?-1:e.power;return(ne(t.power)?-1:t.power)-e}),E=[],q=N.length,b=0;b<q;b++)E.push(Ge.latex(N[b],r));var x=E.join("+");f[h]=n.isLinear()&&n.multiplier.equals(1)&&!t?x:this.brackets(x,"parens")}else c!==X&&p!==V&&p!==X||(c===X&&n.distributeExponent(),i=[],s=[],o=[],a=[],l=u=0,c=function(e,t,n){if(1<n&&0<t.length)for(var r=t.length,i=0;i<r;i++){var s=t[i],o=e[s];/^\\left\(.+\\right\)\^\{.+\}$/g.test(o)||/^\\left\(.+\\right\)$/g.test(o)||(e[s]=Ge.brackets(o,"parens"))}return e},n.each(function(e){var t;A(e.power)?(t=Ge.latex(e.invert(),r),l++,e.isComposite()&&(1!=n.multiplier.den&&1==Math.abs(e.power)&&(t=Ge.brackets(t,"parens")),o.push(i.length)),i.push(t)):(t=Ge.latex(e,r),u++,e.isComposite()&&(1!=n.multiplier.num&&1==Math.abs(e.power)&&(t=Ge.brackets(t,"parens")),a.push(s.length)),s.push(t))}),c(s,a,u),f[0]=s.join(this.dot),c(i,o,l),f[1]=i.join(this.dot));return f},set:function(e,t,n,r){function i(e){return/^\\left\(.+\\right\)$/.test(e)}var s;n=n&&this.formatP(n),r&&(s=n[0],n[0]=""),t=this.merge(t,n);var o=e[0],n=e[1],e=t[0],t=t[1];e&&1===Number(o)&&(o=""),1===Number(n)&&(n="");e=this.join(o,e,i(e)?"":this.dot),t=this.join(n,t,i(t)?"":this.dot);if(e&&t){t=this.frac(e,t);return t=r&&s?this.brackets(t)+s:t}return e},merge:function(e,t){for(var n=[],r=0;r<2;r++)n[r]=e[r]+t[r];return n},join:function(e,t,n){return e||t?e&&!t?e:t&&!e?t:e+n+t:""},formatSubscripts:function(e){for(var t=e.toString().split("_"),n="";1<t.length;)0<t.length&&(n="_"+this.braces(t.pop()+n));return t[0]+n},formatP:function(e){for(var t=0;t<2;t++){var n=e[t];n&&(e[t]="^"+this.braces(n))}return e},formatFrac:function(e,t){var n=e.num.toString(),e=e.den.toString();return t&&"1"===n&&"1"===e?"":"1"===e?n:this.frac(n,e)},frac:function(e,t){return"\\frac"+this.braces(e)+this.braces(t)},braces:function(e){return"{"+e+"}"},brackets:function(e,t){t={parens:["(",")"],square:["[","]"],brace:["{","}"],abs:["|","|"],angle:["\\langle","\\rangle"]}[t=t||"parens"];return"\\left"+t[0]+e+"\\right"+t[1]},filterTokens:function(e){var t=[];ae(e)&&(t.type=e.type);for(var n=["\\","left","right","big","Big","large","Large"],r=0,i=e.length;r<i;r++){var s=e[r],o=e[r+1];"\\"===s.value&&"\\"===o.value?t.push(s):ae(s)?t.push(Ge.filterTokens(s)):-1===n.indexOf(s.value)&&t.push(s)}return t},parse:function(e){function t(e){return s[void 0===e?++a:a+=e]}function n(){return Ge.parse(t())}function r(e){return e in o?o[e]:"*"===e&&"&"===s[a+1].value?(t(2),","):"&"===e?(t(),","):"\\"===e?"],[":e}var i="",s=this.filterTokens(e),o={cdot:"",times:"",infty:"Infinity"},a=0;for(u=s.length;a<u;a++){var u,l,c,p,f,h,m,g=s[a];"frac"===g.value?i+=n()+"/"+n():g.value in Ge.symbols?g.value===z&&"vector"===s[a+1].type&&"Set"===s[a+2].type?(f=n(),i+=n()+"^"+E("1/"+f)):i+=g.value+n():"int"===g.value?(h=n(),a++,c=r((c=t().value).substring(1,c.length)),i+="integrate"+E(h+","+c)):"int_"===g.value?(u=n(),a++,void 0===(l=t().value)&&(a--,l=n()),h=n(),"differentialD"===(c=","===(c=t().value)?t().value:c)&&(a++,c=t().value),"mathrm"===c&&(a++,c=t().value),i+="defint"+E(h+","+u+","+l+","+c)):g.value&&g.value.startsWith("int_")?(u=g.value.replace("int_",""),console.log("uppernow"),a++,void 0===(l=t().value)&&(a--,l=n()),h=n(),"differentialD"===(c=","===(c=t().value)?t().value:c)&&(a++,c=t().value),"mathrm"===c&&(a++,c=t().value),i+="defint"+E(h+","+u+","+l+","+c)):"mathrm"===g.value?i+=(h=s[++a][0].value)+n():"sum_"===g.value||"prod_"===g.value?(p="sum_"===g.value?"sum":"product",m=t(),a++,f=n(),h=n(),i+=p+E([h,r(m[0]),r(m[2]),r(f)].join(","))):"lim_"===g.value?(m=t(),i+="limit"+E([n(),r(m[0]),r(m[2])].join(","))):"begin"===g.value?(m=t(),Array.isArray(m)&&"matrix"===m[0].value&&(i+="matrix([")):"end"===g.value?(m=t(),Array.isArray(m)&&"matrix"===m[0].value&&(i+="])")):Array.isArray(g)?i+=r(Ge.parse(g)):i+=r(g.value.toString())}return E(i)}};function Ve(e){re(e)?this.elements=e.items.slice(0):ae(e)?this.elements=e.slice(0):this.elements=[].slice.call(arguments)}function He(){var e=arguments,t=e.length,n=[];if(ie(e))for(o=0;o<t;o++)n.push(e[o].slice(0));else for(var r,i,s,o=0;o<t;o++)r=e[o],re(r)&&(r=r.elements),s=(r=!ae(r)?[r]:r).length,i&&i!==s&&K("Unable to create Matrix. Row dimensions do not match!"),n.push(r),i=s;this.elements=n}function je(e){if(this.elements=[],e=!re(e)?Ve.fromArray(arguments):e)for(var t=e.elements,n=0,r=t.length;n<r;n++)this.add(t[n])}Ve.arrayPrefill=function(e,t){var n=[];t=t||0;for(var r=0;r<e;r++)n[r]=t;return n},Ve.fromArray=function(e){var t=new Ve;return t.elements=e,t},Ve.fromSet=function(e){return Ve.fromArray(e.elements)},Ve.prototype={custom:!0,e:function(e){return e<1||e>this.elements.length?null:this.elements[e-1]},set:function(e,t){ne(t)||(t=new Fe(t)),this.elements[e]=t},dimensions:function(){return this.elements.length},modulus:function(){return ye("SAFE",function(){return d.pow(this.dot(this.clone()),new Fe(.5))},void 0,this)},eql:function(e){var t=this.elements.length,n=e.elements||e;if(t!==n.length)return!1;do{if(Math.abs(d.subtract(this.elements[t-1],n[t-1]).valueOf())>PRECISION)return!1}while(--t);return!0},clone:function(){for(var e=new Ve,t=this.elements.length,n=0;n<t;n++)e.elements.push(this.elements[n].clone());return this.getter&&(e.getter=this.getter.clone()),e},map:function(n){var r=[];return this.each(function(e,t){r.push(n(e,t))}),new Ve(r)},each:function(e){for(var t,n=this.elements.length,r=n;e(this.elements[t=r-n],1+t),--n;);},toUnitVector:function(){return ye("SAFE",function(){var t=this.modulus();return 0===t.valueOf()?this.clone():this.map(function(e){return d.divide(e,t)})},void 0,this)},angleFrom:function(o){return ye("SAFE",function(){var n=o.elements||o;if(this.elements.length!==n.length)return null;var r=new Fe(0),i=new Fe(0),s=new Fe(0);this.each(function(e,t){r=d.add(r,d.multiply(e,n[t-1])),i=d.add(i,d.multiply(e,e)),s=d.add(s,d.multiply(n[t-1],n[t-1]))});var i=d.pow(i,new Fe(.5)),s=d.pow(s,new Fe(.5)),e=d.multiply(i,s);if(0===e.valueOf())return null;var t=d.divide(r,e),e=t.valueOf();return e<-1&&(t=-1),1<e&&(t=1),new Fe(Math.acos(t))},void 0,this)},isParallelTo:function(e){e=this.angleFrom(e).valueOf();return null===e?null:e<=PRECISION},isAntiparallelTo:function(e){e=this.angleFrom(e).valueOf();return null===e?null:Math.abs(e-Math.PI)<=PRECISION},isPerpendicularTo:function(e){e=this.dot(e);return null===e?null:Math.abs(e)<=PRECISION},add:function(e){return ye("SAFE",function(){var n=e.elements||e;return this.elements.length!==n.length?null:this.map(function(e,t){return d.add(e,n[t-1])})},void 0,this)},subtract:function(e){return ye("SAFE",function(){var n=e.elements||e;return this.elements.length!==n.length?null:this.map(function(e,t){return d.subtract(e,n[t-1])})},void 0,this)},multiply:function(t){return this.map(function(e){return e.clone()*t.clone()})},x:function(e){return this.multiply(e)},dot:function(r){return ye("SAFE",function(){var e=r.elements||r,t=new Fe(0),n=this.elements.length;if(n!==e.length)return null;for(;t=d.add(t,d.multiply(this.elements[n-1],e[n-1])),--n;);return t},void 0,this)},cross:function(e){var t=e.elements||e;if(3!==this.elements.length||3!==t.length)return null;var n=this.elements;return ye("SAFE",function(){return new Ve([d.subtract(d.multiply(n[1],t[2]),d.multiply(n[2],t[1])),d.subtract(d.multiply(n[2],t[0]),d.multiply(n[0],t[2])),d.subtract(d.multiply(n[0],t[1]),d.multiply(n[1],t[0]))])},void 0,this)},max:function(){for(var e,t=0,n=this.elements.length,r=n;e=r-n,Math.abs(this.elements[e].valueOf())>Math.abs(t.valueOf())&&(t=this.elements[e]),--n;);return t},magnitude:function(){var t=new Fe(0);return this.each(function(e){t=d.add(t,d.pow(e,new Fe(2)))}),d.sqrt(t)},indexOf:function(e){for(var t,n=null,r=this.elements.length,i=r;t=i-r,null===n&&this.elements[t].valueOf()===e.valueOf()&&(n=1+t),--r;);return n},text:function(e){return Pe(this)},toString:function(){return this.text()},latex:function(e){for(var t=[],n=0;n<this.elements.length;n++)t.push(Ge.latex.call(Ge,this.elements[n],e));return"["+t.join(", ")+"]"}},He.identity=function(e){for(var t=new He,n=0;n<e;n++){t.elements.push([]);for(var r=0;r<e;r++)t.set(n,r,new Fe(n===r?1:0))}return t},He.fromArray=function(e){function t(e){return He.apply(this,e)}return t.prototype=He.prototype,new t(e)},He.zeroMatrix=function(e,t){for(var n=new He,r=0;r<e;r++)n.elements.push(Ve.arrayPrefill(t,new Fe(0)));return n},(He.prototype={custom:!0,get:function(e,t){if(this.elements[e])return this.elements[e][t]},map:function(r,i){var s=new He;return this.each(function(e,t,n){s.set(t,n,r.call(s,e),i)}),s},set:function(e,t,n,r){this.elements[e]||(this.elements[e]=[]),this.elements[e][t]=r||ne(n)?n:new Fe(n)},cols:function(){return this.elements[0].length},rows:function(){return this.elements.length},row:function(e){return!e||e>this.cols()?[]:this.elements[e-1]},col:function(e){var t=this.rows(),n=[];if(e>this.cols()||!e)return n;for(var r=0;r<t;r++)n.push(this.elements[r][e-1]);return n},eachElement:function(e){for(var t,n=this.rows(),r=this.cols(),i=0;i<n;i++)for(t=0;t<r;t++)e.call(this,this.elements[i][t],i,t)},determinant:function(){if(!this.isSquare())return null;for(var e,t=this.toRightTriangular(),n=t.elements[0][0],r=t.elements.length-1,i=r;n=d.multiply(n,t.elements[e=i-r+1][e]),--r;);return n},isSquare:function(){return this.elements.length===this.elements[0].length},isSingular:function(){return this.isSquare()&&0===this.determinant()},augment:function(e){var t=this.rows();t!==e.rows()&&K("Cannot augment matrix. Rows don't match.");for(var n=0;n<t;n++)this.elements[n]=this.elements[n].concat(e.elements[n]);return this},clone:function(){for(var e=this.rows(),t=this.cols(),n=new He,r=0;r<e;r++){n.elements[r]=[];for(var i=0;i<t;i++){var s=this.elements[r][i];n.elements[r][i]=ne(s)?s.clone():s}}return n},invert:function(){return this.isSquare()||K("Matrix is not square!"),ye("SAFE",function(){var e,t,n,r,i,s,o,a=this.elements.length,u=a,l=He.identity(a),c=this.augment(l).toRightTriangular(),p=c.elements[0].length,f=[];do{for(i=[],n=p,f[e=a-1]=[],s=c.elements[e][e];o=d.divide(c.elements[e][r=p-n],s.clone()),i.push(o),u<=r&&f[e].push(o),--n;);for(c.elements[e]=i,t=0;t<e;t++){for(i=[],n=p;i.push(d.subtract(c.elements[t][r=p-n].clone(),d.multiply(c.elements[e][r].clone(),c.elements[t][e].clone()))),--n;);c.elements[t]=i}}while(--a);return He.fromArray(f)},void 0,this)},toRightTriangular:function(){return ye("SAFE",function(){var e,t,n,r=this.clone(),i=this.elements.length,s=i,o=this.elements[0].length;do{if(0===r.elements[t=s-i][t].valueOf())for(var a=1+t;a<s;a++)if((e=r.elements[a][t])&&0!==e.valueOf()){for(l=[],c=o;l.push(d.add(r.elements[t][n=o-c].clone(),r.elements[a][n].clone())),--c;);r.elements[t]=l;break}if(0!==r.elements[t][t].valueOf())for(a=1+t;a<s;a++){for(var u=d.divide(r.elements[a][t].clone(),r.elements[t][t].clone()),l=[],c=o;l.push((n=o-c)<=t?new Fe(0):d.subtract(r.elements[a][n].clone(),d.multiply(r.elements[t][n].clone(),u.clone()))),--c;);r.elements[a]=l}}while(--i);return r},void 0,this)},transpose:function(){var e,t,n,r=this.elements.length,i=this.elements[0].length,s=new He,o=i;do{for(s.elements[e=i-o]=[],t=r;s.elements[e][n=r-t]=this.elements[n][e].clone(),--t;);}while(--o);return s},canMultiplyFromLeft:function(e){e=(ie(e)?e.elements:e).length;return this.elements[0].length===e},sameSize:function(e){return this.rows()===e.rows()&&this.cols()===e.cols()},multiply:function(g){return ye("SAFE",function(){var e=g.elements||g;if(!this.canMultiplyFromLeft(e)){if(this.sameSize(g)){for(var t=new He,n=this.rows(),r=0;r<n;r++){var i=d.multiply(new Ve(this.elements[r]),new Ve(g.elements[r]));t.elements[r]=i.elements}return t}return null}var s,o,a,u,l,c=this.elements.length,p=c,f=e[0].length,h=this.elements[0].length,m=[];do{m[r=p-c]=[],s=f;do{for(o=f-s,a=new Fe(0),u=h;a=d.add(a,d.multiply(this.elements[r][l=h-u],e[l][o])),--u;);}while(m[r][o]=a,--s)}while(--c);return He.fromArray(m)},void 0,this)},add:function(i,s){var o=new He;return this.sameSize(i)&&this.eachElement(function(e,t,n){var r=d.add(e.clone(),i.elements[t][n].clone());s&&(r=s.call(o,r,e,i.elements[t][n])),o.set(t,n,r)}),o},subtract:function(i,s){var o=new He;return this.sameSize(i)&&this.eachElement(function(e,t,n){var r=d.subtract(e.clone(),i.elements[t][n].clone());s&&(r=s.call(o,r,e,i.elements[t][n])),o.set(t,n,r)}),o},negate:function(){return this.each(function(e){return e.negate()}),this},toVector:function(){if(1!==this.rows()&&1!==this.cols())return this;var e=new Ve;return e.elements=this.elements,e},toString:function(e,n){var t=this.rows(),r=[];for(var i=0;i<t;i++)r.push("["+this.elements[i].map(function(e){var t=n?e.multiplier.toDecimal():e.toString();return void 0!==e?t:""}).join(",")+"]");return"matrix"+E(r.join(","))},text:function(){return"matrix("+this.elements.toString("")+")"},latex:function(i){var s=this.cols(),o=this.elements;return ce("\\begin{vmatrix}{0}\\end{vmatrix}",function(){var e,t=[];for(e in o){for(var n=[],r=0;r<s;r++)n.push(Ge.latex.call(Ge,o[e][r],i));t.push(n.join(" & "))}return t.join(" \\cr ")})}}).each=He.prototype.eachElement,je.fromArray=function(e){function t(e){return je.apply(this,e)}return t.prototype=je.prototype,new t(e)},je.prototype={add:function(e){this.contains(e)||this.elements.push(e.clone())},contains:function(e){for(var t=0;t<this.elements.length;t++){var n=this.elements[t];if(e.equals(n))return!0}return!1},each:function(e){for(var t=this.elements,n=new je,r=0,i=t.length;r<i;r++){var s=t[r];e.call(this,s,n,r)}return n},clone:function(){var t=new je;return this.each(function(e){t.add(e.clone())}),t},union:function(e){var t=this.clone();return e.each(function(e){t.add(e)}),t},difference:function(e){var t=this.clone();return e.each(function(e){t.remove(e)}),t},remove:function(e){for(var t=0,n=this.elements.length;t<n;t++)if(this.elements[t].equals(e))return we(this.elements,t),!0;return!1},intersection:function(e){var t=new je,n=this;return e.each(function(e){n.contains(e)&&t.add(e)}),t},intersects:function(e){return 0<this.intersection(e).elements.length},is_subset:function(e){for(var t=e.elements,n=0,r=t.length;n<r;n++)if(!this.contains(t[n]))return!1;return!0},toString:function(){return"{"+this.elements.join(",")+"}"}};var Xe={dependencies:{_rename:{"Math2.factorial":"factorial"},factorial:{"Math2.gamma":Te.gamma},gamma_incomplete:{"Math2.factorial":Te.factorial},Li:{"Math2.Ei":Te.Ei,"Math2.bigLog":Te.bigLog,Frac:De},Ci:{"Math2.factorial":Te.factorial},Ei:{"Math2.factorial":Te.factorial},Si:{"Math2.factorial":Te.factorial},Shi:{"Math2.factorial":Te.factorial},Chi:{isInt:ue,nround:me,"Math2.num_integrate":Te.num_integrate},factor:{"Math2.ifactor":Te.ifactor,Symbol:Fe},num_integrate:{"Math2.simpson":Te.simpson,nround:me},fib:{even:ge}},reformat:{diff:function(e,t){var n=e.args[1].toString(),e="var f = "+Xe.build(e.args[0].toString(),[n])+";";return t[1]+="var diff = "+Te.diff.toString()+";",t[1]+=e,["diff(f)("+n+")",t]}},getProperName:function(e){return{continued_fraction:"continuedFraction"}[e]||e},compileDependencies:function(e,t){var n,r,i=Xe.dependencies[e],s=t&&t[1]?t[1]:"",o=t&&t[0]?t[0]:{};for(n in i)"object"!=typeof i[n]&&(s+="var "+(1<(r=n.split(".")).length?r[1]:r[0])+"="+i[n]+";",o[n]=r.pop());return[o,s]},getArgsDeps:function(e,t){for(var n=e.args,r=0;r<n.length;r++)e.args[r].each(function(e){e.group===H&&(t=Xe.compileDependencies(e.fname,t))});return t},build:function(e,t){e=ye("PARSE2NUMBER",function(){return d.parse(e)},!0);var n=b(e),l=[],c=[],p=function(s,o){""===s.fname&&(s=Fe.unwrapPARENS(s)),o=o||[];function e(e){return e=e in Math?"Math."+e:(e=Xe.getProperName(e),-1===l.indexOf(e)&&(o.push("var "+e+" = "+Te[e].toString()+"; "),l.push(e)),e),e+=E(s.args.map(function(e){return p(e,o)[0]}).join(","))}var t,n,r=[],i=s.group,a="",u=function(e){var t,e=e===X?"*":"+",n=[];for(t in s.symbols){var r=s.symbols[t],i=p(r,o)[0];r.isComposite()&&(i=E(i)),n.push(i)}e=n.join(e);return e=e&&!s.multiplier.equals(1)?E(e):e};return i===F?r.push(s.multiplier.toDecimal()):s.multiplier.equals(-1)?a="-":s.multiplier.equals(1)||r.push(s.multiplier.toDecimal()),i===G||i===B?t=s.value:i===H?(c=Xe.compileDependencies(s.fname,c),c=Xe.getArgsDeps(s,c),t=Xe.reformat[s.fname]?(n=Xe.reformat[s.fname](s,c),c=n[1],n[0]):e(s.fname)):i===V?(i=s.previousGroup)===F||i===G?t=s.value:i===H?(t=e(s.fname),c=Xe.compileDependencies(s.fname,c),c=Xe.getArgsDeps(s,c)):t=u(s.previousGroup):t=u(s.group),s.group===F||s.power.equals(1)||(u=p(d.parse(s.power)),o.push(u[1]),t="Math.pow"+E(t+","+u[0])),t&&r.push(a+t),[r.join("*"),o.join("").replace(/\n+\s+/g," ")]};t&&(n=t);var r,i=p(e);for(r in c[0]){var s=c[0][r];i[1]=i[1].replace(r,s),c[1]=c[1].replace(r,s)}return new Function(n,(c[1]||"")+i[1]+" return "+i[0]+";")}};x(d.CONSTANTS),x(d.functions),d.initConstants(),d.error||(d.error=K),D.LOG_FNS={log:d.functions.log,log10:d.functions.log10};function $e(n,e,r,t){var i=!1,s=/^([a-z_][a-z\d\_]*)\(([a-z_,\s]*)\):=(.+)$/gi.exec(n);return s?nerdamer.setFunction(s[1],s[2].split(","),s[3]):(n instanceof R&&(n=n.toString()),(r=!ae(r)?void 0===r?[]:[r]:r).forEach(function(e){var t;"numer"!==e?(t=d.functions[r])&&1===t[1]&&(n=`${e}(${n})`):i=!0}),s=ye("PARSE2NUMBER",function(){return d.parse(n,e)},i||D.PARSE2NUMBER),t?p[t-1]=s:p.push(s),new R(s))}var x={allSame:w,allNumeric:function(e){for(var t=0;t<e.length;t++)if(!te(e[t]))return!1;return!0},arguments2Array:be,arrayAddSlices:function(e,t){t=t||20;var n=[];n.push(e[0]);for(var r=0;r<e.length-1;r++)for(var i=e[r],s=(e[r+1]-i)/t,o=0;o<t;o++)n.push(i+=s);return n},arrayClone:function(e){for(var t=[],n=e.length,r=0;r<n;r++)t[r]=e[r].clone();return t},arrayMax:function(e){return Math.max.apply(void 0,e)},arrayMin:c,arrayEqual:function(e,t){if(e.sort(),t.sort(),e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},arrayUnique:a,arrayGetVariables:function(e){for(var t=b(e[0],null,null,!0),n=1,r=e.length;n<r;n++)t=t.concat(b(e[n]));return t=a(t).sort()},arraySum:function(e,t){for(var n=new Fe(0),r=0;r<e.length;r++)var i=e[r],n=d.add(n,ne(i)?i:d.parse(i));return t?Number(n):n},block:ye,build:Xe.build,clearU:function(e){e=f.indexOf(e);-1!==e&&(f[e]=void 0)},comboSort:function(e,t){for(var n=e.length,r=[],i=0;i<e.length;i++)r.push([e[i],t[i]]);r.sort(function(e,t){return e[0]-t[0]});for(var s=[],o=[],i=0;i<n;i++)s.push(r[i][0]),o.push(r[i][1]);return[s,o]},compare:function(e,t,n){for(var r,i={},s=0;s<n.length;s++)i[n[s]]=new Fe(Math.floor(5*Math.random())+1);return ye("PARSE2NUMBER",function(){r=d.parse(e,i).equals(d.parse(t,i))}),r},convertToVector:C,customError:n,customType:function(e){return void 0!==e&&e.custom},decompose_fn:he,each:s,evaluate:Se,even:ge,evenFraction:de,fillHoles:function(e,t){t=t||e.length;for(var n=0;n<t;n++)e[n]||(e[n]=new Fe(0));return e},firstObject:pe,format:ce,generatePrimes:u,getCoeffs:function(e,r,t){var i=[];e.each(function(e){var t,n=e.contains(r)?(t=e.stripVar(r),d.divide(e.clone(),t.clone()).power.toDecimal()):(t=e,0),e=i[n];i[n]=e?d.add(e,t):t},!0);for(var n=0;n<i.length;n++)i[n]||(i[n]=new Fe(0));return i},getU:function(e){for(var t="u",n=0,r=b(e);-1!==f.indexOf(t)||-1!==r.indexOf(t);)t="u"+n++;for(var i=0,s=f.length;i<=s;i++)if(!f[i]){f[i]=t;break}return t},importFunctions:function(){var e,t={};for(e in d.functions)t[e]=d.functions[e][0];return t},inBrackets:E,isArray:ae,isExpression:i,isFraction:v,isInt:ue,isMatrix:ie,isNegative:A,isNumericSymbol:oe,isPrime:g,isReserved:r,isSymbol:ne,isVariableSymbol:function(e){return e.group===G&&e.multiplier.equals(1)&&e.power.equals(1)},isVector:re,keys:q,knownVariable:function(e,t){var n={};return n[e]=t,n},nroots:function(e){var t,n;if(e.group===H&&""===e.fname?(t=Fe.unwrapPARENS(d.parse(e).toLinear()),n=d.parse(e.power)):e.group===B&&(t=d.parse(e.value),n=d.parse(e.power)),t&&n&&t.group===F&&n.group===F&&t.multiplier.isNegative()){for(var r=[],i=Fe.toPolarFormArray(Se(e))[0],s=d.arg(t),o=n.multiplier.den.toString(),a=n.multiplier.num.toString(),u=0;u<o;u++){var l=Se(d.parse(ce("(({0})+2*pi*({1}))/({2})",s,u,o))).multiplier.toDecimal();r.push(Se(d.parse(ce("(({0})^({1})*(cos({3})+({2})*sin({3})))^({4})",i,o,D.IMAGINARY,l,a))))}return Ve.fromArray(r)}return e.isConstant(!0,!0)?(t=e.sign(),s=Se(e.abs()),r=[(n=d.sqrt(s)).clone(),n.negate()],t<0&&(r=r.map(function(e){return d.multiply(e,Fe.imaginary())}))):r=[d.parse(e)],Ve.fromArray(r)},remove:we,reserveNames:x,range:function(e,t,n){var r=[];n=n||1;for(var i=e;i<=t;i++)r.push(i*n);return r},round:me,sameSign:function(e,t){return e<0==t<0},scientificToDecimal:y,separate:N,stringReplace:function(e,t,n,r){return e.substr(0,t)+r+e.substr(n,e.length)},text:Pe,validateName:m,variables:b,warn:ee},Ze={groups:t,Symbol:Fe,Expression:R,Frac:De,Vector:Ve,Matrix:He,Parser:P,Scientific:T,Fraction:Be,Math2:Te,LaTeX:Ge,Utils:x,PARSER:d,PARENTHESIS:Z,Settings:D,err:K,bigInt:S,bigDec:k,exceptions:e};return $e.rpn=function(e){return d.tokenize(d.toRPN(e))},$e.convertToLaTeX=function(e,t){return d.toTeX(e,t)},$e.convertFromLaTeX=function(e){e=Ge.parse(d.tokenize(e));return new R(d.parse(e))},$e.version=function(t){if(t)try{return Ze[t].version}catch(e){return"No module named "+t+" found!"}return"1.1.13"},$e.getWarnings=function(){return h},$e.setConstant=function(e,t){if(m(e),!r(e))if("delete"===t||""===t)delete d.CONSTANTS[e];else{if(isNaN(t))throw new I("Constant must be a number!");d.CONSTANTS[e]=t}return this},$e.getConstant=function(e){return String(d.constant[e])},$e.setFunction=fe,$e.getCore=function(){return Ze},$e.getExpression=$e.getEquation=R.getExpression,$e.reserved=function(e){return e?f:f.join(", ")},$e.clear=function(e,t){return"all"===e?p=[]:"last"===e?p.pop():"first"===e?p.shift():(e=e?e-1:p.length,!0===t?p[e]=void 0:we(p,e)),this},$e.flush=function(){return this.clear("all"),this},$e.expressions=function(e,t,n){for(var r=e?{}:[],i=0;i<p.length;i++){var s=t?Ge.latex(p[i],n):Pe(p[i],n);e?r[i+1]=s:r.push(s)}return r},$e.register=function(e){var t=this.getCore();if(ae(e))for(var n=0;n<e.length;n++)e&&this.register(e[n]);else if(e&&-1===D.exclude.indexOf(e.name)){if(e.dependencies)for(n=0;n<e.dependencies.length;n++)if(!t[e.dependencies[n]])throw new Error(ce("{0} requires {1} to be loaded!",e.name,e.dependencies[n]));var r=e.parent,i=e.build.call(t);r&&(t[r]||(t[e.parent]={}),("nerdamer"===r?this:t[r])[e.name]=i),e.visible&&(d.functions[e.name]=[i,e.numargs])}},$e.validateName=m,$e.validVarName=function(e){try{return m(e),-1===f.indexOf(e)}catch(e){return!1}},$e.supported=function(){return q(d.functions)},$e.numEquations=$e.numExpressions=function(){return p.length},$e.setVar=function(e,t){return m(e),e in d.CONSTANTS&&K("Cannot set value for constant "+e),"delete"===t||""===t?delete J[e]:J[e]=ne(t)?t:d.parse(t),this},$e.getVar=function(e){return J[e]},$e.clearVars=function(){return J={},this},$e.load=function(e){return e.call(this),this},$e.getVars=function(e,t){var n={};if("object"===(e=e||"text"))n=J;else for(var r in J)"latex"===e?n[r]=J[r].latex(t):"text"===e&&(n[r]=J[r].text(t));return n},$e.set=function(e,t){if("object"==typeof e)for(var n in e)$e.set(n,e[n]);-1!==["SAFE"].indexOf(e)&&K("Cannot modify setting: "+e),"PRECISION"===e?(k.set({precision:t}),21<(D.PRECISION=t)&&this.set("USE_BIG",!0)):"USE_LN"===e&&!0===t?(D.LOG="LN",D.LOG10="log",d.functions.log=D.LOG_FNS.log10,d.functions.log[0]=function(e){return e.isConstant()?new Fe(Math.log10(e)):d.symfunction(D.LOG10,[e])},d.functions.LN=D.LOG_FNS.log,delete d.functions.log10):D[e]=t},$e.get=function(e){return D[e]},$e.updateAPI=function(e){for(var t in d.functions)t in $e&&!e||($e[t]=function(n){return function(){for(var e=[].slice.call(arguments),t=0;t<e.length;t++)e[t]=d.parse(e[t]);return new R(ye("PARSE2NUMBER",function(){return d.callfunction(n,e)}))}}(t))},$e.replaceFunction=function(e,t,n){var r=d.functions[e],n=void 0===n?r[1]:n;d.functions[e]=[t.call(void 0,r[0],Ze),n]},$e.setOperator=function(e,t){d.setOperator(e,t)},$e.getOperator=function(e){return d.getOperator(e)},$e.aliasOperator=function(e,t){d.aliasOperator(e,t)},$e.tree=function(e){return d.tree(d.toRPN(d.tokenize(e)))},$e.htmlTree=function(e,t){return'<div class="tree">\n <ul>\n <li>\n'+this.tree(e).toHTML(3,t)+"\n </li>\n </ul>\n</div>"},$e.addPeeker=function(e,t){d.peekers[e]&&d.peekers[e].push(t)},$e.removePeeker=function(e,t){we(d.peekers[e],t)},$e.parse=function(e){return String(e).split(";").map(function(e){return d.parse(e)})},$e.updateAPI(),$e}({bigInt:function(){var Q=function(o){"use strict";var v=1e7,l=7,t=9007199254740992,n=m(t),c=Math.log(t);function u(e,t){return void 0===e?u[0]:void 0===t||10==+t?z(e):V(e,t)}function p(e,t){this.value=e,this.sign=t,this.isSmall=!1}function f(e){this.value=e,this.sign=e<0,this.isSmall=!0}function h(e){return-t<e&&e<t}function m(e){return e<1e7?[e]:e<1e14?[e%1e7,Math.floor(e/1e7)]:[e%1e7,Math.floor(e/1e7)%1e7,Math.floor(e/1e14)]}function w(e){g(e);var t=e.length;if(t<4&&C(e,n)<0)switch(t){case 0:return 0;case 1:return e[0];case 2:return e[0]+e[1]*v;default:return e[0]+(e[1]+e[2]*v)*v}return e}function g(e){for(var t=e.length;0===e[--t];);e.length=t+1}function y(e){for(var t=new Array(e),n=-1;++n<e;)t[n]=0;return t}function d(e){return 0<e?Math.floor(e):Math.ceil(e)}function r(e,t){for(var n,r=e.length,i=t.length,s=new Array(r),o=0,a=v,u=0;u<i;u++)n=e[u]+t[u]+o,s[u]=n-(o=a<=n?1:0)*a;for(;u<r;)n=e[u]+o,s[u++]=n-(o=n===a?1:0)*a;return 0<o&&s.push(o),s}function b(e,t){return e.length>=t.length?r(e,t):r(t,e)}function i(e,t){for(var n,r=e.length,i=new Array(r),s=v,o=0;o<r;o++)n=e[o]-s+t,t=Math.floor(n/s),i[o]=n-t*s,t+=1;for(;0<t;)i[o++]=t%s,t=Math.floor(t/s);return i}function S(e,t){for(var n,r=e.length,i=t.length,s=new Array(r),o=0,a=v,u=0;u<i;u++)o=(n=e[u]-o-t[u])<0?(n+=a,1):0,s[u]=n;for(u=i;u<r;u++){if(!((n=e[u]-o)<0)){s[u++]=n;break}n+=a,s[u]=n}for(;u<r;u++)s[u]=e[u];return g(s),s}function s(e,t,n){for(var r,i=e.length,s=new Array(i),o=-t,a=v,u=0;u<i;u++)r=e[u]+o,o=Math.floor(r/a),s[u]=(r%=a)<0?r+a:r;return"number"==typeof(s=w(s))?new f(s=n?-s:s):new p(s,n)}function M(e,t){for(var n,r,i=e.length,s=t.length,o=y(i+s),a=v,u=0;u<i;++u)for(var l=e[u],c=0;c<s;++c)n=l*t[c]+o[u+c],r=Math.floor(n/a),o[u+c]=n-r*a,o[u+c+1]+=r;return g(o),o}function N(e,t){for(var n,r=e.length,i=new Array(r),s=v,o=0,a=0;a<r;a++)n=e[a]*t+o,o=Math.floor(n/s),i[a]=n-o*s;for(;0<o;)i[a++]=o%s,o=Math.floor(o/s);return i}function E(e,t){for(var n=[];0<t--;)n.push(0);return n.concat(e)}function a(e,t,n){return new p(e<v?N(t,e):M(t,m(e)),n)}function q(e){for(var t,n=e.length,r=y(n+n),i=v,s=0;s<n;s++){for(var o,a=0-(o=e[s])*o,u=s;u<n;u++)t=o*e[u]*2+r[s+u]+a,a=Math.floor(t/i),r[s+u]=t-a*i;r[s+n]=a}return g(r),r}function x(e,t){for(var n,r=e.length,i=y(r),s=v,o=0,a=r-1;0<=a;--a)o=(n=o*s+e[a])-(n=d(n/t))*t,i[a]=0|n;return[i,0|o]}function A(e,t){var n=z(t),r=e.value,i=n.value;if(0===i)throw new Error("Cannot divide by zero");if(e.isSmall)return n.isSmall?[new f(d(r/i)),new f(r%i)]:[u[0],e];if(n.isSmall){if(1===i)return[e,u[0]];if(-1==i)return[e.negate(),u[0]];var s=Math.abs(i);if(s<v){var o=w((a=x(r,s))[0]),t=a[1];return e.sign&&(t=-t),"number"==typeof o?[new f(o=e.sign!==n.sign?-o:o),new f(t)]:[new p(o,e.sign!==n.sign),new f(t)]}i=m(s)}s=C(r,i);if(-1===s)return[u[0],e];if(0===s)return[u[e.sign===n.sign?1:-1],u[0]];o=(a=(r.length+i.length<=200?function(e,t){var n,r,i,s,o,a,u,l=e.length,c=t.length,p=v,f=y(t.length),h=t[c-1],m=Math.ceil(p/(2*h)),g=N(e,m),d=N(t,m);for(g.length<=l&&g.push(0),d.push(0),h=d[c-1],r=l-c;0<=r;r--){for(n=p-1,g[r+c]!==h&&(n=Math.floor((g[r+c]*p+g[r+c-1])/h)),a=d.length,o=s=i=0;o<a;o++)i+=n*d[o],u=Math.floor(i/p),s+=g[r+o]-(i-u*p),i=u,s=s<0?(g[r+o]=s+p,-1):(g[r+o]=s,0);for(;0!==s;){for(--n,o=i=0;o<a;o++)i=(i+=g[r+o]-p+d[o])<0?(g[r+o]=i+p,0):(g[r+o]=i,1);s+=i}f[r]=n}return g=x(g,m)[0],[w(f),w(g)]}:function(e,t){for(var n,r,i,s,o,a=e.length,u=t.length,l=[],c=[],p=v;a;)if(c.unshift(e[--a]),g(c),C(c,t)<0)l.push(0);else{for(i=c[(r=c.length)-1]*p+c[r-2],s=t[u-1]*p+t[u-2],u<r&&(i=(i+1)*p),n=Math.ceil(i/s);!(C(o=N(t,n),c)<=0)&&--n;);l.push(n),c=S(c,o)}return l.reverse(),[w(l),w(c)]})(r,i))[0];var n=e.sign!==n.sign,a=a[1],e=e.sign;return[o="number"==typeof o?new f(o=n?-o:o):new p(o,n),a="number"==typeof a?new f(a=e?-a:a):new p(a,e)]}function C(e,t){if(e.length!==t.length)return e.length>t.length?1:-1;for(var n=e.length-1;0<=n;n--)if(e[n]!==t[n])return e[n]>t[n]?1:-1;return 0}function L(e){e=e.abs();return!e.isUnit()&&(!!(e.equals(2)||e.equals(3)||e.equals(5))||!(e.isEven()||e.isDivisibleBy(3)||e.isDivisibleBy(5))&&(!!e.lesser(49)||void 0))}function I(e,t){for(var n,r,i,s=e.prev(),o=s,a=0;o.isEven();)o=o.divide(2),a++;e:for(r=0;r<t.length;r++)if(!e.lesser(t[r])&&!(i=Q(t[r]).modPow(o,e)).equals(u[1])&&!i.equals(s)){for(n=a-1;0!=n;n--){if((i=i.square().mod(e)).isUnit())return!1;if(i.equals(s))continue e}return!1}return!0}p.prototype=Object.create(u.prototype),f.prototype=Object.create(u.prototype),p.prototype.plus=p.prototype.add=function(e){var t=z(e);if(this.sign!==t.sign)return this.subtract(t.negate());var n=this.value,e=t.value;return t.isSmall?new p(i(n,Math.abs(e)),this.sign):new p(b(n,e),this.sign)},f.prototype.plus=f.prototype.add=function(e){var t=z(e),n=this.value;if(n<0!==t.sign)return this.subtract(t.negate());e=t.value;if(t.isSmall){if(h(n+e))return new f(n+e);e=m(Math.abs(e))}return new p(i(e,Math.abs(n)),n<0)},p.prototype.minus=p.prototype.subtract=function(e){var t=z(e);if(this.sign!==t.sign)return this.add(t.negate());var n,r=this.value,e=t.value;return t.isSmall?s(r,Math.abs(e),this.sign):(t=r,r=e,e=this.sign,0<=C(t,r)?n=S(t,r):(n=S(r,t),e=!e),"number"==typeof(n=w(n))?new f(n=e?-n:n):new p(n,e))},f.prototype.minus=f.prototype.subtract=function(e){var t=z(e),n=this.value;if(n<0!==t.sign)return this.add(t.negate());e=t.value;return t.isSmall?new f(n-e):s(e,Math.abs(n),0<=n)},p.prototype.negate=function(){return new p(this.value,!this.sign)},f.prototype.negate=function(){var e=this.sign,t=new f(-this.value);return t.sign=!e,t},p.prototype.abs=function(){return new p(this.value,!1)},f.prototype.abs=function(){return new f(Math.abs(this.value))},p.prototype.times=p.prototype.multiply=function(e){var t,n=z(e),r=this.value,i=n.value,e=this.sign!==n.sign;if(n.isSmall){if(0===i)return u[0];if(1===i)return this;if(-1===i)return this.negate();if((t=Math.abs(i))<v)return new p(N(r,t),e);i=m(t)}return n=r.length,t=i.length,new p((0<-.012*n-.012*t+15e-6*n*t?function e(t,n){if((r=Math.max(t.length,n.length))<=30)return M(t,n);var r=Math.ceil(r/2),i=t.slice(r),s=t.slice(0,r),o=n.slice(r),a=n.slice(0,r),t=e(s,a),n=e(i,o),o=e(b(s,i),b(a,o)),r=b(b(t,E(S(S(o,t),n),r)),E(n,2*r));return g(r),r}:M)(r,i),e)},f.prototype._multiplyBySmall=function(e){return h(e.value*this.value)?new f(e.value*this.value):a(Math.abs(e.value),m(Math.abs(this.value)),this.sign!==e.sign)},p.prototype._multiplyBySmall=function(e){return 0===e.value?u[0]:1===e.value?this:-1===e.value?this.negate():a(Math.abs(e.value),this.value,this.sign!==e.sign)},f.prototype.times=f.prototype.multiply=function(e){return z(e)._multiplyBySmall(this)},p.prototype.square=function(){return new p(q(this.value),!1)},f.prototype.square=function(){var e=this.value*this.value;return h(e)?new f(e):new p(q(m(Math.abs(this.value))),!1)},f.prototype.divmod=p.prototype.divmod=function(e){e=A(this,e);return{quotient:e[0],remainder:e[1]}},f.prototype.over=f.prototype.divide=p.prototype.over=p.prototype.divide=function(e){return A(this,e)[0]},f.prototype.remainder=f.prototype.mod=p.prototype.remainder=p.prototype.mod=function(e){return A(this,e)[1]},p.prototype.pow=function(e){var t,n,r,i=z(e),e=this.value,s=i.value;if(0===s)return u[1];if(0===e)return u[0];if(1===e)return u[1];if(-1===e)return i.isEven()?u[1]:u[-1];if(i.sign)return u[0];if(!i.isSmall)throw new Error("The exponent "+i.toString()+" is too large.");if(this.isSmall&&h(t=Math.pow(e,s)))return new f(d(t));for(n=this,r=u[1];!0&s&&(r=r.times(n),--s),0!==s;)s/=2,n=n.square();return r},f.prototype.pow=p.prototype.pow,f.prototype.modPow=p.prototype.modPow=function(e,t){if(e=z(e),(t=z(t)).isZero())throw new Error("Cannot take modPow with modulus 0");for(var n=u[1],r=this.mod(t);e.isPositive();){if(r.isZero())return u[0];e.isOdd()&&(n=n.multiply(r).mod(t)),e=e.divide(2),r=r.square().mod(t)}return n},p.prototype.compareAbs=function(e){var t=z(e),n=this.value,e=t.value;return t.isSmall?1:C(n,e)},f.prototype.compareAbs=function(e){var t=z(e),n=Math.abs(this.value),e=t.value;return t.isSmall?n===(e=Math.abs(e))?0:e<n?1:-1:-1},p.prototype.compareTo=p.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var t=z(e),n=this.value,e=t.value;return this.sign!==t.sign?t.sign?1:-1:t.isSmall?this.sign?-1:1:C(n,e)*(this.sign?-1:1)},f.prototype.compareTo=f.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var t=z(e),n=this.value,e=t.value;return t.isSmall?n==e?0:e<n?1:-1:n<0!==t.sign?n<0?-1:1:n<0?1:-1},f.prototype.eq=f.prototype.equals=p.prototype.eq=p.prototype.equals=function(e){return 0===this.compare(e)},f.prototype.neq=f.prototype.notEquals=p.prototype.neq=p.prototype.notEquals=function(e){return 0!==this.compare(e)},f.prototype.gt=f.prototype.greater=p.prototype.gt=p.prototype.greater=function(e){return 0<this.compare(e)},f.prototype.lt=f.prototype.lesser=p.prototype.lt=p.prototype.lesser=function(e){return this.compare(e)<0},f.prototype.geq=f.prototype.greaterOrEquals=p.prototype.geq=p.prototype.greaterOrEquals=function(e){return 0<=this.compare(e)},f.prototype.leq=f.prototype.lesserOrEquals=p.prototype.leq=p.prototype.lesserOrEquals=function(e){return this.compare(e)<=0},p.prototype.isEven=function(){return 0==(1&this.value[0])},f.prototype.isEven=function(){return 0==(1&this.value)},p.prototype.isOdd=function(){return 1==(1&this.value[0])},f.prototype.isOdd=function(){return 1==(1&this.value)},p.prototype.isPositive=function(){return!this.sign},f.prototype.isPositive=function(){return 0<this.value},p.prototype.isNegative=function(){return this.sign},f.prototype.isNegative=function(){return this.value<0},p.prototype.isUnit=function(){return!1},f.prototype.isUnit=function(){return 1===Math.abs(this.value)},p.prototype.isZero=function(){return!1},f.prototype.isZero=function(){return 0===this.value},f.prototype.isDivisibleBy=p.prototype.isDivisibleBy=function(e){var t=z(e),e=t.value;return 0!==e&&(1===e||(2===e?this.isEven():this.mod(t).equals(u[0])))},f.prototype.isPrime=p.prototype.isPrime=function(e){var t=L(this);if(t!==o)return t;var n=this.abs(),t=n.bitLength();if(t<=64)return I(n,[2,325,9375,28178,450775,9780504,1795265022]);for(var t=Math.log(2)*t,r=Math.ceil(!0===e?2*Math.pow(t,2):t),i=[],s=0;s<r;s++)i.push(Q(s+2));return I(n,i)},f.prototype.isProbablePrime=p.prototype.isProbablePrime=function(e){var t=L(this);if(t!==o)return t;for(var n=this.abs(),r=e===o?5:e,i=[],s=0;s<r;s++)i.push(Q.randBetween(2,n.minus(2)));return I(n,i)},f.prototype.modInv=p.prototype.modInv=function(e){for(var t,n,r=Q.zero,i=Q.one,s=z(e),o=this.abs();!o.equals(Q.zero);)t=s.divide(o),n=s,s=o,i=r.subtract(t.multiply(r=i)),o=n.subtract(t.multiply(o));if(!s.equals(1))throw new Error(this.toString()+" and "+e.toString()+" are not co-prime");return-1===r.compare(0)&&(r=r.add(e)),this.isNegative()?r.negate():r},p.prototype.next=function(){var e=this.value;return this.sign?s(e,1,this.sign):new p(i(e,1),this.sign)},f.prototype.next=function(){var e=this.value;return e+1<t?new f(e+1):new p(n,!1)},p.prototype.prev=function(){var e=this.value;return this.sign?new p(i(e,1),!0):s(e,1,this.sign)},f.prototype.prev=function(){var e=this.value;return-t<e-1?new f(e-1):new p(n,!0)};for(var U=[1];2*U[U.length-1]<=v;)U.push(2*U[U.length-1]);var _=U.length,O=U[_-1];function R(e){return("number"==typeof e||"string"==typeof e)&&+Math.abs(e)<=v||e instanceof p&&e.value.length<=1}function T(e,t,n){t=z(t);for(var r=e.isNegative(),i=t.isNegative(),s=r?e.not():e,o=i?t.not():t,a=0,u=0,l=null,c=null,p=[];!s.isZero()||!o.isZero();)a=(l=A(s,O))[1].toJSNumber(),r&&(a=O-1-a),u=(c=A(o,O))[1].toJSNumber(),s=l[0],o=c[0],p.push(n(a,u=i?O-1-u:u));for(var f=0!==n(r?1:0,i?1:0)?Q(-1):Q(0),h=p.length-1;0<=h;--h)f=f.multiply(O).add(Q(p[h]));return f}f.prototype.shiftLeft=p.prototype.shiftLeft=function(e){if(!R(e))throw new Error(String(e)+" is too large for shifting.");if((e=+e)<0)return this.shiftRight(-e);var t=this;if(t.isZero())return t;for(;_<=e;)t=t.multiply(O),e-=_-1;return t.multiply(U[e])},f.prototype.shiftRight=p.prototype.shiftRight=function(e){var t;if(!R(e))throw new Error(String(e)+" is too large for shifting.");if((e=+e)<0)return this.shiftLeft(-e);for(var n=this;_<=e;){if(n.isZero()||n.isNegative()&&n.isUnit())return n;n=(t=A(n,O))[1].isNegative()?t[0].prev():t[0],e-=_-1}return(t=A(n,U[e]))[1].isNegative()?t[0].prev():t[0]},f.prototype.not=p.prototype.not=function(){return this.negate().prev()},f.prototype.and=p.prototype.and=function(e){return T(this,e,function(e,t){return e&t})},f.prototype.or=p.prototype.or=function(e){return T(this,e,function(e,t){return e|t})},f.prototype.xor=p.prototype.xor=function(e){return T(this,e,function(e,t){return e^t})};var P=1<<30,k=(v&-v)*(v&-v)|P;function D(e){e=e.value,e="number"==typeof e?e|P:e[0]+e[1]*v|k;return e&-e}function F(e,t){return e=z(e),t=z(t),e.greater(t)?e:t}function B(e,t){return e=z(e),t=z(t),e.lesser(t)?e:t}function G(e,t){if(e=z(e).abs(),t=z(t).abs(),e.equals(t))return e;if(e.isZero())return t;if(t.isZero())return e;for(var n,r,i=u[1];e.isEven()&&t.isEven();)n=Math.min(D(e),D(t)),e=e.divide(n),t=t.divide(n),i=i.multiply(n);for(;e.isEven();)e=e.divide(D(e));do{for(;t.isEven();)t=t.divide(D(t))}while(e.greater(t)&&(r=t,t=e,e=r),!(t=t.subtract(e)).isZero());return i.isUnit()?e:e.multiply(i)}f.prototype.bitLength=p.prototype.bitLength=function(){var e=this;return 0===(e=e.compareTo(Q(0))<0?e.negate().subtract(Q(1)):e).compareTo(Q(0))?Q(0):Q(function e(t,n){if(n.compareTo(t)<=0){var r=e(t,n.square(n)),i=r.p,r=r.e,n=i.multiply(n);return n.compareTo(t)<=0?{p:n,e:2*r+1}:{p:i,e:2*r}}return{p:Q(1),e:0}}(e,Q(2)).e).add(Q(1))};var V=function(e,t){for(var n=e.length,r=Math.abs(t),i=0;i<n;i++){var s=e[i].toLowerCase();if("-"!==s&&/[a-z0-9]/.test(s))if(/[0-9]/.test(s)&&r<=+s){if("1"!==s||1!==r)throw new Error(s+" is not a valid digit in base "+t+".")}else if(s.charCodeAt(0)-87>=r)throw new Error(s+" is not a valid digit in base "+t+".")}if(2<=t&&t<=36&&n<=c/Math.log(t)){var o=parseInt(e,t);if(isNaN(o))throw new Error(s+" is not a valid digit in base "+t+".");return new f(parseInt(e,t))}t=z(t);var a=[],o="-"===e[0];for(i=o?1:0;i<e.length;i++){var u=(s=e[i].toLowerCase()).charCodeAt(0);if(48<=u&&u<=57)a.push(z(s));else if(97<=u&&u<=122)a.push(z(s.charCodeAt(0)-87));else{if("<"!==s)throw new Error(s+" is not a valid character");for(u=i;">"!==e[++i];);a.push(z(e.slice(u+1,i)))}}return H(a,t,o)};function H(e,t,n){for(var r=u[0],i=u[1],s=e.length-1;0<=s;s--)r=r.add(e[s].times(i)),i=i.times(t);return n?r.negate():r}function j(e){return e<=35?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e):"<"+e+">"}function X(e,t){if((t=Q(t)).isZero()){if(e.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(t.equals(-1)){if(e.isZero())return{value:[0],isNegative:!1};if(e.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-e)).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var n=Array.apply(null,Array(+e-1)).map(Array.prototype.valueOf,[0,1]);return n.unshift([1]),{value:[].concat.apply([],n),isNegative:!1}}n=!1;if(e.isNegative()&&t.isPositive()&&(n=!0,e=e.abs()),t.equals(1))return e.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(+e)).map(Number.prototype.valueOf,1),isNegative:n};for(var r=[],i=e;i.isNegative()||0<=i.compareAbs(t);){var i=(s=i.divmod(t)).quotient,s=s.remainder;s.isNegative()&&(s=t.minus(s).abs(),i=i.next()),r.push(s.toJSNumber())}return r.push(i.toJSNumber()),{value:r.reverse(),isNegative:n}}function $(e,t){t=X(e,t);return(t.isNegative?"-":"")+t.value.map(j).join("")}function Z(e){if(h(+e)){var t=+e;if(t===d(t))return new f(t);throw new Error("Invalid integer: "+e)}var n="-"===e[0],r=(e=n?e.slice(1):e).split(/e/i);if(2<r.length)throw new Error("Invalid integer: "+r.join("e"));if(2===r.length){var i=r[1];if((i=+(i="+"===i[0]?i.slice(1):i))!==d(i)||!h(i))throw new Error("Invalid integer: "+i+" is not a valid exponent.");t=r[0],r=t.indexOf(".");if(0<=r&&(i-=t.length-r-1,t=t.slice(0,r)+t.slice(r+1)),i<0)throw new Error("Cannot include negative exponent part for integers");e=t+=new Array(i+1).join("0")}if(!/^([0-9][0-9]*)$/.test(e))throw new Error("Invalid integer: "+e);for(var s=[],o=e.length,a=l,u=o-a;0<o;)s.push(+e.slice(u,o)),(u-=a)<0&&(u=0),o-=a;return g(s),new p(s,n)}function z(e){return"number"==typeof e?function(e){if(h(e)){if(e!==d(e))throw new Error(e+" is not an integer.");return new f(e)}return Z(e.toString())}(e):"string"==typeof e?Z(e):e}p.prototype.toArray=function(e){return X(this,e)},f.prototype.toArray=function(e){return X(this,e)},p.prototype.toString=function(e){if(10!==(e=e===o?10:e))return $(this,e);for(var t,n=this.value,r=n.length,i=String(n[--r]);0<=--r;)t=String(n[r]),i+="0000000".slice(t.length)+t;return(this.sign?"-":"")+i},f.prototype.toString=function(e){return 10!=(e=e===o?10:e)?$(this,e):String(this.value)},p.prototype.toJSON=f.prototype.toJSON=function(){return this.toString()},p.prototype.toJSNumber=p.prototype.valueOf=function(){return parseInt(this.toString(),10)},f.prototype.toJSNumber=f.prototype.valueOf=function(){return this.value};for(var e=0;e<1e3;e++)u[e]=new f(e),0<e&&(u[-e]=new f(-e));return u.one=u[1],u.zero=u[0],u.minusOne=u[-1],u.max=F,u.min=B,u.gcd=G,u.lcm=function(e,t){return e=z(e).abs(),t=z(t).abs(),e.divide(G(e,t)).multiply(t)},u.isInstance=function(e){return e instanceof p||e instanceof f},u.randBetween=function(e,t){var n=B(e=z(e),t=z(t)),r=F(e,t).subtract(n).add(1);if(r.isSmall)return n.add(Math.floor(Math.random()*r));for(var i=[],s=!0,o=r.value.length-1;0<=o;o--){var a=s?r.value[o]:v,u=d(Math.random()*a);i.unshift(u),u<a&&(s=!1)}return i=w(i),n.add("number"==typeof i?new f(i):new p(i,!1))},u.fromArray=function(e,t,n){return H(e.map(z),z(t||10),n)},u}();return"undefined"!=typeof module&&module.hasOwnProperty("exports")&&(module.exports=Q),"function"==typeof define&&define.amd&&define("big-integer",[],function(){return Q}),Q}(),bigDec:function(e){"use strict";var c,L,t,s,o=9e15,m=1e9,g="0123456789abcdef",r="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",i="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",a={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-o,maxE:o,crypto:!1},y=!0,u="[DecimalError] ",d=u+"Invalid argument: ",l=u+"Precision limit exceeded",p=u+"crypto unavailable",I=Math.floor,v=Math.pow,f=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,h=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,w=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,b=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,U=1e7,_=7,S=r.length-1,M=i.length-1,N={name:"[object Decimal]"};function E(e){var t,n,r,i=e.length-1,s="",o=e[0];if(0<i){for(s+=o,t=1;t<i;t++)r=e[t]+"",(n=_-r.length)&&(s+=V(n)),s+=r;o=e[t],(n=_-(r=o+"").length)&&(s+=V(n))}else if(0===o)return"0";for(;o%10==0;)o/=10;return s+o}function q(e,t,n){if(e!==~~e||e<t||n<e)throw Error(d+e)}function x(e,t,n,r){for(var i,s,o=e[0];10<=o;o/=10)--t;return--t<0?(t+=_,i=0):(i=Math.ceil((t+1)/_),t%=_),o=v(10,_-t),s=e[i]%o|0,null==r?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),n<4&&99999==s||3<n&&49999==s||5e4==s||0==s):(n<4&&s+1==o||3<n&&s+1==o/2)&&(e[i+1]/o/100|0)==v(10,t-2)-1||(s==o/2||0==s)&&0==(e[i+1]/o/100|0):t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),(r||n<4)&&9999==s||!r&&3<n&&4999==s):((r||n<4)&&s+1==o||!r&&3<n&&s+1==o/2)&&(e[i+1]/o/1e3|0)==v(10,t-3)-1}function A(e,t,n){for(var r,i,s=[0],o=0,a=e.length;o<a;){for(i=s.length;i--;)s[i]*=t;for(s[0]+=g.indexOf(e.charAt(o++)),r=0;r<s.length;r++)s[r]>n-1&&(void 0===s[r+1]&&(s[r+1]=0),s[r+1]+=s[r]/n|0,s[r]%=n)}return s.reverse()}N.absoluteValue=N.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),P(e)},N.ceil=function(){return P(new this.constructor(this),this.e+1,2)},N.comparedTo=N.cmp=function(e){var t,n,r=this,i=r.d,s=(e=new r.constructor(e)).d,o=r.s,a=e.s;if(!i||!s)return o&&a?o!==a?o:i===s?0:!i^o<0?1:-1:NaN;if(!i[0]||!s[0])return i[0]?o:s[0]?-a:0;if(o!==a)return o;if(r.e!==e.e)return r.e>e.e^o<0?1:-1;for(t=0,n=(r=i.length)<(e=s.length)?r:e;t<n;++t)if(i[t]!==s[t])return i[t]>s[t]^o<0?1:-1;return r===e?0:e<r^o<0?1:-1},N.cosine=N.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+_,r.rounding=1,n=function(e,t){var n,r=t.d.length,r=r<32?(1/Y(4,n=Math.ceil(r/3))).toString():(n=16,"2.3283064365386962890625e-10");e.precision+=n,t=Q(e,1,t.times(r),new e(1));for(var i=n;i--;){var s=t.times(t);t=s.times(s).minus(s).times(8).plus(1)}return e.precision-=n,t}(r,W(r,n)),r.precision=e,r.rounding=t,P(2==s||3==s?n.neg():n,e,t,!0)):new r(1):new r(NaN)},N.cubeRoot=N.cbrt=function(){var e,t,n,r,i,s,o,a,u,l,c=this,p=c.constructor;if(!c.isFinite()||c.isZero())return new p(c);for(y=!1,(s=c.s*v(c.s*c,1/3))&&Math.abs(s)!=1/0?r=new p(s.toString()):(n=E(c.d),(s=((e=c.e)-n.length+1)%3)&&(n+=1==s||-2==s?"0":"00"),s=v(n,1/3),e=I((e+1)/3)-(e%3==(e<0?-1:2)),(r=new p(n=s==1/0?"5e"+e:(n=s.toExponential()).slice(0,n.indexOf("e")+1)+e)).s=c.s),o=(e=p.precision)+3;;)if(l=(u=(a=r).times(a).times(a)).plus(c),r=C(l.plus(c).times(a),l.plus(u),o+2,1),E(a.d).slice(0,o)===(n=E(r.d)).slice(0,o)){if("9999"!=(n=n.slice(o-3,o+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(P(r,e+1,1),t=!r.times(r).times(r).eq(c));break}if(!i&&(P(a,e+1,0),a.times(a).times(a).eq(c))){r=a;break}o+=4,i=1}return y=!0,P(r,e,p.rounding,t)},N.decimalPlaces=N.dp=function(){var e,t=this.d,n=NaN;if(t){if(n=((e=t.length-1)-I(this.e/_))*_,e=t[e])for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},N.dividedBy=N.div=function(e){return C(this,new this.constructor(e))},N.dividedToIntegerBy=N.divToInt=function(e){var t=this.constructor;return P(C(this,new t(e),0,1,1),t.precision,t.rounding)},N.equals=N.eq=function(e){return 0===this.cmp(e)},N.floor=function(){return P(new this.constructor(this),this.e+1,3)},N.greaterThan=N.gt=function(e){return 0<this.cmp(e)},N.greaterThanOrEqualTo=N.gte=function(e){e=this.cmp(e);return 1==e||0===e},N.hyperbolicCosine=N.cosh=function(){var e,t,n,r=(a=this).constructor,i=new r(1);if(!a.isFinite())return new r(a.s?1/0:NaN);if(a.isZero())return i;t=r.precision,n=r.rounding,r.precision=t+Math.max(a.e,a.sd())+4,r.rounding=1;for(var s,o=(o=a.d.length)<32?(1/Y(4,e=Math.ceil(o/3))).toString():(e=16,"2.3283064365386962890625e-10"),a=Q(r,1,a.times(o),new r(1),!0),u=e,l=new r(8);u--;)s=a.times(a),a=i.minus(s.times(l.minus(s.times(l))));return P(a,r.precision=t,r.rounding=n,!0)},N.hyperbolicSine=N.sinh=function(){var e,t,n,r=(o=this).constructor;if(!o.isFinite()||o.isZero())return new r(o);if(e=r.precision,t=r.rounding,r.precision=e+Math.max(o.e,o.sd())+4,r.rounding=1,(n=o.d.length)<3)o=Q(r,2,o,o,!0);else for(var i,s=16<(s=1.4*Math.sqrt(n))?16:0|s,o=Q(r,2,o=o.times(1/Y(5,s)),o,!0),a=new r(5),u=new r(16),l=new r(20);s--;)i=o.times(o),o=o.times(a.plus(i.times(u.times(i).plus(l))));return P(o,r.precision=e,r.rounding=t,!0)},N.hyperbolicTangent=N.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,C(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},N.inverseCosine=N.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,i=t.rounding;return-1!==n?0===n?e.isNeg()?B(t,r,i):new t(0):new t(NaN):e.isZero()?B(t,r+4,i).times(.5):(t.precision=r+6,t.rounding=1,e=e.asin(),n=B(t,r+4,i).times(.5),t.precision=r,t.rounding=i,n.minus(e))},N.inverseHyperbolicCosine=N.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,y=!1,n=n.times(n).minus(1).sqrt().plus(n),y=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},N.inverseHyperbolicSine=N.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,y=!1,n=n.times(n).plus(1).sqrt().plus(n),y=!0,r.precision=e,r.rounding=t,n.ln())},N.inverseHyperbolicTangent=N.atanh=function(){var e,t,n,r=this,i=r.constructor;return r.isFinite()?0<=r.e?new i(r.abs().eq(1)?r.s/0:r.isZero()?r:NaN):(e=i.precision,t=i.rounding,n=r.sd(),Math.max(n,e)<2*-r.e-1?P(new i(r),e,t,!0):(i.precision=n=n-r.e,r=C(r.plus(1),new i(1).minus(r),n+e,1),i.precision=e+4,i.rounding=1,r=r.ln(),i.precision=e,i.rounding=t,r.times(.5))):new i(NaN)},N.inverseSine=N.asin=function(){var e,t,n,r=this,i=r.constructor;return r.isZero()?new i(r):(e=r.abs().cmp(1),t=i.precision,n=i.rounding,-1!==e?0===e?((e=B(i,t+4,n).times(.5)).s=r.s,e):new i(NaN):(i.precision=t+6,i.rounding=1,r=r.div(new i(1).minus(r.times(r)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=n,r.times(2)))},N.inverseTangent=N.atan=function(){var e,t,n,r,i,s,o,a,u,l=this,c=l.constructor,p=c.precision,f=c.rounding;if(l.isFinite()){if(l.isZero())return new c(l);if(l.abs().eq(1)&&p+4<=M)return(o=B(c,p+4,f).times(.25)).s=l.s,o}else{if(!l.s)return new c(NaN);if(p+4<=M)return(o=B(c,p+4,f).times(.5)).s=l.s,o}for(c.precision=a=p+10,c.rounding=1,e=n=Math.min(28,a/_+2|0);e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(y=!1,t=Math.ceil(a/_),r=1,u=l.times(l),o=new c(l),i=l;-1!==e;)if(i=i.times(u),s=o.minus(i.div(r+=2)),i=i.times(u),void 0!==(o=s.plus(i.div(r+=2))).d[t])for(e=t;o.d[e]===s.d[e]&&e--;);return n&&(o=o.times(2<<n-1)),y=!0,P(o,c.precision=p,c.rounding=f,!0)},N.isFinite=function(){return!!this.d},N.isInteger=N.isInt=function(){return!!this.d&&I(this.e/_)>this.d.length-2},N.isNaN=function(){return!this.s},N.isNegative=N.isNeg=function(){return this.s<0},N.isPositive=N.isPos=function(){return 0<this.s},N.isZero=function(){return!!this.d&&0===this.d[0]},N.lessThan=N.lt=function(e){return this.cmp(e)<0},N.lessThanOrEqualTo=N.lte=function(e){return this.cmp(e)<1},N.logarithm=N.log=function(e){var t,n,r,i,s,o,a,u,l=this.constructor,c=l.precision,p=l.rounding;if(null==e)e=new l(10),t=!0;else{if(n=(e=new l(e)).d,e.s<0||!n||!n[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(n=this.d,this.s<0||!n||!n[0]||this.eq(1))return new l(n&&!n[0]?-1/0:1!=this.s?NaN:n?0:1/0);if(t)if(1<n.length)s=!0;else{for(i=n[0];i%10==0;)i/=10;s=1!==i}if(y=!1,o=$(this,a=c+5),r=t?F(l,a+10):$(e,a),x((u=C(o,r,a,1)).d,i=c,p))do{if(o=$(this,a+=10),r=t?F(l,a+10):$(e,a),u=C(o,r,a,1),!s){+E(u.d).slice(i+1,i+15)+1==1e14&&(u=P(u,c+1,0));break}}while(x(u.d,i+=10,p));return y=!0,P(u,c,p)},N.minus=N.sub=function(e){var t,n,r,i,s,o,a,u,l,c,p,f=this,h=f.constructor;if(e=new h(e),!f.d||!e.d)return f.s&&e.s?f.d?e.s=-e.s:e=new h(e.d||f.s!==e.s?f:NaN):e=new h(NaN),e;if(f.s!=e.s)return e.s=-e.s,f.plus(e);if(l=f.d,p=e.d,a=h.precision,u=h.rounding,!l[0]||!p[0]){if(p[0])e.s=-e.s;else{if(!l[0])return new h(3===u?-0:0);e=new h(f)}return y?P(e,a,u):e}if(n=I(e.e/_),f=I(f.e/_),l=l.slice(),s=f-n){for(o=(c=s<0)?(t=l,s=-s,p.length):(t=p,n=f,l.length),s>(r=Math.max(Math.ceil(a/_),o)+2)&&(s=r,t.length=1),t.reverse(),r=s;r--;)t.push(0);t.reverse()}else{for((c=(r=l.length)<(o=p.length))&&(o=r),r=0;r<o;r++)if(l[r]!=p[r]){c=l[r]<p[r];break}s=0}for(c&&(t=l,l=p,p=t,e.s=-e.s),o=l.length,r=p.length-o;0<r;--r)l[o++]=0;for(r=p.length;s<r;){if(l[--r]<p[r]){for(i=r;i&&0===l[--i];)l[i]=U-1;--l[i],l[r]+=U}l[r]-=p[r]}for(;0===l[--o];)l.pop();for(;0===l[0];l.shift())--n;return l[0]?(e.d=l,e.e=D(l,n),y?P(e,a,u):e):new h(3===u?-0:0)},N.modulo=N.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?P(new r(n),r.precision,r.rounding):(y=!1,9==r.modulo?(t=C(n,e.abs(),0,3,1)).s*=e.s:t=C(n,e,0,r.modulo,1),t=t.times(e),y=!0,n.minus(t))},N.naturalExponential=N.exp=function(){return X(this)},N.naturalLogarithm=N.ln=function(){return $(this)},N.negated=N.neg=function(){var e=new this.constructor(this);return e.s=-e.s,P(e)},N.plus=N.add=function(e){var t,n,r,i,s,o,a,u,l=this,c=l.constructor;if(e=new c(e),!l.d||!e.d)return l.s&&e.s?l.d||(e=new c(e.d||l.s===e.s?l:NaN)):e=new c(NaN),e;if(l.s!=e.s)return e.s=-e.s,l.minus(e);if(a=l.d,u=e.d,s=c.precision,o=c.rounding,!a[0]||!u[0])return u[0]||(e=new c(l)),y?P(e,s,o):e;if(c=I(l.e/_),l=I(e.e/_),a=a.slice(),r=c-l){for(i=r<0?(n=a,r=-r,u.length):(n=u,l=c,a.length),r>(i=(c=Math.ceil(s/_))>i?c+1:i+1)&&(r=i,n.length=1),n.reverse();r--;)n.push(0);n.reverse()}for((i=a.length)-(r=u.length)<0&&(r=i,n=u,u=a,a=n),t=0;r;)t=(a[--r]=a[r]+u[r]+t)/U|0,a[r]%=U;for(t&&(a.unshift(t),++l),i=a.length;0==a[--i];)a.pop();return e.d=a,e.e=D(a,l),y?P(e,s,o):e},N.precision=N.sd=function(e){var t;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(d+e);return this.d?(t=G(this.d),e&&this.e+1>t&&(t=this.e+1)):t=NaN,t},N.round=function(){var e=this.constructor;return P(new e(this),this.e+1,e.rounding)},N.sine=N.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+_,r.rounding=1,n=function(e,t){var n,r=t.d.length;if(r<3)return Q(e,2,t,t);n=16<(n=1.4*Math.sqrt(r))?16:0|n,t=Q(e,2,t=t.times(1/Y(5,n)),t);for(var i,s=new e(5),o=new e(16),a=new e(20);n--;)i=t.times(t),t=t.times(s.plus(i.times(o.times(i).minus(a))));return t}(r,W(r,n)),r.precision=e,r.rounding=t,P(2<s?n.neg():n,e,t,!0)):new r(NaN)},N.squareRoot=N.sqrt=function(){var e,t,n,r,i,s,o=this,a=o.d,u=o.e,l=o.s,c=o.constructor;if(1!==l||!a||!a[0])return new c(!l||l<0&&(!a||a[0])?NaN:a?o:1/0);for(y=!1,r=0==(l=Math.sqrt(+o))||l==1/0?(((t=E(a)).length+u)%2==0&&(t+="0"),l=Math.sqrt(t),u=I((u+1)/2)-(u<0||u%2),new c(t=l==1/0?"5e"+u:(t=l.toExponential()).slice(0,t.indexOf("e")+1)+u)):new c(l.toString()),n=(u=c.precision)+3;;)if(r=(s=r).plus(C(o,s,n+2,1)).times(.5),E(s.d).slice(0,n)===(t=E(r.d)).slice(0,n)){if("9999"!=(t=t.slice(n-3,n+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(P(r,u+1,1),e=!r.times(r).eq(o));break}if(!i&&(P(s,u+1,0),s.times(s).eq(o))){r=s;break}n+=4,i=1}return y=!0,P(r,u,c.rounding,e)},N.tangent=N.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,(n=n.sin()).s=1,n=C(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,P(2==s||4==s?n.neg():n,e,t,!0)):new r(NaN)},N.times=N.mul=function(e){var t,n,r,i,s,o,a,u,l,c=this.constructor,p=this.d,f=(e=new c(e)).d;if(e.s*=this.s,!(p&&p[0]&&f&&f[0]))return new c(!e.s||p&&!p[0]&&!f||f&&!f[0]&&!p?NaN:p&&f?0*e.s:e.s/0);for(n=I(this.e/_)+I(e.e/_),(u=p.length)<(l=f.length)&&(s=p,p=f,f=s,o=u,u=l,l=o),s=[],r=o=u+l;r--;)s.push(0);for(r=l;0<=--r;){for(t=0,i=u+r;r<i;)a=s[i]+f[r]*p[i-r-1]+t,s[i--]=a%U|0,t=a/U|0;s[i]=(s[i]+t)%U|0}for(;!s[--o];)s.pop();return t?++n:s.shift(),e.d=s,e.e=D(s,n),y?P(e,c.precision,c.rounding):e},N.toBinary=function(e,t){return J(this,2,e,t)},N.toDecimalPlaces=N.toDP=function(e,t){var n=this.constructor,r=new n(this);return void 0===e?r:(q(e,0,m),void 0===t?t=n.rounding:q(t,0,8),P(r,e+r.e+1,t))},N.toExponential=function(e,t){var n=this,r=n.constructor,e=void 0===e?k(n,!0):(q(e,0,m),void 0===t?t=r.rounding:q(t,0,8),k(n=P(new r(n),e+1,t),!0,e+1));return n.isNeg()&&!n.isZero()?"-"+e:e},N.toFixed=function(e,t){var n=this,r=n.constructor,i=void 0===e?k(n):(q(e,0,m),void 0===t?t=r.rounding:q(t,0,8),k(i=P(new r(n),e+n.e+1,t),!1,e+i.e+1));return n.isNeg()&&!n.isZero()?"-"+i:i},N.toFraction=function(e){var t,n,r,i,s,o,a,u,l,c,p=this,f=p.d,h=p.constructor;if(!f)return new h(p);if(u=n=new h(1),r=a=new h(0),l=(s=(t=new h(r)).e=G(f)-p.e-1)%_,t.d[0]=v(10,l<0?_+l:l),null==e)e=0<s?t:u;else{if(!(o=new h(e)).isInt()||o.lt(u))throw Error(d+o);e=o.gt(t)?0<s?t:u:o}for(y=!1,o=new h(E(f)),l=h.precision,h.precision=s=f.length*_*2;c=C(o,t,0,1,1),1!=(i=n.plus(c.times(r))).cmp(e);)n=r,r=i,u=a.plus(c.times(i=u)),a=i,t=o.minus(c.times(i=t)),o=i;return i=C(e.minus(n),r,0,1,1),a=a.plus(i.times(u)),n=n.plus(i.times(r)),a.s=u.s=p.s,p=C(u,r,s,1).minus(p).abs().cmp(C(a,n,s,1).minus(p).abs())<1?[u,r]:[a,n],h.precision=l,y=!0,p},N.toHexadecimal=N.toHex=function(e,t){return J(this,16,e,t)},N.toNearest=function(e,t){var n=(r=this).constructor,r=new n(r);if(null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:q(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(y=!1,r=C(r,e,0,t,1).times(e),y=!0,P(r)):(e.s=r.s,r=e),r},N.toNumber=function(){return+this},N.toOctal=function(e,t){return J(this,8,e,t)},N.toPower=N.pow=function(e){var t,n,r,i,s,o,a=this,u=a.constructor,l=+(e=new u(e));if(!(a.d&&e.d&&a.d[0]&&e.d[0]))return new u(v(+a,l));if((a=new u(a)).eq(1))return a;if(r=u.precision,s=u.rounding,e.eq(1))return P(a,r,s);if((t=I(e.e/_))>=e.d.length-1&&(n=l<0?-l:l)<=9007199254740991)return i=H(u,a,n,r),e.s<0?new u(1).div(i):P(i,r,s);if((o=a.s)<0){if(t<e.d.length-1)return new u(NaN);if(0==(1&e.d[t])&&(o=1),0==a.e&&1==a.d[0]&&1==a.d.length)return a.s=o,a}return(t=0!=(n=v(+a,l))&&isFinite(n)?new u(n+"").e:I(l*(Math.log("0."+E(a.d))/Math.LN10+a.e+1)))>u.maxE+1||t<u.minE-1?new u(0<t?o/0:0):(y=!1,u.rounding=a.s=1,n=Math.min(12,(t+"").length),(i=X(e.times($(a,r+n)),r)).d&&x((i=P(i,r+5,1)).d,r,s)&&(+E((i=P(X(e.times($(a,(t=r+10)+n)),t),t+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=P(i,r+1,0))),i.s=o,y=!0,P(i,r,u.rounding=s))},N.toPrecision=function(e,t){var n=this,r=n.constructor,e=void 0===e?k(n,n.e<=r.toExpNeg||n.e>=r.toExpPos):(q(e,1,m),void 0===t?t=r.rounding:q(t,0,8),k(n=P(new r(n),e,t),e<=n.e||n.e<=r.toExpNeg,e));return n.isNeg()&&!n.isZero()?"-"+e:e},N.toSignificantDigits=N.toSD=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(q(e,1,m),void 0===t?t=n.rounding:q(t,0,8)),P(new n(this),e,t)},N.toString=function(){var e=this.constructor,e=k(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()&&!this.isZero()?"-"+e:e},N.truncated=N.trunc=function(){return P(new this.constructor(this),this.e+1,1)},N.valueOf=N.toJSON=function(){var e=this.constructor,e=k(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()?"-"+e:e};var C=function(e,t,n,r,i,s){var o,a,u,l,c,p,f,h,m,g,d,v,w,y,b,S,M,N,E,q=e.constructor,x=e.s==t.s?1:-1,A=e.d,C=t.d;if(!(A&&A[0]&&C&&C[0]))return new q(e.s&&t.s&&(A?!C||A[0]!=C[0]:C)?A&&0==A[0]||!C?0*x:x/0:NaN);for(a=s?(c=1,e.e-t.e):(s=U,I(e.e/(c=_))-I(t.e/c)),N=C.length,S=A.length,m=(x=new q(x)).d=[],u=0;C[u]==(A[u]||0);u++);if(C[u]>(A[u]||0)&&a--,null==n?(w=n=q.precision,r=q.rounding):w=i?n+(e.e-t.e)+1:n,w<0)m.push(1),p=!0;else{if(w=w/c+2|0,u=0,1==N){for(C=C[l=0],w++;(u<S||l)&&w--;u++)y=l*s+(A[u]||0),m[u]=y/C|0,l=y%C|0;p=l||u<S}else{for(1<(l=s/(C[0]+1)|0)&&(C=O(C,l,s),A=O(A,l,s),N=C.length,S=A.length),d=(g=A.slice(0,b=N)).length;d<N;)g[d++]=0;for((E=C.slice()).unshift(0),M=C[0],C[1]>=s/2&&++M;l=0,(o=R(C,g,N,d))<0?(v=g[0],1<(l=(v=N!=d?v*s+(g[1]||0):v)/M|0)?1==(o=R(f=O(C,l=s<=l?s-1:l,s),g,h=f.length,d=g.length))&&(l--,T(f,N<h?E:C,h,s)):(0==l&&(o=l=1),f=C.slice()),(h=f.length)<d&&f.unshift(0),T(g,f,d,s),-1==o&&(o=R(C,g,N,d=g.length))<1&&(l++,T(g,N<d?E:C,d,s)),d=g.length):0===o&&(l++,g=[0]),m[u++]=l,o&&g[0]?g[d++]=A[b]||0:(g=[A[b]],d=1),(b++<S||void 0!==g[0])&&w--;);p=void 0!==g[0]}m[0]||m.shift()}if(1==c)x.e=a,L=p;else{for(u=1,l=m[0];10<=l;l/=10)u++;x.e=u+a*c-1,P(x,i?n+x.e+1:n,r,p)}return x};function O(e,t,n){var r,i=0,s=e.length;for(e=e.slice();s--;)r=e[s]*t+i,e[s]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function R(e,t,n,r){var i,s;if(n!=r)s=r<n?1:-1;else for(i=s=0;i<n;i++)if(e[i]!=t[i]){s=e[i]>t[i]?1:-1;break}return s}function T(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&1<e.length;)e.shift()}function P(e,t,n,r){var i,s,o,a,u,l,c,p,f=e.constructor;e:if(null!=t){if(!(c=e.d))return e;for(i=1,a=c[0];10<=a;a/=10)i++;if((s=t-i)<0)s+=_,u=(l=c[p=0])/v(10,i-(o=t)-1)%10|0;else if((p=Math.ceil((s+1)/_))>=(a=c.length)){if(!r)break e;for(;a++<=p;)c.push(0);l=u=0,o=(s%=_)-_+(i=1)}else{for(l=a=c[p],i=1;10<=a;a/=10)i++;u=(o=(s%=_)-_+i)<0?0:l/v(10,i-o-1)%10|0}if(r=r||t<0||void 0!==c[p+1]||(o<0?l:l%v(10,i-o-1)),u=n<4?(u||r)&&(0==n||n==(e.s<0?3:2)):5<u||5==u&&(4==n||r||6==n&&(0<s?0<o?l/v(10,i-o):0:c[p-1])%10&1||n==(e.s<0?8:7)),t<1||!c[0])return c.length=0,u?(t-=e.e+1,c[0]=v(10,(_-t%_)%_),e.e=-t||0):c[0]=e.e=0,e;if(0==s?(c.length=p,a=1,p--):(c.length=p+1,a=v(10,_-s),c[p]=0<o?(l/v(10,i-o)%v(10,o)|0)*a:0),u)for(;;){if(0==p){for(s=1,o=c[0];10<=o;o/=10)s++;for(o=c[0]+=a,a=1;10<=o;o/=10)a++;s!=a&&(e.e++,c[0]==U&&(c[0]=1));break}if(c[p]+=a,c[p]!=U)break;c[p--]=0,a=1}for(s=c.length;0===c[--s];)c.pop()}return y&&(e.e>f.maxE?(e.d=null,e.e=NaN):e.e<f.minE&&(e.e=0,e.d=[0])),e}function k(e,t,n){if(!e.isFinite())return Z(e);var r,i=e.e,s=E(e.d),o=s.length;return t?(n&&0<(r=n-o)?s=s.charAt(0)+"."+s.slice(1)+V(r):1<o&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):i<0?(s="0."+V(-i-1)+s,n&&0<(r=n-o)&&(s+=V(r))):o<=i?(s+=V(i+1-o),n&&0<(r=n-i-1)&&(s=s+"."+V(r))):((r=i+1)<o&&(s=s.slice(0,r)+"."+s.slice(r)),n&&0<(r=n-o)&&(i+1===o&&(s+="."),s+=V(r))),s}function D(e,t){var n=e[0];for(t*=_;10<=n;n/=10)t++;return t}function F(e,t,n){if(S<t)throw y=!0,n&&(e.precision=n),Error(l);return P(new e(r),t,1,!0)}function B(e,t,n){if(M<t)throw Error(l);return P(new e(i),t,n,!0)}function G(e){var t=e.length-1,n=t*_+1;if(t=e[t]){for(;t%10==0;t/=10)n--;for(t=e[0];10<=t;t/=10)n++}return n}function V(e){for(var t="";e--;)t+="0";return t}function H(e,t,n,r){var i,s=new e(1),o=Math.ceil(r/_+4);for(y=!1;;){if(n%2&&K((s=s.times(t)).d,o)&&(i=!0),0===(n=I(n/2))){n=s.d.length-1,i&&0===s.d[n]&&++s.d[n];break}K((t=t.times(t)).d,o)}return y=!0,s}function j(e){return 1&e.d[e.d.length-1]}function n(e,t,n){for(var r,i=new e(t[0]),s=0;++s<t.length;){if(!(r=new e(t[s])).s){i=r;break}i[n](r)&&(i=r)}return i}function X(e,t){var n,r,i,s,o,a,u,l=0,c=0,p=0,f=e.constructor,h=f.rounding,m=f.precision;if(!e.d||!e.d[0]||17<e.e)return new f(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(u=null==t?(y=!1,m):t,a=new f(.03125);-2<e.e;)e=e.times(a),p+=5;for(u+=r=Math.log(v(2,p))/Math.LN10*2+5|0,n=s=o=new f(1),f.precision=u;;){if(s=P(s.times(e),u,1),n=n.times(++c),E((a=o.plus(C(s,n,u,1))).d).slice(0,u)===E(o.d).slice(0,u)){for(i=p;i--;)o=P(o.times(o),u,1);if(null!=t)return f.precision=m,o;if(!(l<3&&x(o.d,u-r,h,l)))return P(o,f.precision=m,h,y=!0);f.precision=u+=10,n=s=a=new f(1),c=0,l++}o=a}}function $(e,t){var n,r,i,s,o,a,u,l,c,p,f,h=1,m=e,g=m.d,d=m.constructor,v=d.rounding,w=d.precision;if(m.s<0||!g||!g[0]||!m.e&&1==g[0]&&1==g.length)return new d(g&&!g[0]?-1/0:1!=m.s?NaN:g?0:m);if(c=null==t?(y=!1,w):t,d.precision=c+=10,r=(n=E(g)).charAt(0),!(Math.abs(s=m.e)<15e14))return l=F(d,c+2,w).times(s+""),m=$(new d(r+"."+n.slice(1)),c-10).plus(l),d.precision=w,null==t?P(m,w,v,y=!0):m;for(;r<7&&1!=r||1==r&&3<n.charAt(1);)r=(n=E((m=m.times(e)).d)).charAt(0),h++;for(s=m.e,1<r?(m=new d("0."+n),s++):m=new d(r+"."+n.slice(1)),u=o=m=C((p=m).minus(1),m.plus(1),c,1),f=P(m.times(m),c,1),i=3;;){if(o=P(o.times(f),c,1),E((l=u.plus(C(o,new d(i),c,1))).d).slice(0,c)===E(u.d).slice(0,c)){if(u=u.times(2),0!==s&&(u=u.plus(F(d,c+2,w).times(s+""))),u=C(u,new d(h),c,1),null!=t)return d.precision=w,u;if(!x(u.d,c-10,v,a))return P(u,d.precision=w,v,y=!0);d.precision=c+=10,l=o=m=C(p.minus(1),p.plus(1),c,1),f=P(m.times(m),c,1),i=a=1}u=l,i+=2}}function Z(e){return String(e.s*e.s/0)}function z(e,t){var n,r,i;for(0<(r=(t=-1<(n=t.indexOf("."))?t.replace(".",""):t).search(/e/i))?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);r++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(r,i)){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%_,n<0&&(r+=_),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=_;r<i;)e.d.push(+t.slice(r,r+=_));t=t.slice(r),r=_-t.length}else r-=i;for(;r--;)t+="0";e.d.push(+t),y&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function Q(e,t,n,r,i){var s,o,a,u,l=e.precision,c=Math.ceil(l/_);for(y=!1,u=n.times(n),a=new e(r);;){if(o=C(a.times(u),new e(t++*t++),l,1),a=i?r.plus(o):r.minus(o),r=C(o.times(u),new e(t++*t++),l,1),void 0!==(o=a.plus(r)).d[c]){for(s=c;o.d[s]===a.d[s]&&s--;);if(-1==s)break}s=a,a=r,r=o,o=s}return y=!0,o.d.length=c+1,o}function Y(e,t){for(var n=e;--t;)n*=e;return n}function W(e,t){var n=t.s<0,r=B(e,e.precision,1),i=r.times(.5);if((t=t.abs()).lte(i))return s=n?4:1,t;if((e=t.divToInt(r)).isZero())s=n?3:2;else{if((t=t.minus(e.times(r))).lte(i))return s=j(e)?n?2:3:n?4:1,t;s=j(e)?n?1:4:n?3:2}return t.minus(r).abs()}function J(e,t,n,r){var i,s,o,a,u,l,c,p,f=e.constructor,h=void 0!==n;if(h?(q(n,1,m),void 0===r?r=f.rounding:q(r,0,8)):(n=f.precision,r=f.rounding),e.isFinite()){for(h?(i=2,16==t?n=4*n-3:8==t&&(n=3*n-2)):i=t,0<=(o=(l=k(e)).indexOf("."))&&(l=l.replace(".",""),(p=new f(1)).e=l.length-o,p.d=A(k(p),10,i),p.e=p.d.length),s=a=(c=A(l,10,i)).length;0==c[--a];)c.pop();if(c[0]){if(o<0?s--:((e=new f(e)).d=c,e.e=s,c=(e=C(e,p,n,r,0,i)).d,s=e.e,u=L),o=c[n],p=i/2,u=u||void 0!==c[n+1],u=r<4?(void 0!==o||u)&&(0===r||r===(e.s<0?3:2)):p<o||o===p&&(4===r||u||6===r&&1&c[n-1]||r===(e.s<0?8:7)),c.length=n,u)for(;++c[--n]>i-1;)c[n]=0,n||(++s,c.unshift(1));for(a=c.length;!c[a-1];--a);for(o=0,l="";o<a;o++)l+=g.charAt(c[o]);if(h){if(1<a)if(16==t||8==t){for(o=16==t?4:3,--a;a%o;a++)l+="0";for(a=(c=A(l,i,t)).length;!c[a-1];--a);for(o=1,l="1.";o<a;o++)l+=g.charAt(c[o])}else l=l.charAt(0)+"."+l.slice(1);l=l+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)l="0"+l;l="0."+l}else if(++s>a)for(s-=a;s--;)l+="0";else s<a&&(l=l.slice(0,s)+"."+l.slice(s))}else l=h?"0p+0":"0";l=(16==t?"0x":2==t?"0b":8==t?"0o":"")+l}else l=Z(e);return e.s<0?"-"+l:l}function K(e,t){return e.length>t&&(e.length=t,1)}function ee(e){return new this(e).abs()}function te(e){return new this(e).acos()}function ne(e){return new this(e).acosh()}function re(e,t){return new this(e).plus(t)}function ie(e){return new this(e).asin()}function se(e){return new this(e).asinh()}function oe(e){return new this(e).atan()}function ae(e){return new this(e).atanh()}function ue(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,s=r+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(n=t.s<0?B(this,r,i):new this(0)).s=e.s:!e.d||t.isZero()?(n=B(this,s,1).times(.5)).s=e.s:n=t.s<0?(this.precision=s,this.rounding=1,n=this.atan(C(e,t,s,1)),t=B(this,s,1),this.precision=r,this.rounding=i,e.s<0?n.minus(t):n.plus(t)):this.atan(C(e,t,s,1)):(n=B(this,s,1).times(0<t.s?.25:.75)).s=e.s:n=new this(NaN),n}function le(e){return new this(e).cbrt()}function ce(e){return P(e=new this(e),e.e+1,2)}function pe(e){if(!e||"object"!=typeof e)throw Error(u+"Object expected");for(var t,n,r=!0===e.defaults,i=["precision",1,m,"rounding",0,8,"toExpNeg",-o,0,"toExpPos",0,o,"maxE",0,o,"minE",-o,0,"modulo",0,9],s=0;s<i.length;s+=3)if(t=i[s],r&&(this[t]=a[t]),void 0!==(n=e[t])){if(!(I(n)===n&&i[s+1]<=n&&n<=i[s+2]))throw Error(d+t+": "+n);this[t]=n}if(t="crypto",r&&(this[t]=a[t]),void 0!==(n=e[t])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(d+t+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(p);this[t]=!0}else this[t]=!1}return this}function fe(e){return new this(e).cos()}function he(e){return new this(e).cosh()}function me(e,t){return new this(e).div(t)}function ge(e){return new this(e).exp()}function de(e){return P(e=new this(e),e.e+1,3)}function ve(){var e,t,n=new this(0);for(y=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return y=!0,new this(1/0);n=t}return y=!0,n.sqrt()}function we(e){return e instanceof c||e&&"[object Decimal]"===e.name||!1}function ye(e){return new this(e).ln()}function be(e,t){return new this(e).log(t)}function Se(e){return new this(e).log(2)}function Me(e){return new this(e).log(10)}function Ne(){return n(this,arguments,"lt")}function Ee(){return n(this,arguments,"gt")}function qe(e,t){return new this(e).mod(t)}function xe(e,t){return new this(e).mul(t)}function Ae(e,t){return new this(e).pow(t)}function Ce(e){var t,n,r,i,s=0,o=new this(1),a=[];if(void 0===e?e=this.precision:q(e,1,m),r=Math.ceil(e/_),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));s<r;)429e7<=(i=t[s])?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:a[s++]=i%1e7;else{if(!crypto.randomBytes)throw Error(p);for(t=crypto.randomBytes(r*=4);s<r;)214e7<=(i=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((127&t[s+3])<<24))?crypto.randomBytes(4).copy(t,s):(a.push(i%1e7),s+=4);s=r/4}else for(;s<r;)a[s++]=1e7*Math.random()|0;for(r=a[--s],e%=_,r&&e&&(i=v(10,_-e),a[s]=(r/i|0)*i);0===a[s];s--)a.pop();if(s<0)a=[n=0];else{for(n=-1;0===a[0];n-=_)a.shift();for(r=1,i=a[0];10<=i;i/=10)r++;r<_&&(n-=_-r)}return o.e=n,o.d=a,o}function Le(e){return P(e=new this(e),e.e+1,this.rounding)}function Ie(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function Ue(e){return new this(e).sin()}function _e(e){return new this(e).sinh()}function Oe(e){return new this(e).sqrt()}function Re(e,t){return new this(e).sub(t)}function Te(e){return new this(e).tan()}function Pe(e){return new this(e).tanh()}function ke(e){return P(e=new this(e),e.e+1,1)}return(c=function e(t){var n,r,i;function s(e){var t,n,r,i=this;if(!(i instanceof s))return new s(e);if(e instanceof(i.constructor=s))return i.s=e.s,void(y?!e.d||e.e>s.maxE?(i.e=NaN,i.d=null):e.e<s.minE?(i.e=0,i.d=[0]):(i.e=e.e,i.d=e.d.slice()):(i.e=e.e,i.d=e.d&&e.d.slice()));if("number"==(r=typeof e)){if(0===e)return i.s=1/e<0?-1:1,i.e=0,void(i.d=[0]);if(e<0?(e=-e,i.s=-1):i.s=1,e===~~e&&e<1e7){for(t=0,n=e;10<=n;n/=10)t++;return void(y?s.maxE<t?(i.e=NaN,i.d=null):t<s.minE?(i.e=0,i.d=[0]):(i.e=t,i.d=[e]):(i.e=t,i.d=[e]))}return 0*e!=0?(e||(i.s=NaN),i.e=NaN,void(i.d=null)):z(i,e.toString())}if("string"!=r)throw Error(d+e);return 45===(n=e.charCodeAt(0))?(e=e.slice(1),i.s=-1):(43===n&&(e=e.slice(1)),i.s=1),(b.test(e)?z:function(e,t){var n,r,i,s,o,a,u,l;if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(h.test(t))l=16,t=t.toLowerCase();else if(f.test(t))l=2;else{if(!w.test(t))throw Error(d+t);l=8}for(s=0<=(i=(t=0<(i=t.search(/p/i))?(a=+t.slice(i+1),t.substring(2,i)):t.slice(2)).indexOf(".")),n=e.constructor,s&&(i=(o=(t=t.replace(".","")).length)-i,r=H(n,new n(l),i,2*i)),i=l=(u=A(t,l,U)).length-1;0===u[i];--i)u.pop();return i<0?new n(0*e.s):(e.e=D(u,l),e.d=u,y=!1,s&&(e=C(e,r,4*o)),a&&(e=e.times(Math.abs(a)<54?v(2,a):c.pow(2,a))),y=!0,e)})(i,e)}if(s.prototype=N,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=pe,s.clone=e,s.isDecimal=we,s.abs=ee,s.acos=te,s.acosh=ne,s.add=re,s.asin=ie,s.asinh=se,s.atan=oe,s.atanh=ae,s.atan2=ue,s.cbrt=le,s.ceil=ce,s.cos=fe,s.cosh=he,s.div=me,s.exp=ge,s.floor=de,s.hypot=ve,s.ln=ye,s.log=be,s.log10=Me,s.log2=Se,s.max=Ne,s.min=Ee,s.mod=qe,s.mul=xe,s.pow=Ae,s.random=Ce,s.round=Le,s.sign=Ie,s.sin=Ue,s.sinh=_e,s.sqrt=Oe,s.sub=Re,s.tan=Te,s.tanh=Pe,s.trunc=ke,(t=void 0===t?{}:t)&&!0!==t.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],n=0;n<i.length;)t.hasOwnProperty(r=i[n++])||(t[r]=this[r]);return s.config(t),s}(a)).default=c.Decimal=c,r=new c(r),i=new c(i),"function"==typeof define&&define.amd?define(function(){return c}):"undefined"!=typeof module&&module.exports?("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator&&(N[Symbol.for("nodejs.util.inspect.custom")]=N.toString,N[Symbol.toStringTag]="Decimal"),module.exports=c):(e=e||("undefined"!=typeof self&&self&&self.self==self?self:window),t=e.Decimal,c.noConflict=function(){return e.Decimal=t,c},e.Decimal=c),c}(this)});"undefined"!=typeof module&&(module.exports=nerdamer),"undefined"!=typeof module&&(nerdamer=require("./nerdamer.core.js"),require("./Calculus.js")),function(){"use strict";var Z=nerdamer.getCore(),H=Z.PARSER,u=Z.groups.N,c=Z.groups.P,j=Z.groups.S,p=Z.groups.EX,C=Z.groups.FN,y=Z.groups.PL,X=Z.groups.CP,L=Z.groups.CB,I=Z.Utils.keys,U=Z.Utils.even,$=Z.Utils.variables,l=Z.Utils.format,b=Z.Utils.round,z=Z.Frac,_=Z.Utils.isInt,Q=Z.Symbol,Y=Z.Settings.CONST_HASH,f=Z.Utils.importFunctions();Z.Utils.evaluate;function W(e,t,n){if(Z.Utils.isSymbol(e))this.parse(e),this.variable=this.variable||t;else if(isNaN(e))"string"==typeof e&&this.parse(H.parse(e));else{if(n=n||0,void 0===t)throw new Z.exceptions.InvalidVariableNameError("Polynomial expects a variable name when creating using order");this.coeffs=[],this.coeffs[n]=e,this.fill(e)}}function O(){this.factors={},this.length=0}function J(e,t,n){this.terms=t||[],this.coeff=e,this.map=n,this.sum=new Z.Frac(0),this.image=void 0}W.fromArray=function(e,t){if(void 0===t)throw new Z.exceptions.InvalidVariableNameError("A variable name must be specified when creating polynomial from array");var n=new W;return n.coeffs=e,n.variable=t,n},W.fit=function(e,t,n,r,i,s){var o=new Array(i+1),a=n-t;o[0]=t,a-=(o[i]=e)*Math.pow(r,i);for(var u=i-1;0<u;u--){var l=Math.pow(r,u),c=a/l,c=Math.sign(c)*Math.floor(Math.abs(c));a-=c*l,o[u]=c}if(0!==a)return null;for(u=0;u<o.length;u++)o[u]=new z(o[u]);return W.fromArray(o,s)},W.prototype={parse:function(e,t){if(this.variable=$(e)[0],!e.isPoly())throw Z.exceptions.NerdamerTypeError("Polynomial Expected! Received "+Z.Utils.text(e));if(t=t||[],(e=!e.power.absEquals(1)?H.expand(e):e).group===Z.groups.N)t[0]=e.multiplier;else if(e.group===Z.groups.S)t[e.power.toDecimal()]=e.multiplier;else for(var n in e.symbols){var r=e.symbols[n],n=r.power;if(Z.Utils.isSymbol(n))throw new Z.exceptions.NerdamerTypeError("power cannot be a Symbol");n=r.group===u?0:n.toDecimal(),r.symbols?this.parse(r,t):t[n]=r.multiplier}this.coeffs=t,this.fill()},fill:function(e){e=Number(e)||0;for(var t=this.coeffs.length,n=0;n<t;n++)void 0===this.coeffs[n]&&(this.coeffs[n]=new z(e));return this},trim:function(){for(var e=this.coeffs.length;e--;){var t=this.coeffs[e],n=t.equals(0);if(!t||!n)break;if(0===e)break;this.coeffs.pop()}return this},modP:function(e){for(var t=this.coeffs.length,n=0;n<t;n++){var r=this.coeffs[n];if(r<0){for(var i,s=n;s<t;s++)if(0<this.coeffs[s]){i=this.coeffs[s];break}if(i){for(;n<s;s--)this.coeffs[s]=this.coeffs[s].subtract(new z(1)),this.coeffs[s-1]=this.coeffs[s-1].add(new z(e));r=this.coeffs[n]}}var o,a=r.mod(e),u=r.subtract(a).divide(e);u.equals(0)||(r=(r=this.coeffs[o=n+1]||new z(0)).add(u),this.coeffs[o]=new z(r),this.coeffs[n]=new z(a))}return this},add:function(e){for(var t=Math.max(this.coeffs.length,e.coeffs.length),n=0;n<t;n++){var r=this.coeffs[n]||new z(0),i=e.coeffs[n]||new z(0);this.coeffs[n]=r.add(i)}return this},subtract:function(e){for(var t=Math.max(this.coeffs.length,e.coeffs.length),n=0;n<t;n++){var r=this.coeffs[n]||new z(0),i=e.coeffs[n]||new z(0);this.coeffs[n]=r.subtract(i)}return this},divide:function(e){for(var t=this.variable,n=Z.Utils.arrayClone(this.coeffs),r=Z.Utils.arrayClone(e.coeffs),i=n.length,s=r.length-1,o=[],a=0;a<i;a++){var u=i-(a+1),l=u-s,c=n[u].divide(r[s]);if(l<0)break;o[l]=c;for(var p=0;p<=s;p++)n[p+l]=n[p+l].subtract(r[p].multiply(c))}e=W.fromArray(n,t||"x").trim();return[W.fromArray(o,t||"x"),e]},multiply:function(e){for(var t=this.coeffs.length,n=e.coeffs.length,r=[],i=0;i<t;i++)for(var s=this.coeffs[i],o=0;o<n;o++){var a=i+o,u=e.coeffs[o],l=r[a]||new z(0);r[a]=l.add(s.multiply(u))}return this.coeffs=r,this},isZero:function(){for(var e=this.coeffs.length,t=0;t<e;t++)if(!this.coeffs[t].equals(0))return!1;return!0},sub:function(e){for(var t=new z(0),n=this.coeffs.length,r=0;r<n;r++){var i=this.coeffs[r];i.equals(0)||(t=t.add(i.multiply(new z(Math.pow(e,r)))))}return t},clone:function(){var e=new W;return e.coeffs=this.coeffs,e.variable=this.variable,e},deg:function(){return this.trim(),this.coeffs.length-1},lc:function(){return this.coeffs[this.deg()].clone()},monic:function(){for(var e=this.lc(),t=this.coeffs.length,n=0;n<t;n++)this.coeffs[n]=this.coeffs[n].divide(e);return this},gcd:function(e){if(this.coeffs.length-1<e.coeffs.length-1)return e.gcd(this);for(var t=this;!e.isZero();){var n=e.clone();e=(t=t.clone()).divide(n)[1],t=n}var r=Z.Math2.QGCD.apply(null,t.coeffs);if(!r.equals(1))for(var i=t.coeffs.length,s=0;s<i;s++)t.coeffs[s]=t.coeffs[s].divide(r);return t},diff:function(){for(var e=[],t=this.coeffs.length,n=1;n<t;n++)e.push(this.coeffs[n].multiply(new z(n)));return this.coeffs=e,this},integrate:function(){for(var e=[0],t=this.coeffs.length,n=0;n<t;n++){var r=new z(n+1);e[r]=this.coeffs[n].divide(r)}return this.coeffs=e,this},gcf:function(e){for(var t=[],n=0;n<this.coeffs.length;n++){var r=this.coeffs[n];r.equals(0)||-1!==t.indexOf(r)||t.push(r)}var i=[Z.Math2.QGCD.apply(void 0,t),function(e){for(var t=0;t<e.length;t++)if(!e[t].equals(0))return t}(this.coeffs)].toDecimal();return e&&((e=[])[i[1]-1]=i[0],i=W.fromArray(e,this.variable).fill()),i},quad:function(e){var t=[];if(3<this.coeffs.length)throw new Error("Cannot calculate quadratic order of "+(this.coeffs.length-1));if(0===this.coeffs.length)throw new Error("Polynomial array has no terms");var n=this.coeffs[2]||0,r=this.coeffs[1]||0,i=r*r-4*n*this.coeffs[0];return i<0&&!e||(t[0]=(-r+Math.sqrt(i))/(2*n),t[1]=(-r-Math.sqrt(i))/(2*n)),t},squareFree:function(){for(var e=this.clone(),t=1,n=e.clone().diff(),r=e.clone().gcd(n),i=e.divide(r)[0],s=W.fromArray([new z(1)],e.variable);!r.equalsNumber(1);){var o=i.gcd(r),a=i.divide(o)[0];if(!a.equalsNumber(1)&&1<t){for(var u=a.clone(),l=1;l<t;l++)u.multiply(a.clone());a=u}s=s.multiply(a),t++,r=r.divide(i=o)[0]}return[s,i,t]},toSymbol:function(){var e=this.coeffs.length,t=this.variable;if(0===e)return new Z.Symbol(0);for(var n=e-1,r="",i=0;i<e;i++){var s=i===n?"":"+",o=this.coeffs[i];o.equals(0)||(r+=o+"*"+t+"^"+i+s)}return H.parse(r)},equalsNumber:function(e){return this.trim(),1===this.coeffs.length&&this.coeffs[0].toDecimal()===String(e)},toString:function(){return this.toSymbol().toString()}},Q.prototype.coeffs=function(e,t){t&&!this.isPoly(!0)&&H.error("Polynomial expected when requesting coefficients with order"),e=e||[];var n,r=this.clone().distributeMultiplier();if(r.isComposite())for(var i in r.symbols){i=r.symbols[i];i.isComposite()?i.clone().distributeMultiplier().coeffs(e,t):t?e[i.isConstant()?0:i.power.toDecimal()]=i.multiplier:e.push(i.multiplier)}else t?e[r.isConstant(!0)?0:r.power.toDecimal()]=r.multiplier:r.group===L&&r.isImaginary()?(n=new Q(r.multiplier),r.each(function(e){(e.isConstant(!0)||e.imaginary)&&(n=H.multiply(n,e))}),e.push(n)):e.push(r.multiplier);if(t)for(var s=0;s<e.length;s++)void 0===e[s]&&(e[s]=new Q(0));return e},Q.prototype.tBase=function(e){if(void 0===e)throw new Error("Symbol.tBase requires a map object!");for(var t=[],n=this.collectSymbols(null,null,null,!0),r=n.length,i=0;i<r;i++){var s=n[i],o=s.group,a=new J(s.multiplier,[],e);if(o===L)for(var u in s.symbols){var l=s.symbols[u];a.terms[e[u]]=l.power}else a.terms[e[s.value]]=s.power;t.push(a.fill()),a.updateCount()}return t},Q.prototype.altVar=function(e){var t=this.multiplier.toString(),n=this.power.toString();return("1"===t?"":t+"*")+e+("1"===n?"":"^"+n)},Q.prototype.sameVars=function(e){if(!this.symbols&&this.group!==e.group)return!1;for(var t in this.symbols){var n=this.symbols[t],t=e.symbols[t];if(!t)return!1;if(n.value!==t.value)return!1}return!0},Q.prototype.groupTerms=function(r){var i,s,o;r=String(r);var a=[];return this.each(function(e){if(e.group===y){o=e.groupTerms(r);for(var t=0;t<o.length;t++){var n=o[t];n&&(a[t]=n)}}else i=Z.Utils.decompose_fn(e,r,!0),s=i.x.value===r?Number(i.x.power):0,a[s]=H.add(a[s]||new Q(0),i.a)}),a},Q.prototype.collectFactors=function(){var t=[];return this.group===L?this.each(function(e){t.push(e.clone())}):t.push(this.clone()),t},O.prototype.getNumberSymbolics=function(){var t=0;return this.each(function(e){e.isConstant(!0)||t++}),t},O.prototype.add=function(e){if(e.equals(0))return this;if(e.equals(-1)&&0<this.length){var t=Z.Utils.firstObject(this.factors,null,!0);return this.add(H.symfunction(Z.Settings.PARENTHESIS,[t.obj]).negate()),delete this.factors[t.key],this.length--,this}if(e.group===L){var n=this;e.multiplier.equals(1)||n.add(new Q(e.multiplier)),e.each(function(e){n.add(e)})}else{this.preAdd&&(e=this.preAdd(e));t=(e=this.pFactor?H.pow(e,new Q(this.pFactor)):e).isConstant();if(t&&e.equals(1))return this;t=t?e.value:e.text();t in this.factors?(this.factors[t]=H.multiply(this.factors[t],e),this.factors[t].equals(1)&&(delete this.factors[t],this.length--)):(this.factors[t]=e,this.length++)}return this},O.prototype.toSymbol=function(){for(var e=new Q(1),t=Object.values(this.factors).sort(function(e,t){return e.group>t.group}),n=0,r=t.length;n<r;n++)var i=t[n],i=i.power.equals(1)&&""!==i.fname?H.symfunction(Z.PARENTHESIS,[i]):i,e=H.multiply(e,i);return e=""===e.fname?Q.unwrapPARENS(e):e},O.prototype.merge=function(e){for(var t in e)t in this.factors?this.factors[t]=H.multiply(this.factors[t],e[t]):this.factors[t]=e[t];return this},O.prototype.each=function(e){for(var t in this.factors){var n=this.factors[t];n.fname===Z.PARENTHESIS&&n.isLinear()&&(n=n.args[0]),e.call(this,n,t)}return this},O.prototype.count=function(){return I(this.factors).length},O.prototype.clean=function(){try{var e=Z.Settings.CONST_HASH;this.factors[e].lessThan(0)&&(this.factors[e].equals(-1)?delete this.factors[e]:this.factors[e].negate(),this.each(function(e){e.negate()}))}catch(e){}},O.prototype.toString=function(){return this.toSymbol().toString()},J.prototype.updateCount=function(){this.count=this.count||0;for(var e=0;e<this.terms.length;e++)this.terms[e].equals(0)||this.count++;return this},J.prototype.getVars=function(){for(var e=[],t=0;t<this.terms.length;t++){var n=this.terms[t];this.getRevMap();n.equals(0)||e.push(this.rev_map[t])}return e.join(" ")},J.prototype.len=function(){return void 0===this.count&&this.updateCount(),this.count},J.prototype.toSymbol=function(e){e=e||this.getRevMap();for(var t=new Q(this.coeff),n=0;n<this.terms.length;n++){var r=e[n],i=this.terms[n];i.equals(0)||r===Y||((r=new Q(r)).power=i,t=H.multiply(t,r))}return t},J.prototype.getRevMap=function(){if(this.rev_map)return this.rev_map;var e,t={};for(e in this.map)t[this.map[e]]=e;return this.rev_map=t},J.prototype.generateImage=function(){return this.image=this.terms.join(" "),this},J.prototype.getImg=function(){return this.image||this.generateImage(),this.image},J.prototype.fill=function(){for(var e=this.map.length,t=0;t<e;t++)void 0===this.terms[t]?this.terms[t]=new Z.Frac(0):this.sum=this.sum.add(this.terms[t]);return this},J.prototype.divide=function(e){for(var t=this.coeff.divide(e.coeff),n=this.terms.length,r=new J(t,[],this.map),i=0;i<n;i++)r.terms[i]=this.terms[i].subtract(e.terms[i]),r.sum=r.sum.add(r.terms[i]);return r},J.prototype.multiply=function(e){for(var t=this.coeff.multiply(e.coeff),n=this.terms.length,r=new J(t,[],this.map),i=0;i<n;i++)r.terms[i]=this.terms[i].add(e.terms[i]),r.sum=r.sum.add(r.terms[i]);return r},J.prototype.isZero=function(){return this.coeff.equals(0)},J.prototype.toString=function(){return"{ coeff: "+this.coeff.toString()+", terms: ["+this.terms.join(",")+"]: sum: "+this.sum.toString()+", count: "+this.count+"}"},Z.Utils.toMapObj=function(e){for(var t=0,n={},r=0;r<e.length;r++){var i=e[r];void 0===n[i]&&(n[i]=t,t++)}return n.length=t,n},Z.Utils.filledArray=function(e,t,n){for(var r=[];t--;)r[t]=n?new n(e):e;return r},Z.Utils.arrSum=function(e){for(var t=0,n=e.length,r=0;r<n;r++)t+=e[r];return t},Z.Utils.haveIntersection=function(e,t){var n;return t.length>e.length&&(n=t,t=e,e=n),e.some(function(e){return-1<t.indexOf(e)})},Z.Utils.subFunctions=function(e,r){r=r||{};var i=[];return e.each(function(e){var t,n;e.group===C||e.previousGroup===C?(t=Z.Utils.text(e,"hash"),(n=r[t])?i.push(e.altVar(n)):(n=e.fname+I(r).length,r[t]=n,i.push(e.altVar(n)))):e.group===L||e.group===y||e.group===X?i.push(Z.Utils.subFunctions(e,r)):i.push(e.text())}),e.group===X||e.group===y?e.altVar(Z.Utils.inBrackets(i.join("+"))):e.group===L?e.altVar(Z.Utils.inBrackets(i.join("*"))):e.text()},Z.Utils.getFunctionsSubs=function(e){var t,n={};for(t in e)n[e[t]]=H.parse(t);return n};var R=Z.Algebra={version:"1.4.6",proots:function(e,l){l=l||7;function t(e,t,n){for(var r=function(e,t){var n=e.slice(0);if(e.unshift(t),100<t)throw new Z.exceptions.ValueLimitExceededError("This utility accepts polynomials of degree up to 100. ");var r=[],e={};for(e.Degree=t,p=0;p<t;p++)r.push(0);var i=r.slice(0);function V(e,t,n,r,i,s){i[0]=s.b=r[0],i[1]=s.a=-(t*s.b)+r[1];for(var o=2;o<e;o++)i[o]=-(t*s.a+n*s.b)+r[o],s.b=s.a,s.a=i[o]}function H(e,t,n,r,i,s,o,a,u){var l=new Object,c=3;return l.b=l.a=0,V(t,o,a,s,u,l),i.c=l.a,i.d=l.b,Math.abs(i.c)<=100*e*Math.abs(s[t-1])&&Math.abs(i.d)<=100*e*Math.abs(s[t-2])||(i.h=a*r,Math.abs(i.d)>=Math.abs(i.c)?(c=2,i.e=n/i.d,i.f=i.c/i.d,i.g=o*r,i.a3=i.e*(i.g+n)+i.h*(r/i.d),i.a1=-n+i.f*r,i.a7=i.h+(i.f+o)*n):(c=1,i.e=n/i.c,i.f=i.d/i.c,i.g=i.e*o,i.a3=i.e*n+(i.g+i.h/i.c)*r,i.a1=-(n*(i.d/i.c))+r,i.a7=i.g*i.d+i.h*i.f+n)),c}function j(e,t,n,r,i,s,o,a,u){if(3!=n)if(r=1==n?i:r,Math.abs(s.a1)>10*e*Math.abs(r)){s.a7/=s.a1,s.a3/=s.a1,o[0]=u[0],o[1]=-(u[0]*s.a7)+u[1];for(l=2;l<t;l++)o[l]=-(u[l-1]*s.a7)+a[l-2]*s.a3+u[l]}else{o[0]=0,o[1]=-(u[0]*s.a7);for(l=2;l<t;l++)o[l]=-(u[l-1]*s.a7)+a[l-2]*s.a3}else{o[1]=o[0]=0;for(var l=2;l<t;l++)o[l]=a[l-2]}}function X(e,t,n,r,i,s,o,a,u,l,c,p,f,h,m,g,d){var v;t.b=t.a=0,3!=e&&(a=2!=e?(v=n+f*o+p*l,a+(f+h*l)*u):(v=(n+c)*l+p,(l+f)*a+h*u),u=-(m[g-1]/d[g]),0!=(v=-(i=h*(m=-(m[g-2]+u*d[g-1])/d[g])*r-((d=u*s)+(g=u*u*i)))+a+u*v)&&(t.a=-(f*(g+d)+h*(u*r+m*s))/v+f,t.b=h*(1+i/v)))}function $(e,t,n,r){var i,s,o;(r.sr=r.si=r.lr=r.li=0)!=e?0!=n?(i=t/2,s=Math.abs(i)<Math.abs(n)?(o=-(o=0<=n?e:-e)+i*(i/Math.abs(n)),Math.sqrt(Math.abs(o))*Math.sqrt(Math.abs(n))):(o=-e/i*(n/i)+1,Math.sqrt(Math.abs(o))*Math.abs(i)),0<=o?(r.lr=(-i+(s=0<=i?-s:s))/e,r.sr=0!=r.lr?n/r.lr/e:r.sr):(r.lr=r.sr=-i/e,r.si=Math.abs(s/e),r.li=-r.si)):r.lr=-t/e:r.sr=0!=t?-n/t:r.sr}function G(e,t,n,r,i,s,o,a,u,l,c,p){var f,h,m,g,d,v,w,y,b,S,M,N,E,q,x,A,C,L,I,U,_,O,R,T,P,k=new Object,D=new Object,F=new Array(t),B=new Array(t),G=1;for(p.NZ=0,g=m=.25,d=r,y=i,k.b=k.a=0,V(u,c,i,a,l,k),f=k.a,h=k.b,D.h=D.g=D.f=D.e=D.d=D.c=D.a7=D.a3=D.a1=0,R=H(e,o,f,h,D,s,c,i,F),U=0;U<n;U++){if(L=1,j(e,o,R,f,h,D,s,F,l),X(R=H(e,o,f,h,D,s,c,i,F),k,f,D.a1,D.a3,D.a7,h,D.c,D.d,D.f,D.g,D.h,c,i,s,o,a),x=k.a,C=A=k.b,S=0!=s[o-1]?-(a[o]/s[o-1]):0,M=E=1,0!=U&&3!=R&&(T=(q=(E=0!=C?Math.abs((C-y)/C):E)<w?E*w:1)<g?1:0,(_=(N=(M=0!=S?Math.abs((S-d)/S):M)<v?M*v:1)<m?1:0)||T)){for(I=0;I<o;I++)B[I]=s[I];for(b=S,O=P=0;;){if(!L||0!=(L=0)||!_||T&&!(N<q)){if(!function(e,t,n,r,i,s,o,a,u,l,c,p){var f,h,m,g,d,v,w,y,b,S=new Object,M=0,N=0;n.NZ=0,g=r,v=i;do{if(S.li=S.lr=S.si=S.sr=0,$(1,g,v,S),n.szr=S.sr,n.szi=S.si,n.lzr=S.lr,n.lzi=S.li,Math.abs(Math.abs(n.szr)-Math.abs(n.lzr))>.01*Math.abs(n.lzr))break;for(V(o,g,v,u,s,a),w=Math.abs(-(n.szr*a.b)+a.a)+Math.abs(n.szi*a.b),y=Math.sqrt(Math.abs(v)),f=2*Math.abs(s[0]),d=-(n.szr*a.b),b=1;b<t;b++)f=f*y+Math.abs(s[b]);if(w<=20*(f=(9*(f=f*y+Math.abs(d+a.a))+2*Math.abs(d)-7*(Math.abs(a.a+d)+y*Math.abs(a.b)))*e)){n.NZ=2;break}if(20<++M)break;if(2<=M&&m<=.01&&h<=w&&!N){for(V(o,g-=g*(m=m<e?Math.sqrt(e):Math.sqrt(m)),v+=v*m,u,s,a),b=0;b<5;b++)j(e,t,H(e,t,a.a,a.b,c,p,g,v,l),a.a,a.b,c,p,l,s);N=1,M=0}}while(h=w,j(e,t,H(e,t,a.a,a.b,c,p,g,v,l),a.a,a.b,c,p,l,s),X(H(e,t,a.a,a.b,c,p,g,v,l),a,a.a,c.a1,c.a3,c.a7,a.b,c.c,c.d,c.f,c.g,c.h,g,v,p,t,u),d=a.a,0!=(w=a.b)&&(m=Math.abs((-v+w)/w),g=d,v=w),0!=w)}(e,o,p,x,A,l,u,k,a,F,D,s),f=k.a,h=k.b,0<p.NZ)return;if(G=P=1,g*=.25,O||!_)G=0;else for(I=0;I<o;I++)s[I]=B[I]}if(0!=G){if(k.a=b,G=function(e,t,n,r,i,s,o,a,u){var l,c,p,f,h,m,g,d,v,w,y,b=r-1;for(t.NZ=y=v=0,g=n.a;;){for(m=i[0],o[0]=m,w=1;w<s;w++)o[w]=m=m*g+i[w];for(p=Math.abs(m),f=Math.abs(g),l=.5*Math.abs(o[0]),w=1;w<s;w++)l=l*f+Math.abs(o[w]);if(p<=20*e*(2*l-p)){t.NZ=1,t.szr=g,t.szi=0;break}if(10<++y)break;if(2<=y&&Math.abs(d)<=.001*Math.abs(-d+g)&&h<p){v=1,t.a=g;break}for(h=p,u[0]=c=a[0],w=1;w<r;w++)u[w]=c=c*g+a[w];if(Math.abs(c)>10*Math.abs(a[b])*e)for(d=-m/c,a[0]=o[0],w=1;w<r;w++)a[w]=d*u[w-1]+o[w];else for(a[0]=0,w=1;w<r;w++)a[w]=u[w-1];for(c=a[0],w=1;w<r;w++)c=c*g+a[w];g+=d=Math.abs(c)>10*Math.abs(a[b])*e?-m/c:0}return v}(e,p,k,o,a,u,l,s,F),b=k.a,0<p.NZ)return;if(O=1,m*=.25,0!=G){x=-(b+b),A=b*b;continue}}for(I=0;I<o;I++)s[I]=B[I];if(!T||P)break}V(u,c,i,a,l,k),R=H(e,o,f=k.a,h=k.b,D,s,c,i,F)}y=C,d=S,w=E,v=M}}!function(e,t,n,r){for(var i,s,o,a,u,l,c,p,f,h,m,g,d,v,w=e.Degree,y=.017453292519943295,b=Math.LN2,S=e.Degree+1,M=new Array(S),N=new Array(S),E=new Array(S),q=new Array(S),x=new Object,A=new Object,C=1;i=C,1<(l=1+(C/=2)););var L=Number.MIN_VALUE/i,I=Math.cos(94*y),U=Math.sin(94*y),_=Math.sqrt(.5),O=-_;for(A.NZ=f=0,A.szr=A.szi=A.lzr=A.lzi=0;0==t[w];)n[f]=r[f]=0,w--,f++;for(d=w+1;1<=w;){if(w<=2){w<2?(n[e.Degree-1]=-(t[1]/t[0]),r[e.Degree-1]=0):($(t[x.li=x.lr=x.si=x.sr=0],t[1],t[2],x),n[e.Degree-2]=x.sr,r[e.Degree-2]=x.si,n[e.Degree-1]=x.lr,r[e.Degree-1]=x.li);break}for(a=0,u=Number.MAX_VALUE,R=0;R<d;R++)a<(T=Math.abs(t[R]))&&(a=T),0!=T&&T<u&&(u=T);if(((m=L/u)<=1&&10<=a||1<m&&Number.MAX_VALUE/m>=a)&&(m=0==m?Number.MIN_VALUE:m,m=Math.floor(Math.log(m)/b+.5),1!=(o=Math.pow(2,m))))for(R=0;R<d;R++)t[R]*=o;for(var R=0;R<d;R++)N[R]=Math.abs(t[R]);N[w]=-N[w],g=w-1,T=Math.exp((Math.log(-N[w])-Math.log(N[0]))/w),P=T=0!=N[g]?(P=-N[w]/N[g])<T?P:T:T;do{for(var T,P=.1*(T=P),k=N[0],R=1;R<d;R++)k=k*P+N[R]}while(0<k);0;do{for(var D=k=N[0],R=1;R<w;R++)D=T*D+(k=T*k+N[R])}while(T-=s=(k=T*k+N[w])/D,.005<Math.abs(s/T));for(var F=T,R=1;R<w;R++)M[R]=(w-R)*t[R]/w;for(M[0]=t[0],C=t[w],l=t[g],v=0==M[g]?1:0,h=0;h<5;h++)if(c=M[g],v){for(R=0;R<g;R++)M[f=g-R]=M[f-1];v=(M[0]=0)==M[g]?1:0}else{for(var B=-C/c,R=0;R<g;R++)M[f=g-R]=B*M[f-1]+t[f];M[0]=t[0],v=Math.abs(M[g])<=Math.abs(l)*i*10?1:0}for(R=0;R<w;R++)q[R]=M[R];for(h=1;h<=20;h++){if(p=-U*O+I*_,O=U*_+I*O,G(i,S,20*h,p=F*(_=p),F,M,w,t,d,E,-2*p,A),0!=A.NZ){n[f=e.Degree-w]=A.szr,r[f]=A.szi;for(w=(d-=A.NZ)-1,R=0;R<d;R++)t[R]=E[R];1!=A.NZ&&(n[f+1]=A.lzr,r[f+1]=A.lzi);break}for(R=0;R<w;R++)M[R]=q[R]}if(20<h){e.Degree-=w;break}}}(e,n,i,r);var s=r.length;for(p=0;p<s;p++){var o=b(r[p],l+8),a=b(i[p],l+8);a=2<l-String(a).length?a:i[p];var u=o<0?"-":"";0===a&&(a=""),0===o&&(o=""),o=1===Math.abs(o)?u+"i":o?o+"*i":"";o=a&&o?a+"+"+o:a+o;i[p]=o.replace(/\+\-/g,"-")}return i}(e,n).concat(s),i=0;i<0;i++)r.unshift(0);return r}var n,s=[];if(e instanceof Q&&e.isPoly()){if(e.distributeMultiplier(),e.group===y&&(n=Z.Utils.arrayMin(I(e.symbols)),n=e.symbols[n].clone().toUnitMultiplier(),e=H.expand(H.divide(e,n)),s.push(0)),e.group===Z.groups.S)return[0];e.group===Z.groups.PL&&(a=I(e.symbols),r=Z.Utils.arrayMin(a),e=Z.PARSER.divide(e,Z.PARSER.parse(e.value+"^"+r)));for(var r=I(e.symbols).sort().pop(),i=e.group===Z.groups.PL?e.symbols:e.symbols[r],o=i.group,a=o===j?[i.power.toDecimal()]:I(i.symbols),u=[],c=Z.Utils.arrayMax(a),p=1;p<=c;p++){var f=0;-1!==a.indexOf(p+"")&&(f=(o===j?i:i.symbols[p]).multiplier),u.unshift(f)}return u.push(e.symbols[Y].multiplier),i.group===j&&(u[0]=i.multiplier),t(u,0,c)}if(Z.Utils.isArray(e)){for(var h=e,u=[],a=[],m=0,p=0;p<h.length;p++){for(var g=h[p][0],d=h[p][1],v=d-m-1,w=0;w<v;w++)u.unshift(0);u.unshift(g),0!==d&&a.push(d),m=d}return t(u,0,c=Math.max.apply(void 0,a))}throw new Z.exceptions.NerdamerTypeError("Cannot calculate roots. Symbol must be a polynomial!")},roots:function(e){if(e.isConstant(!0,!0))return Z.Utils.nroots(e);e=R.proots(e).map(function(e){return H.parse(e)});return Z.Vector.fromArray(e)},froot:function(a,e,u){return function(e){for(var t=u||Z.Utils.build(Z.Calculus.diff(a.clone())),n=a instanceof Function?a:Z.Utils.build(a),r=!1,i=0;!r;){var s=e-n(e)/t(e),o=Math.abs(s)-Math.abs(e);e=s,Math.abs(o)<1e-12?r=!0:1e4<i&&(r=!(e=null)),i++}return e}(Number(e))},quad:function(e,t,n){function r(e,t,n,r){return H.parse("-("+t+"+"+r+"*sqrt(("+t+")^2-4*("+e+")*("+n+")))/(2*"+e+")")}return[r(e,t,n,1),r(e,t,n,-1)]},sumProd:function(e,t){return R.quad(-t,e,-1).map(function(e){return e.invert()})},coeffs:function(e,t,n){t=String(t),e=H.expand(e),n=n||[new Q(0)],e.group===p&&e.contains(t,!0)&&H.error("Unable to get coefficients using expression "+e.toString());var r,i=$(e);if(1!==i.length||i[0]!==t||e.isImaginary())t||H.error("Polynomial contains more than one variable. Please specify which variable is to be used!"),-1===i.indexOf(t)?n[0]=H.add(e,n[0]):(n=n||[new Q(0)],e.group===L?((r=e.symbols[t])||H.error("Expression is not a polynomial!"),i=Number(r.power),((l=H.divide(e.clone(),r.clone())).contains(t,!0)||i<0||!_(i))&&H.error("Expression is not a polynomial!"),(u=n[i])&&(l=H.add(u,l)),n[i]=l):e.group===X&&e.each(function(e){R.coeffs(e.clone(),t,n)},!0));else for(var s=new W(e).coeffs.map(function(e){return new Q(e)}),o=0,a=s.length;o<a;o++){var u,l=s[o];(u=n[o])&&(l=H.add(u,l)),n[o]=l}for(o=0,a=n.length;o<a;o++)void 0===n[o]&&(n[o]=new Q(0));return n},polyPowers:function(e,t,n){if(n=n||[],(s=e.group)===y&&t===e.value)n=n.concat(I(e.symbols));else if(s===X)for(var r in e.symbols){var i=e.symbols[r],s=i.group,r=i.value;s===j&&t===r?n.push(i.power):s===y||s===X?n=R.polyPowers(i,t,n):s===L&&i.contains(t)?(i=i.symbols[t])&&n.push(i.power):s!==u&&t===r||n.push(0)}else s===L&&e.contains(t)&&n.push(Z.Utils.decompose_fn(e,t,!0).x.power);return Z.Utils.arrayUnique(n).sort()},Factor:{split:function(e){var n=new Q(1),r=new Q(1);return R.Factor.factor(e,new O).each(function(e){var t=H.parse(e);e.isConstant(!0)?n=H.multiply(n,t):r=H.multiply(r,t)}),[n,r]},mix:function(e,t){for(var n=I(e),r=n.length,i=[],s=0;s<r;s++){for(var o=n[s],a=e[o],u=i.length,l=0;l<u;l++){var c=i[l]*o;i.push(c),t&&i.push(-c)}for(l=1;l<=a;l++)i.push(Math.pow(o,l))}return i},common:function(e,t){try{if(e.group===X){for(var n=H.expand(e.clone(),!0).collectSymbols(null,null,function(e,t){return(t.length||1)-(e.length||1)}),r={},i=[],s=0;s<n.length;s++){var o=n[s];i.push(o.multiplier.clone()),o.each(function(e){var t=Number(e.power);if(isNaN(t))throw new Error("exiting");e.value in r?(t<r[e.value][0]&&(r[e.value][0]=t),r[e.value][1].push(e)):r[e.value]=[t,[e]]})}var a,u=new Q(1);for(a in r)r[a][1].length===n.length&&(u=H.multiply(u,H.pow(new Q(a),new Q(r[a][0]))));var l=Z.Math2.QGCD.apply(null,i);if(!l.equals(1)){t.add(new Q(l));for(s=0;s<n.length;s++)n[s].multiplier=n[s].multiplier.divide(l)}if(!u.equals(1)){t.add(u),e=new Q(0);for(s=0;s<n.length;s++)e=H.add(e,H.divide(n[s],u.clone()))}}}catch(e){}return e},zeroes:function(e,t){function n(){throw new Z.exceptions.ValueLimitExceededError("Exiting")}try{for(var r,i,s,o=(e=H.expand(e.clone())).toString(),a=$(e),u=new Q(0),l=[],c=[],p=0,f=a.length;p<a.length;p++){for(var h={},m=0;m<f;m++)p!==m&&(h[a[m]]=0);var g,d=(g=H.parse(o,h)).power;_(d)||n(),l.push(g),c.push(g.power)}Z.Utils.allSame(c)?(i=e.length,2===(s=l.length)&&(r=new z(c[0]/(i-1))),3===s&&(r=new z(c[0]/Math.round((Math.sqrt(8*i-1)-3)/2)))):r=Z.Math2.QGCD.apply(null,c),_(r)||n();for(p=0;p<l.length;p++){var v=l[p],w=v.power.clone().divide(r);v.multiplier=new z(Math.pow(v.multiplier,1/w)),v.power=r.clone(),u=H.add(u,v)}if(u.group!==X)return e;for(;;){var y=R.div(e.clone(),u.clone());if(!y[1].equals(0))break;if(e=y[0],t.add(u.clone()),e.equals(1))break}}catch(o){}return e},factor:function(e,t){if(e.isConstant())return Z.Math2.factor(e);var n,r,i=H.parse(e),t=R.Factor._factor(i,t);return t.equals(e)||t.group===L&&(n=new Q(1),e=H.parse(t.power),r=H.parse(t.multiplier),t.toUnitMultiplier(),t.multiplier.lessThan(0)&&(n.negate(),t.negate()),t.each(function(e){e=H.parse(R.Factor._factor(e));e.group===L?(r=H.multiply(r,Q.create(e.multiplier)),e.each(function(e){e=H.parse(R.Factor._factor(e));n=H.multiply(n,e),e.group===L&&(r=H.multiply(r,Q.create(e.multiplier)))})):n=H.multiply(n,e)}),t=H.pow(H.multiply(r,n),e)),t},quadFactor:function(e,t){if(e.isPoly()&&R.degree(e.equals(2))){var n=Z.Utils.variables(e)[0],r=R.coeffs(e,n),i=R.Factor._factor(r[2].clone());if(i.group===L){var s=i.collectSymbols();if(2<s.length)return e;var o=H.multiply(H.parse(r[0]),H.parse(s[0])),a=H.parse(r[1]).negate(),i=H.parse(s[1]),o=R.quad(i,a,o).filter(function(e){if(Z.Utils.isInt(e))return e});1===o.length&&(o=o[0],r=H.divide(r[0],H.parse(o)),Z.Utils.isInt(r)&&(t.add(H.parse(l("({0})*({1})+({2})",s[1],n,r))),t.add(H.parse(l("({0})*({1})+({2})",s[0],n,o))),e=new Q(1)))}}return e},cubeFactor:function(e,t){var n,r,i,s,o,a;return!e.isComposite()||2===(a=e.collectSymbols()).length&&(n=a[0].sign(),r=a[0].clone().abs(),i=a[1].sign(),s=a[1].clone().abs(),r.isCube()&&s.isCube()&&(n<i&&([n,i]=[i,n],[r,s]=[s,r]),o=H.parse(r.getNth(3)),a=H.parse(s.getNth(3)),o=H.multiply(H.expand(H.pow(r.clone().toUnitMultiplier(),H.parse("1/3"))),o),a=H.multiply(H.expand(H.pow(s.clone().toUnitMultiplier(),H.parse("1/3"))),a),1===n&&-1===i?(t.add(H.parse(l("(({0})-({1}))",o,a))),t.add(H.parse(l("(({0})^2+({0})*({1})+({1})^2)",o,a))),e=Q(1)):1===n&&1===i&&(t.add(H.parse(l("(({0})+({1}))",o,a))),t.add(H.parse(l("(({0})^2-({0})*({1})+({1})^2)",o,a))),e=Q(1)))),e},_factor:function(e,t){var n;e.group;if(e.group===C){var r=e.args[0];if(r.group===j&&r.isSimple())return e}else if(e.group===j&&e.isSimple())return e;e.group===X&&(e.distributeMultiplier(!0),n=new Q(0),e.each(function(e){(e.group===X&&e.power.greaterThan(1)||e.group===L)&&(e=H.expand(e)),n=H.add(n,e)}),n.power=e.power,e=n);r=(e=e.group===C&&"sqrt"!==e.fname?Z.Utils.evaluate(e):e).clone();try{if(e.group===L){var i=H.parse(e.power),s=R.Simplify.strip(e.getDenom()),o=R.Simplify.strip(e.getNum()),a=s.pop(),u=o.pop();if(u.equals(e))return e;var l=R.Factor.factor(u),c=R.Factor.factor(a),p=R.Simplify.unstrip(o,l),f=R.Simplify.unstrip(s,c);return A=H.divide(p,f)}if(e.group===j)return e;if(e.isConstant())return e.equals(1)?e.clone():Z.Math2.factor(e);i=e.power.clone();if(!_(i)||i.lessThan(0)&&e.group===C)return e;var h=i.sign();e.toLinear(),t=t||new O;var m={};e=H.parse(Z.Utils.subFunctions(e,m)),0<I(m).length&&(t.preAdd=function(e){return H.parse(e,Z.Utils.getFunctionsSubs(m))}),e.isLinear()||(t.pFactor=e.power.toString(),e.toLinear());var g=$(e);e.isImaginary()&&g.push(Z.Settings.IMAGINARY);var d=1<g.length;if(d){var v=!0,w=!0;if(e.each(function(e){e.group!==j&&(v=!1),e.multiplier.equals(1)||(w=!1)}),v&&w)return H.pow(H.parse(e,Z.Utils.getFunctionsSubs(m)),H.parse(i))}var y=new O;e=R.Factor.coeffFactor(e,y),y.each(function(e){U(i)&&e.lessThan(0)&&e.negate(),h<0&&e.invert(),t.add(e)});var b=new O;if(e=R.Factor.powerFactor(e,b),b.each(function(e){h<0&&e.invert(),t.add(e)}),d)e=R.Factor.cubeFactor(e,t),e=R.Factor.mfactor(e,t),t.each(function(e){h<0&&e.power.negate()});else{var S=g[0];e=R.Factor.squareFree(e,t,S);var M=new O;e=R.Factor.trialAndError(e,M,S);var N,E=M.toSymbol();if(E.equals(r))return E;for(N in M.factors){var q=M.factors[N];t.add(H.pow(q,H.parse(i)))}e.equals(r)&&(e=R.Factor.quadFactor(e,t))}e=H.parse(e,Z.Utils.getFunctionsSubs(m));var x=1===t.length;t.add(H.pow(e,H.parse(i)));var A=t.toSymbol();return A=x&&e.equals(1)&&A.isLinear()?H.pow(A,H.parse(i)):A}catch(e){return r}},reduce:function(e,t){if(e.group===X&&2===e.length){var n=e.collectSymbols().sort(function(e,t){return t.multiplier-e.multiplier});if(n[0].power.equals(n[1].power)){var r=H.parse(n[0].power),i=n[0].clone().toLinear(),s=n[1].clone().toLinear();t.add(H.add(i.clone(),s.clone())),s.negate();for(var o=Number(r),a=new Q(0),u=1;u<=o;u++)var l=H.pow(i.clone(),H.subtract(r.clone(),new Q(u))),c=H.pow(s.clone(),H.subtract(new Q(u),new Q(1))),a=H.add(a,H.multiply(l,c));return a}}return e},squareFree:function(e,t,n){if(e.isConstant()||e.group===j)return e;var r=new W(e,n).squareFree(),n=r[2];if(1===n)return e;e=r[1].toSymbol();return e.power=e.power.multiply(new z(n)),t.add(R.Factor.factor(e)),R.Factor.squareFree(r[0].toSymbol(),t)},powerFactor:function(e,t){if(e.group!==y||e.previousGroup===p)return e;var n=I(e.symbols);if(!Z.Utils.allNumeric(n))return e;var n=Z.Utils.arrayMin(n),r=new Q(0),i=H.parse(e.value+"^"+n);return e.each(function(e){e=H.divide(e,i.clone()),r=H.add(r,e)}),t.add(i),r},coeffFactor:function(e,t){var n,r,i,s;return e.isComposite()&&((n=Z.Math2.QGCD.apply(null,e.coeffs())).equals(1)?((r=function(e){var t;return e.group===L?(t=0,e.each(function(e){t+=e.power})):t=Number(e.power),t})(s=(i=e.collectSymbols(null,null,null,!0).sort(function(e,t){return e.isConstant(!0)?1:t.power-e.power}))[0])>r(i[1])||i[1].isConstant(!0))&&s.multiplier.lessThan(0)&&(t.add(new Q(-1)),e.each(function(e){e.negate()},!0)):(e.each(function(e){e.isComposite()?e.each(function(e){e.multiplier=e.multiplier.divide(n)}):e.multiplier=e.multiplier.divide(n)}),e.updateHash()),t&&t.add(new Q(n))),e},trialAndError:function(e,t,n){var r=e.clone();try{var i=[];if(e.isConstant()||e.group===j)return e;for(var s=new W(e,n),o=s.coeffs[0],a=Z.Math2.ifactor(o),u=R.proots(e),l=0;l<u.length;l++){var c=u[l],p=1;if(!isNaN(c)){for(var f in a){var h=Z.Utils.round(Math.log(f)/Math.log(Math.abs(c)),8);if(_(h)){c=f,p=h;break}}var m=new z(c),g=[new z(m.num).negate()];g[p]=new z(m.den);var d=W.fromArray(g,s.variable).fill(),v=s.divide(d);v[1].equalsNumber(0)&&(s=v[0],i.push(d.toSymbol()))}}return s.equalsNumber(1)||(s=R.Factor.search(s,t)),i.forEach(function(e){t.add(e)}),s.toSymbol()}catch(e){return r}},search:function(i,s,o){o=o||10;function e(e,t,n,r){if((n=W.fit(e,t,n,o,r,a))&&1<n.coeffs.length){r=i.divide(n);if(r[1].equalsNumber(0))return s.add(n.toSymbol()),[r[0],n]}return null}var a=i.variable,t=i.coeffs[0],n=Z.Math2.ifactor(t),r=i.lc(),u=Z.Math2.ifactor(r),l=i.sub(o),c=Z.Math2.ifactor(l),p=R.Factor.mix(c,l<0),f=Math.ceil(i.coeffs.length/2),h=r.lessThan(0),m=t.lessThan(0);for(n[u[1]=1]=1;f--;)for(var g in u)for(var d in n)for(var v=0;v<p.length;v++){var w=e(g,d,p[v],f);if(w)return i=w[0],i=!Z.Utils.isPrime(i.sub(o))?R.Factor.search(i,s):i;w||(h&&m?w=e(-g,-d,p[v],f):h?w=e(-g,d,p[v],f):m&&(w=e(g,-d,p[v],f)))}return i},mSqfrFactor:function(e,t){if(e.group!==C)for(var n=$(e).reverse(),r=0;r<n.length;r++)do{if(n[r]!==e.value){var i=Z.Calculus.diff(e,n[r]),s=R.Factor.coeffFactor(i);if(s.equals(0))break;var o=!0;if(s.isConstant()&&e.isComposite()&&e.each(function(e){e.multiplier%s!=0&&(o=!1)},!0),o){var a=R.div(e,s.clone()),u=a[1].equals(0);if(e.equals(a[0])&&a[1].equals(0))break;if(a[0].isConstant()){t.add(a[0]);break}}else u=!1;u&&(t.add(a[0]),e=s)}else t.add(e),e=new Q(1)}while(u);return e},sqdiff:function(e,t){if(e.isConstant("all"))return e;try{var n,r,i,s,o,a=function(e){return Z.Utils.block("POSITIVE_MULTIPLIERS",function(){return Q.unwrapPARENS(f.sqrt(f.abs(e)))},!0)},u=Z.Utils.separate(e.clone()),l=[];for(n in u)"constants"!==n&&l.push(u[n]);if(l.sort(function(e,t){return t.power-e.power}),2===l.length){if(o=l.pop(),r=l.pop(),U(o.power)&&U(r.power)&&o.sign()===r.sign()&&o.group===j&&r.group===j)throw new Error("Unable to factor");o.isComposite()&&r.power.equals(2)?(r=a(r),(i=R.Factor.factor(H.add(o,u.constants))).power.equals(2)&&(i.toLinear(),t.add(H.subtract(i.clone(),r.clone())),t.add(H.add(i,r)),e=new Q(1))):(o=o.powSimp(),r=r.powSimp(),o.group!==j&&""!==o.fname||!o.power.equals(2)||r.group!==j&&""!==r.fname||!r.power.equals(2)||u.constants||(o.multiplier.lessThan(0)&&(s=r,r=o,o=s),o.multiplier.greaterThan(0)&&(o=a(o),r=a(r)),t.add(H.subtract(o.clone(),r.clone())),t.add(H.add(o,r)),e=new Q(1)))}}catch(e){}return e},mfactor:function(t,e){if(t.group===C){var n,r;"sqrt"===t.fname?(n=new O,r=R.Factor.common(t.args[0].clone(),n),r=R.Factor.coeffFactor(r,n),t=H.multiply(H.symfunction("sqrt",[r]),H.parse(t.multiplier)),n.each(function(e){t=H.multiply(t,H.parse(Z.Utils.format("sqrt({0})",e)))})):e.add(t)}else{t=R.Factor.mSqfrFactor(t,e);for(var i,s=$(t),o=t.collectSymbols().map(function(e){return Q.unwrapSQRT(e)}),a={},u={},l=s.length,c=o.length,p=0;p<l;p++){var f=s[p];a[f]=new Q(0);for(var h=0;h<c;h++){var m,g=o[h];g.contains(f)&&(m=(g.value===f?g:g.symbols[f]).power.toDecimal(),(!u[f]||m<u[f])&&(u[f]=m),a[f]=H.add(a[f],g.clone()))}}for(i in a){var d=H.parse(i+"^"+u[i]),v=H.divide(a[i],d),w=H.expand(v);if(w.equals(1))break;v=R.div(t.clone(),w);if(v[0].equals(0))break;if(v[1].equals(0)){var y=!1;if(v[0].each(function(e){_(e.multiplier)||(y=!0)}),y){v[1]=H.expand(H.multiply(v[1],w));break}}w=_(w)&&w.lessThan(0);if(v[1].equals(0)&&!w){w=R.div(t.clone(),v[0].clone());if((d=w[0]).equals(0))return t;if(t=w[1],d.equals(-1)&&!t.equals(0))return t;w=v[0];if(t.equals(w)){v=R.Factor.reduce(w,e);return t.equals(v)?v:R.Factor.mfactor(v,e)}return(e.add(w),t.equals(0))?d:d.isConstant("all")?(e.add(d),d):R.Factor.mfactor(d,e)}}}return t=R.Factor.sqdiff(t,e),t=R.Factor.zeroes(t,e)}},allLinear:function(e){for(var t=e.length,n=0;n<t;n++)if(!R.isLinear(e[n]))return!1;return!0},isLinear:function(e){var t=!1,n=e.group;if(n===y||n===X)for(var r in t=!0,e.symbols){var i=e.symbols[r],r=i.group;if(r!==C&&r!==p||(t=!1),r===L)t=1===$(i).length;else if(r===y||r===X)t=R.isLinear(i);else if(i.group!==u&&"1"!==i.power.toString()){t=!1;break}}else n===j&&1===e.power&&(t=!0);return t},gcd:function(){var e=1===arguments.length&&arguments[0]instanceof Z.Vector?arguments[0].elements:Z.Utils.arguments2Array(arguments);if(0===e.length)return new Q(1);if(1===e.length)return e[0];for(var t=[],n=!1,r=0;r<e.length;r++)if(e[r].group===C&&"gcd"===e[r].fname)(e=e.concat(arguments[r].args)).splice(r,1);else{var i=$(e[r]);if(Z.Utils.haveIntersection(i,t)){n=!0;break}t=t.concat(i)}if(n||0===t.length){if(e.every(function(e){return e.getDenom().equals(1)})){for(var s=e[0],r=1;r<e.length;r++)s=R.gcd_(e[r],s);return s}return H.divide(R.gcd.apply(null,e.map(function(e){return e.getNum()})),R.lcm.apply(null,e.map(function(e){return e.getDenom()})))}return H.symfunction("gcd",e)},gcd_:function(e,t){if(e.group!==C&&e.group!==c||(e=Z.Utils.block("PARSE2NUMBER",function(){return H.parse(e)})),t.group===C&&(t=Z.Utils.block("PARSE2NUMBER",function(){return H.parse(t)})),e.isConstant()&&t.isConstant())return new Q(Z.Math2.QGCD(new z(+e),new z(+t)));var n=H.multiply(e.getDenom()||new Q(1),t.getDenom()||new Q(1)).invert();if(e=H.multiply(e.clone(),n.clone()),t=H.multiply(t.clone(),n.clone()),e=H.expand(e),t=H.expand(t),e.group===L||t.group===L){var r=H.divide(e.clone(),t.clone());if(!(u=H.multiply(t.clone(),r.getDenom().invert())).equals(1))return u}if(e.group===p||t.group===p){var r=new Q(Z.Math2.GCD(e.multiplier,t.multiplier)),i=R.gcd_(e.value===Y?new Q(1):H.parse(e.value),t.value===Y?new Q(1):H.parse(t.value)),s=R.gcd_(H.parse(e.power),H.parse(t.power));return H.multiply(r,H.pow(i,s))}e.length<t.length&&(u=e,e=t,t=u);i=$(e),s=$(t);if(i.length===s.length&&1===i.length&&i[0]===s[0]||1===i.length&&0===s.length||0===i.length&&1===s.length)return e=new W(e),t=new W(t),H.divide(e.gcd(t).toSymbol(),n);var o,a=[];for(e.each(function(e){a.push(e.multiplier)}),t.each(function(e){a.push(e.multiplier)});!t.equals(0);){var u=t.clone();if(e=e.clone(),o=R.div(e,u),t=o[1],o[0].equals(0))return H.divide(new Q(Z.Math2.QGCD(e.multiplier,t.multiplier)),n);e=u}var l=Z.Math2.QGCD.apply(void 0,a);return l.equals(1)||e.each(function(e){e.multiplier=e.multiplier.divide(l)}),!e.equals(1)||e.isConstant()||t.isConstant()?H.divide(e,n):H.divide(H.symfunction("gcd",arguments),n)},lcm:function(){var e;1===arguments.length?arguments[0]instanceof Z.Vector?e=arguments[0].elements:H.error("lcm expects either 1 vector or 2 or more arguments"):e=Z.Utils.arguments2Array(arguments);var t=e.reduce(function(e,t){return H.multiply(e,t.clone())},new Q(1)),n=function(e,t){t=Number(t);for(var n,r,i=[],s=Math.pow(2,e.length),o=t;o<s;o++){for(n=[],r=e.length-1;0!=(o&1<<r)&&n.push(e[r]),r--;);n.length===t&&i.push(n)}return i}(arguments,arguments.length-1).map(function(e){return e.reduce(function(e,t){return H.multiply(e,t.clone())},new Q(1))}),n=e.every(function(e){return Z.Utils.isVariableSymbol(e)})?H.symfunction("gcd",Z.Utils.arrayUnique(n)):R.gcd.apply(null,n);return H.divide(t,n)},divide:function(e,t){var n=Z.Algebra.Factor.factor(e.clone()),r=n.getDenom();return r.isConstant("all")?r=new Q(1):e=H.expand(Q.unwrapPARENS(H.multiply(n,r.clone()))),e=R.div(e,t),t=H.divide(e[1],t),H.divide(H.add(e[0],t),r)},div:function(e,t){var n,r,i=[new Q(0),e.clone()];try{if(t.isConstant("all"))return e.each(function(e){e.multiplier=e.multiplier.divide(t.multiplier)}),[e,new Q(0)];if(e=H.expand(e),t=H.expand(t),e.group===j&&t.group===X){var s=e.value,o=Z.Utils.decompose_fn(t.clone(),s,!0);if(e.isLinear()&&o.x&&o.x.isLinear()&&t.isLinear()){var a=Q.create(e.multiplier);return[H.divide(a.clone(),o.a.clone()),H.divide(H.multiply(a,o.b),o.a).negate()]}}if(e.group===j&&t.group===j){var u=H.divide(e.clone(),t.clone());return u.isConstant()?[u,new Q(0)]:[new Q(0),e.clone()]}var l,c,p=e.hasFunc(),f=t.hasFunc(),h=!1;(p||f)&&(h=!0,l={},e=H.parse(Z.Utils.subFunctions(e,l)),t=H.parse(Z.Utils.subFunctions(t,l)),c=Z.Utils.getFunctionsSubs(l));var m=Z.Utils.arrayUnique($(e).concat($(t)));if((e.isImaginary()||t.isImaginary())&&m.push(Z.Settings.IMAGINARY),1===m.length)var g=(F=new W(e).divide(new W(t)))[0].toSymbol(),d=F[1].toSymbol();else{m.push(Y);var v=function(e){for(var t=new Q(0),n=0;n<e.length;n++)var r=e[n].toSymbol(),t=H.add(t,r);return t},b=function(e,t){var n,r=Math.max.apply(null,e.terms),i=0;if(!t)for(var s=0;s<e.terms.length;s++)if(e.terms[s].equals(r)&&(n=s,i++),1<i)return;if(t)for(s=0;s<e.terms.length;s++)if(e.terms[s].equals(r)){n=s;break}return[r,n,e]},S=function(e,t){var n=e[t=t||0],r=e.length;if(n){for(var i,s=b(n),o=t+1;o<r;o++){var a=e[o],u=n.sum.equals(a.sum);if(!u&&s)break;if(u){for(var l,c,p,f,h=n.terms.length,m=0;m<h;m++){var g=n.terms[m],d=a.terms[m];void 0!==l&&!g.greaterThan(l)||(l=g,p=m),void 0!==c&&!d.greaterThan(c)||(c=d,f=m)}var v=l.subtract(a.terms[p]),u=c.subtract(n.terms[f]);if(v<u){s=[c,f,a];break}if(u<v){s=[l,p,n];break}}else if(s=b(a))break;s=b(a)}if(!s)return b(e[0],!0);for(o=0;o<E.length;o++){var w,y=E[o].terms;if((w=s[1])===y.length-1)return;if(!(i=y[w]).equals(0))break}return i.equals(0)?S(e,++t):s}},w=Z.Utils.toMapObj(m),y=function(e,t){return t.sum.subtract(e.sum)},M=function(e,t){if(!e||!t)return!1;for(var n=0;n<e.terms.length;n++)if(e.terms[n].lessThan(t.terms[n]))return!1;return!0},N=e.tBase(w).sort(y),E=t.tBase(w).sort(y),q=M(N[0],E[0])&&N[0].count>E[0].count?E:N,x=S(q),A=[];if(x){var C=x[1],L=function(e,t){var n=e.len(),r=t.len(),t=t.terms[C],e=e.terms[C];return n<r&&t.greaterThan(e)?r-n:t.subtract(e)},C=function(e,t){for(var n=[],r=0;r<e.length;r++)for(var i=e[r],s=0;s<i.terms.length;s++){var o=n[s],a=i.terms[s];0===r?n[s]=a:o&&!o.equals(a)&&(n[s]=void 0)}for(r=0;r<n.length;r++)if((i=n[r])&&!i.equals(0))return r;return t}(N,C);N.sort(L),E.sort(L);var I=E[0],U=N[0],_=new J(new z(1),[],U.map);if(I.sum.greaterThan(U.sum)&&1<U.len())for(var O=0;O<U.terms.length;O++){var R=I.terms[O].subtract(U.terms[O]);if(R.equals(0))_.terms[O]=new z(0);else{var T=R.add(new z(1));_.terms[O]=R;for(var P=0;P<N.length;P++)N[P].terms[O]=N[P].terms[O].add(T)}}for(var k=M(N[0],E[0]),D=0;k&&(r=E,!(n=N)[0].sum.equals(r[0].sum)||n.length>=r.length);){if(200<D++)throw new Z.exceptions.InfiniteLoopError("Unable to compute!");var F=N[0].divide(E[0]);A.push(F),N.shift();for(O=1;O<E.length;O++){var B=E[O].multiply(F).generateImage(),G=N.length;0===G&&(B.coeff=B.coeff.neg(),N.push(B),N.sort(L));for(P=0;P<G;P++){var V=N[P];if(V.getImg()===B.getImg()){V.coeff=V.coeff.subtract(B.coeff),V.coeff.equals(0)&&(Z.Utils.remove(N,P),P--);break}P===G-1&&(B.coeff=B.coeff.neg(),N.push(B),N.sort(L))}}if(!(k=M(N[0],E[0]))&&N.length>=E.length)for(O=1;O<N.length;O++)if(k=M(N[O],E[0])){N.unshift(Z.Utils.remove(N,O));break}}}g=v(A),d=v(N),void 0!==_&&(_=_.toSymbol(),g=H.divide(g,_.clone()),d=H.divide(d,_))}return h&&(g=H.parse(g.text(),c),d=H.parse(d.text(),c)),[g,d]}catch(e){return i}},line:function(e,t,n){Z.Utils.isArray(e)&&(e=Z.Utils.convertToVector(e)),Z.Utils.isArray(t)&&(t=Z.Utils.convertToVector(t)),n=H.parse(n||"x"),Z.Utils.isVector(e)&&Z.Utils.isVector(t)||H.error('Line expects a vector! Received "'+e+'" & "'+t+'"');var r=H.subtract(t.e(1).clone(),e.e(1).clone()),t=H.subtract(t.e(2).clone(),e.e(2).clone()),r=H.divide(t,r),n=H.multiply(n,r.clone()),r=H.multiply(e.e(1).clone(),r);return H.add(H.subtract(n,r),e.e(2).clone())},PartFrac:{createTemplate:function(r,e,t,n){(r=R.Factor.factor(r)).each(function(e,t){var n;e.group===C&&""===e.fname&&e.args[0].group===j&&(n=e.args[0],this.symbols?(delete this.symbols[t],this.symbols[n.value]=n):r=e.args[0])});for(var i=e.collectFactors(),s=[],o=[],a=new Q(1),u=0;u<i.length;u++){var l=Q.unwrapPARENS(i[u]);if(l.power.greaterThan(1))for(var c=Number(l.power),p=l.clone().toLinear(),f=Number(R.degree(p,n)),h=0;h<c;h++){var m=H.pow(p.clone(),new Q(h+1));t.push(m.clone());var g=H.divide(r.clone(),m.clone());o.push(f),s.push(g)}else{f=Number(R.degree(l,n)),t.push(l);g=H.divide(r.clone(),l.clone());g=H.expand(Q.unwrapPARENS(g)),o.push(f),s.push(g)}}return[t=t.map(function(e){return H.multiply(e,a.clone())}),s,o]},partfrac:function(t,o,n){var e=$(t);o=o||H.parse(e[0]);try{var a,r,i,u,l,c,s,p,f,h,m,g,d,v,w=H.expand(t.getNum()),y=H.expand(t.getDenom().toUnitMultiplier());if(w.multiplier=t.multiplier,i=w.groupTerms(o),Number(R.degree(w,o))>=Number(R.degree(y,o))?(p=(s=R.div(w.clone(),H.expand(y.clone())))[0],i=(w=s[1]).groupTerms(o)):p=new Q(0),1===Number(R.degree(y,o))){var b=H.divide(w,y);return n?[p,b]:H.add(p,b)}r=R.Factor.factor(y),m=R.PartFrac.createTemplate(y.clone(),r,[],o),g=m[0],f=m[1],u=m[2],c=[i.length],l=[],a=[],h=[],f.map(function(e,t){d=g[t],v=u[t];for(var n=0;n<v;n++){a.push(d.clone());var r=Q.create(o,n),i=H.expand(H.multiply(e,r.clone())).groupTerms(o),s=i.length;c.push(s),l.push(i),h.push(r.clone())}});for(var S=Z.Utils.arrayMax(c),M=new Z.Matrix(Z.Utils.fillHoles(i,S)).transpose(),N=new Z.Matrix,E=0;E<l.length;E++)N.elements.push(Z.Utils.fillHoles(l[E],S));var q=H.multiply(N.transpose().invert(),M),x=n?[p]:p;return q.each(function(e,t){t=H.multiply(h[t],H.divide(e,a[t]));n?x.push(t):x=H.add(x,t)}),x}catch(e){try{if(t.isComposite()){var A={};t.each(function(e){var t=e.getDenom(),n=e.getNum(),e=A[t];A[t]=e?H.add(e,n):n});var C,L=new Q(0);for(C in A)L=H.add(L,H.divide(A[C],H.parse(C)));t=L}}catch(e){}}return t}},degree:function(e,t,n){if(n=n||{nd:[],sd:[],depth:0},!t){var r=$(e);if(1<r.length)throw new Error("You must specify the variable for multivariate polynomials!");if(0===r.length)return new Q(0);t=H.parse(r[0])}r=e.group;e.isComposite()?((e=e.clone()).distributeExponent(),e.each(function(e){n.depth++,R.degree(e,t,n),n.depth--})):e.group===L?e.each(function(e){n.depth++,R.degree(e,t,n),n.depth++}):r===p&&e.value===t.value?n.sd.push(e.power.clone()):r===j&&e.value===t.value?n.nd.push(H.parse(e.power)):n.nd.push(new Q(0));e=0<n.nd.length?Z.Utils.arrayMax(n.nd):void 0;return 0===n.depth&&0<n.sd.length?(void 0!==e&&n.sd.unshift(e),H.symfunction("max",n.sd)):Z.Utils.isSymbol(e)?e:H.parse(e)},sqComplete:function(e,t,n){Z.Utils.isSymbol(t)||(t=H.parse(t));var r,i,s,o,a,u=function(e){throw new Z.exceptions.ValueLimitExceededError(e=e||"Stopping")};return e.isPoly(!0)||u("Must be a polynomial!"),o=Z.Utils.inBrackets,e=e.clone(),(r=Z.Algebra.degree(e,t)).equals(2)||u("Cannot complete square for degree "+r),a=(s=Z.Algebra.coeffs(e,t))[2],u=s[1].sign(),r=H.divide(s[1],new Q(2)),e=H.pow(r.clone(),new Q(2)),n?[a,r,i]:(a=f.sqrt(a),e=H.divide(f.sqrt(e),a.clone()),i=H.subtract(s[0],H.pow(e.clone(),new Q(2))),{a:e=H.parse(o(a.clone()+"*"+t+(u<0?"-":"+")+e)),c:i,f:H.add(H.pow(e.clone(),new Q(2)),i.clone())})},Simplify:{strip:function(e){var t=H.parse(e.multiplier);e.toUnitMultiplier();var n=H.parse(e.power);return e.toLinear(),[t,n,e]},unstrip:function(e,t){var n=e[0],e=e[1];return H.multiply(n,H.pow(t,e))},complexSimp:function(e,t){var n=e.realpart(),r=e.imagpart(),i=t.realpart(),s=t.imagpart(),e=H.multiply(n.clone(),i.clone()),t=H.multiply(r.clone(),s.clone()),r=H.multiply(i.clone(),r),n=H.multiply(n,s.clone()),s=H.add(H.pow(i,new Q(2)),H.pow(s,new Q(2)));return H.divide(H.add(H.add(e,t),H.multiply(H.subtract(r,n),Q.imaginary())),s)},trigSimp:function(e){var t,n,r,i,s,o;return e.containsFunction(["cos","sin","tan"])&&(e=e.clone(),n=(e=(t=R.Simplify.strip(e)).pop()).clone(),e.group===X?(r=new Q(0),e.each(function(e){e=R.Simplify.trigSimp(e.fnTransform());r=H.add(r,e)},!0),n=H.pow(H.multiply(new Q(e.multiplier),r),new Q(e.power))):e.group===L&&(i=e.getNum(),s=e.getDenom(),(n="sin"===i.fname&&"cos"===s.fname&&i.args[0].equals(s.args[0])&&i.power.equals(s.power)?H.parse(Z.Utils.format("({0})*({1})*tan({2})^({3})",s.multiplier,i.multiplier,i.args[0],i.power)):n).group===L&&(o=new Q(1),n.each(function(e){"tan"===e.fname&&(e=H.parse(Z.Utils.format("({0})*sin({1})^({2})/cos({1})^({2})",e.multiplier,R.Simplify.simplify(e.args[0]),e.power))),o=H.multiply(o,e)}),n=o)),e=n=R.Simplify.unstrip(t,n).distributeMultiplier()),e},fracSimp:function(e){var t=e.getDenom();if((e=(a=e.getNum()).isImaginary()&&t.isImaginary()?R.Simplify.complexSimp(a,t):e).isComposite()){for(var n,r,i,s,o,a,u=(e=1<e.power?H.expand(e):e).collectSymbols(),l=u.pop();u.length;)o=u.pop(),s=H.parse(l.getDenom()),i=H.parse(o.getDenom()),n=l.getNum(),r=o.getNum(),o=H.multiply(s.clone(),i.clone()),i=H.multiply(n,i),s=H.multiply(r,s),s=H.add(i,s),l=H.divide(s,o);return t=H.expand(l.getDenom()),(t=(a=H.expand(l.getNum())).isImaginary()&&t.isImaginary()?R.Simplify.complexSimp(a,t):H.divide(a,t)).equals(e)?e:R.Simplify.simplify(t)}return e},ratSimp:function(e){var t,n;return e.group===L&&(t=e.getDenom(),n=e.getNum().distributeMultiplier(),t=R.Simplify.fracSimp(t),n=R.Simplify.fracSimp(n),e=H.divide(n,t)),e},sqrtSimp:function(e,t){if(e.isSQRT()){var n,r,i=R.Factor.factor(e.args[0].clone()),s=H.parse(i.multiplier),o=s.sign(),a=H.sqrt(s.abs());if(_(a))return i.group===L?(n=new Q(1),i.each(function(e){var t;e.group===u?(t=H.sqrt(e.clone()),_(t)?a=H.multiply(a,t):n=H.multiply(n,e)):n=H.multiply(n,e)}),o=H.multiply(n,H.parse(o)),(r=H.sqrt(o.clone())).isImaginary&&(r=H.sqrt(H.expand(o.clone())))):r=H.sqrt(i.clone().toUnitMultiplier()),H.multiply(a,r)}else e.isComposite()&&e.isLinear()?(a=new Q(0),e.each(function(e){a=H.add(a,R.Simplify.sqrtSimp(e))},!0),a=H.multiply(a,H.parse(e.multiplier))):e.group===L&&(a=H.parse(e.multiplier),e.each(function(e){e=R.Simplify.sqrtSimp(e);a=H.multiply(a,e)},!0),a=H.pow(a,H.parse(e.power)));return a||H.parse(e)},patternSub:function(n){var r={},i=function(e){var t=!1;return e.each(function(e){e.group===X?t=!0:e.symbols&&(t=i(e))}),t},s=function(e){e.each(function(e){var t;!e.symbols&&e.group!==C||(i(e)?s(e):r[e.value]||(t=Z.Utils.getU(n),r[e.value]=t,n=n.sub(e.value,t)))},!0)};return s(n),[n,r]},simplify:function(e){var t=R.Simplify.strip(e);if(e=t.pop(),(e=R.Simplify.fracSimp(e)).isConstant()||e.group===Z.groups.S)return t.push(e),R.Simplify.unstrip(t,e);var n,r=e.clone(),r=R.Simplify.trigSimp(r);return r=R.Simplify.ratSimp(r),(r=R.Factor.factor(r)).group===Z.groups.CP&&r.isLinear()&&(e=r.multiplier.clone(),r.toUnitMultiplier(),n=new Q(0),r.each(function(e){e=R.Simplify.simplify(e);n=H.add(n,e)}),(r=n).multiplier=n.multiplier.multiply(e)),R.Simplify.unstrip(t,r)}},Classes:{Polynomial:W,Factors:O,MVTerm:J}};Z.Expression.prototype.simplify=function(){return R.Simplify.simplify(this.symbol)},nerdamer.useAlgebraDiv=function(){var n=R.divideFn=H.divide,r=0;H.divide=function(e,t){t=1===++r?Z.Algebra.divide(e,t):n(e,t);return r=0,t}},nerdamer.useParserDiv=function(){R.divideFn&&(H.divide=R.divideFn),delete R.divideFn},nerdamer.register([{name:"factor",visible:!0,numargs:1,build:function(){return R.Factor.factor}},{name:"simplify",visible:!0,numargs:1,build:function(){return R.Simplify.simplify}},{name:"gcd",visible:!0,numargs:[1],build:function(){return R.gcd}},{name:"lcm",visible:!0,numargs:[1],build:function(){return R.lcm}},{name:"roots",visible:!0,numargs:-1,build:function(){return R.roots}},{name:"divide",visible:!0,numargs:2,build:function(){return R.divide}},{name:"div",visible:!0,numargs:2,build:function(){return R.div}},{name:"partfrac",visible:!0,numargs:[1,2],build:function(){return R.PartFrac.partfrac}},{name:"deg",visible:!0,numargs:[1,2],build:function(){return R.degree}},{name:"coeffs",visible:!0,numargs:[1,2],build:function(){return function(){var e=R.coeffs.apply(R,arguments);return new Z.Vector(e)}}},{name:"line",visible:!0,numargs:[2,3],build:function(){return R.line}},{name:"sqcomp",visible:!0,numargs:[1,2],build:function(){return function(t,e){try{return e=e||$(t)[0],R.sqComplete(t.clone(),e).f}catch(e){return t}}}}]),nerdamer.updateAPI()}(),"undefined"!=typeof module&&void 0===nerdamer&&(nerdamer=require("./nerdamer.core.js"),require("./Algebra.js")),function(){"use strict";var ct=nerdamer.getCore(),pt=ct.PARSER,ft=ct.Frac,ht=ct.Settings,mt=ct.Utils.isSymbol,gt=ct.groups.FN,dt=ct.Symbol,m=ct.Utils.text,vt=ct.Utils.inBrackets,wt=ct.Utils.isInt,yt=ct.Utils.format,bt=ct.Utils.even,k=ct.Utils.evaluate,g=ct.groups.N,St=ct.groups.S,gt=ct.groups.FN,Mt=ct.groups.PL,Nt=ct.groups.CP,Et=ct.groups.CB,qt=ct.groups.EX,d=ct.groups.P,xt=ht.LOG,At="sqrt",Ct="sin",Lt="cos",It="tan",Ut="sec",_t="csc",Ot="cot",Rt="asin",Tt="atan",Pt="sinh",kt="cosh",Dt="tanh";function Ft(e){this.message=e||""}Ft.prototype=new Error,dt.prototype.hasIntegral=function(){return this.containsFunction("integrate")},dt.prototype.fnTransform=function(){if(this.group!==gt)return this;var e,t,n,r=this.args[0],i=new dt(this.multiplier),s=this.clone().toUnitMultiplier();if(this.isLinear())switch(this.fname){case Pt:n=pt.parse(yt("(e^({0})-e^(-({0})))/2",r));break;case kt:n=pt.parse(yt("(e^({0})+e^(-({0})))/2",r));break;case Dt:n=pt.parse(yt("(e^({0})-e^(-({0})))/(e^({0})+e^(-({0})))",r));break;case It:n=pt.parse(yt("sin({0})/cos({0})",r));break;case _t:n=pt.parse(yt("1/sin({0})",r));break;case Ut:n=pt.parse(yt("1/cos({0})",r));break;default:n=s}else if(this.power.equals(2))switch(this.fname){case Ct:n=pt.parse(yt("1/2-cos(2*({0}))/2",r));break;case Lt:n=pt.parse(yt("1/2+cos(2*({0}))/2",r));break;case It:n=pt.parse(yt("sin({0})^2/cos({0})^2",r));break;case kt:n=pt.parse(yt("1/2+cosh(2*({0}))/2",r));break;case Pt:n=pt.parse(yt("-1/2+cosh(2*({0}))/2",r));break;case Dt:n=pt.parse(yt("(1+cosh(2*({0})))/(-1+cosh(2*({0})))",r));break;case Ut:n=pt.parse(yt("(1-cos(2*({0})))/(1+cos(2*({0})))+1",r));break;default:n=s}else this.fname===Ut?n=pt.parse(yt("1/cos({0})^({1})",this.args[0],this.power)):this.fname===_t?n=pt.parse(yt("1/sin({0})^({1})",this.args[0],this.power)):this.fname===It?n=this.power.lessThan(0)?pt.parse(yt("cos({0})^(-({1}))/sin({0})^({1})",this.args[0],this.power.negate())):pt.parse(yt("sin({0})^({1})/cos({0})^({1})",this.args[0],this.power)):this.fname===Ct&&this.power.lessThan(0)?n=pt.parse(yt("csc({0})^(-({1}))",this.args[0],this.power.negate())):this.fname===Lt&&this.power.lessThan(0)?n=pt.parse(yt("sec({0})^(-({1}))",this.args[0],this.power.negate())):this.fname===Ct&&this.power.equals(3)?n=pt.parse(yt("(3*sin({0})-sin(3*({0})))/4",this.args[0])):this.fname===Lt&&this.power.equals(3)?n=pt.parse(yt("(cos(3*({0}))+3*cos({0}))/4",this.args[0])):this.fname!==Lt&&this.fname!==Ct||!bt(this.power)?n=s:(t=this.power/2,e=pt.pow(this.clone().toLinear(),pt.parse(2)).fnTransform(),t=pt.expand(pt.pow(e,pt.parse(t))),n=new dt(0),t.each(function(e){e=e.fnTransform();n=pt.add(n,e)},!0));return pt.multiply(n,i)},dt.prototype.hasTrig=function(){if(this.isConstant(!0)||this.group===St)return!1;if(this.fname&&(ct.Utils.in_trig(this.fname)||ct.Utils.in_inverse_trig(this.fname)))return!0;if(this.symbols)for(var e in this.symbols)if(this.symbols[e].hasTrig())return!0;return!1},ct.Expression.prototype.hasIntegral=function(){return this.symbol.hasIntegral()},ct.Utils.toCommonDenominator=function(e){if(e.isComposite()&&e.isLinear()){var t=new dt(e.multiplier),n=new dt(1),r=new dt(0);return e.each(function(e){n=pt.multiply(n,e.getDenom())},!0),e.each(function(e){var t=e.getNum(),e=e.getDenom(),e=pt.multiply(t,pt.divide(n.clone(),e));r=pt.add(r,e)}),pt.multiply(t,ct.Algebra.divide(pt.expand(r),pt.expand(n)))}return e},ct.Utils.in_inverse_trig=function(e){return-1!==[Rt,"acos",Tt,"acsc","asec","acot"].indexOf(e)},ct.Utils.in_trig=function(e){return-1!==[Lt,Ct,It,Ut,_t,Ot].indexOf(e)},ct.Utils.in_htrig=function(e){return-1!==[Pt,kt,Dt,"acsch","asech","acoth"].indexOf(e)},ct.Matrix.jacobian=function(e,t){var i=new ct.Matrix;return(t=t||ct.Utils.arrayGetVariables(e)).forEach(function(n,r){e.forEach(function(e,t){e=ct.Calculus.diff(e.clone(),n);i.set(t,r,e)})}),i},ct.Matrix.prototype.max=function(){var t=new dt(0);return this.each(function(e){e=e.abs();e.gt(t)&&(t=e)}),t},ct.Matrix.cMatrix=function(n,e){var r=new ct.Matrix;return e.forEach(function(e,t){r.set(t,0,pt.parse(n))}),r};var Bt=ct.Utils.all_functions=function(e){for(var t=0,n=e.length;t<n;t++)if(e[t].group!==gt)return!1;return!0},l=ct.Utils.cosAsinBtranform=function(e,t){e=e.args[0],t=t.args[0];return pt.parse(yt("(sin(({0})+({1}))-sin(({0})-({1})))/2",e,t))},c=ct.Utils.cosAsinAtranform=function(e,t){if(1!==Number(t.power))return pt.multiply(e,t);e=e.args[0];return pt.parse(yt("(sin(2*({0})))/2",e))},p=ct.Utils.cosAsinBtranform=function(e,t){e=e.args[0],t=t.args[0];return pt.parse(yt("(cos(({0})+({1}))-cos(({0})-({1})))/2",e,t))},Gt=ct.Utils.trigTransform=function(e){for(var t,n,r,i,s={},o=new dt(1),a=0,u=e.length;a<u;a++)(r=e[a]).group===gt?(n=r.fname)===Lt&&s.sin?(t=(s.sin.args[0].toString()!==r.args[0].toString()?l:c)(r,s.sin),delete s.sin,o=pt.multiply(o,t)):n===Ct&&s.cos?(t=(s.cos.args[0].toString()!==r.args[0].toString()?l:c)(r,s.cos),delete s.cos,o=pt.multiply(o,t)):n===Ct&&s.sin?(t=s.sin.args[0].toString()!==r.args[0].toString()?p(r,s.sin):pt.multiply(r,s.sin),delete s.sin,o=t):s[n]=r:o=pt.multiply(o,r);for(i in s)o=pt.multiply(o,s[i]);return o};ct.Settings.integration_depth=10,ct.Settings.max_lim_depth=10;var Vt=ct.Calculus={version:"1.4.6",sum:function(s,o,a,u){if(o.group!==ct.groups.S)throw new ct.exceptions.NerdamerTypeError("Index must be symbol. "+m(o)+" provided");var e;return o=o.value,ct.Utils.isNumericSymbol(a)&&ct.Utils.isNumericSymbol(u)?(e=u-a<200?"":"PARSE2NUMBER",a=Number(a),u=Number(u),ct.Utils.block(e,function(){for(var e=s.text(),t={"~":!0},n=new ct.Symbol(0),r=a;r<=u;r++){t[o]=new dt(r);var i=pt.parse(e,t),n=pt.add(n,i)}return n})):pt.symfunction("sum",arguments)},product:function(i,s,o,a){if(s.group!==ct.groups.S)throw new ct.exceptions.NerdamerTypeError("Index must be symbol. "+m(s)+" provided");return s=s.value,ct.Utils.isNumericSymbol(o)&&ct.Utils.isNumericSymbol(a)?ct.Utils.block(a-o<200?"":"PARSE2NUMBER",function(){o=Number(o),a=Number(a.multiplier);for(var e=i.text(),t={},n=new ct.Symbol(1),r=o;r<=a;r++)t[s]=new dt(r),n=pt.multiply(n,pt.parse(e,t));return n}):pt.symfunction("product",arguments)},diff:function(e,l,r){if(ct.Utils.isVector(e)){var t=new ct.Vector([]);return e.each(function(e){t.elements.push(Vt.diff(e,l,r))}),t}if(ct.Utils.isMatrix(e)){var i=new ct.Matrix;return e.each(function(e,t,n){i.set(t,n,Vt.diff(e,l,r))}),i}var n,s,c=mt(l)?l.text():l;return r=mt(r)?r.multiplier:r||1,void 0===c&&(c=ct.Utils.variables(e)[0]),e.group===gt&&e.fname===At&&(s=e.args[0],n=e.power.clone(),s.group===g&&s.group===d||(s.power=mt(s.power)?pt.multiply(s.power,pt.multiply(new dt(.5)),n):s.power.multiply(new ft(.5)).multiply(n),s.multiplier=s.multiplier.multiply(e.multiplier)),e=s),e=e.group!==gt||mt(e.power)?f(e):(n=f(pt.parse(e)),s=Vt.diff(e.args[0].clone(),c),pt.multiply(n,s)),e=1<r?Vt.diff(e,l,--r):e;function p(e){return e.value!==c&&!e.contains(c,!0)||(e.multiplier=e.multiplier.multiply(e.power),e.power=e.power.subtract(new ft(1)),e.power.equals(0)&&(e=dt(e.multiplier))),e}function f(e){var t=e.group;if(t===g||t===St&&e.value!==c||t===d)e=dt(0);else if(t===St)e=p(e);else{if(t===Et){var n=e.multiplier.clone();e.toUnitMultiplier();var r=pt.multiply(function(e){for(var t=e.collectSymbols(),n=new dt(0),r=t.length,i=0;i<r;i++){for(var s=Vt.diff(t[i].clone(),c),o=0;o<r;o++)i!==o&&(s=pt.multiply(s,t[o].clone()));n=pt.add(n,s)}return n}(e),p(e));return r.multiplier=r.multiplier.multiply(n),r}if(t===gt&&e.power.equals(1))switch(e.fname){case xt:s=e.clone(),(e=e.args[0].clone()).power=e.power.negate(),e.multiplier=s.multiplier.divide(e.multiplier);break;case Lt:e.fname=Ct,e.multiplier.negate();break;case Ct:e.fname=Lt;break;case It:e.fname=Ut,e.power=new ft(2);break;case Ut:e=h(e,It);break;case _t:e=h(e,"-cot");break;case Ot:e.fname=_t,e.multiplier.negate(),e.power=new ft(2);break;case Rt:e=pt.parse("(sqrt(1-("+m(e.args[0])+")^2))^(-1)");break;case"acos":e=pt.parse("-(sqrt(1-("+m(e.args[0])+")^2))^(-1)");break;case Tt:e=pt.parse("(1+("+m(e.args[0])+")^2)^(-1)");break;case"abs":n=e.multiplier.clone(),e.toUnitMultiplier(),(o=e.args[0].clone()).toUnitMultiplier(),(e=pt.parse(vt(m(e.args[0]))+"/abs"+vt(m(o)))).multiplier=n;break;case"parens":e=dt(1);break;case"cosh":e.fname="sinh";break;case"sinh":e.fname="cosh";break;case Dt:e.fname="sech",e.power=new ft(2);break;case"sech":e=h(e,"-tanh");break;case"csch":var i=String(e.args[0]);return pt.parse("-coth("+i+")*csch("+i+")");case"coth":i=String(e.args[0]);return pt.parse("-csch("+i+")^2");case"asinh":e=pt.parse("(sqrt(1+("+m(e.args[0])+")^2))^(-1)");break;case"acosh":e=pt.parse("(sqrt(-1+("+m(e.args[0])+")^2))^(-1)");break;case"atanh":e=pt.parse("(1-("+m(e.args[0])+")^2)^(-1)");break;case"asech":i=String(e.args[0]);e=pt.parse("-1/(sqrt(1/("+i+")^2-1)*("+i+")^2)");break;case"acoth":e=pt.parse("-1/(("+e.args[0]+")^2-1)");break;case"acsch":i=String(e.args[0]);e=pt.parse("-1/(sqrt(1/("+i+")^2+1)*("+i+")^2)");break;case"asec":i=String(e.args[0]);e=pt.parse("1/(sqrt(1-1/("+i+")^2)*("+i+")^2)");break;case"acsc":i=String(e.args[0]);e=pt.parse("-1/(sqrt(1-1/("+i+")^2)*("+i+")^2)");break;case"acot":e=pt.parse("-1/(("+e.args[0]+")^2+1)");break;case"S":i=String(e.args[0]);e=pt.parse("sin((pi*("+i+")^2)/2)");break;case"C":i=String(e.args[0]);e=pt.parse("cos((pi*("+i+")^2)/2)");break;case"Si":i=e.args[0];e=pt.parse("sin("+i+")/("+i+")");break;case"Shi":i=e.args[0];e=pt.parse("sinh("+i+")/("+i+")");break;case"Ci":i=e.args[0];e=pt.parse("cos("+i+")/("+i+")");break;case"Chi":i=e.args[0];e=pt.parse("cosh("+i+")/("+i+")");break;case"Ei":i=e.args[0];e=pt.parse("e^("+i+")/("+i+")");break;case"Li":i=e.args[0];e=pt.parse("1/"+ht.LOG+"("+i+")");break;case"erf":e=pt.parse("(2*e^(-("+e.args[0]+")^2))/sqrt(pi)");break;case"atan2":var s=String(e.args[0]),i=String(e.args[1]);e=pt.parse("("+i+")/(("+i+")^2+("+s+")^2)");break;case"sign":e=new dt(0);break;case"sinc":e=pt.parse(yt("(({0})*cos({0})-sin({0}))*({0})^(-2)",e.args[0]));break;case ht.LOG10:e=pt.parse("1/(("+e.args[0]+")*"+ht.LOG+"(10))");break;default:e=pt.symfunction("diff",[e,l])}else if(t===qt||t===gt&&mt(e.power)){var r=t===qt?e.value:t===gt&&e.contains(c)?e.fname+vt(m(e.args[0])):e.value+vt(m(e.args[0])),o=(pt.multiply(pt.parse(xt+vt(r)),e.power.clone()),Vt.diff(pt.multiply(pt.parse(xt+vt(r)),e.power.clone()),c));e=pt.multiply(e,o)}else if(t!==gt||e.power.equals(1)){if(t===Nt||t===Mt){var a,t=e.clone(),u=new dt(0);for(a in e.symbols)u=pt.add(u,Vt.diff(e.symbols[a].clone(),c));e=pt.multiply(p(t),u)}}else(o=e.clone()).toLinear(),o.toUnitMultiplier(),e=pt.multiply(p(e.clone()),f(o))}return e.updateHash(),e}function h(e,t,n){return pt.multiply(e,pt.parse(t+vt(n||m(e.args[0]))))}},integration:{u_substitution:function(e,i){function t(e,t,n){var r=Vt.diff(t,i),r=n?n(e,t):pt.divide(e.clone(),r);return r.contains(i,!0)?null:r}function n(e,t){e=Vt.integrate(pt.symfunction(e,[new dt(u)]),u,0);return(e=e.sub(new dt(u),t)).updateHash(),e}var r,s=e[0].clone(),o=e[1].clone(),a=s.group,e=o.group,u="__u__";if(a===gt&&e!==gt)return(r=t(o,(c=s.args[0]).clone()))?pt.multiply(r,n(s.fname,c)):(r=t(o,s))?Vt.integration.poly_integrate(s):void 0;if(e===gt&&a!==gt){if(r=t(s,(c=o.args[0]).clone()))return pt.multiply(r,n(o.fname,c))}else{if(a===gt&&e===gt)return(r=t(s.clone(),o.clone()))||(r=t(o.clone(),s.clone()))?pt.multiply(Vt.integration.poly_integrate(o),r):void 0;if(a===qt&&e!==qt){if(!(r=t(o,(p=s.power).clone()))){var l=Vt.integration.decompose_arg(p.clone(),i),c=Vt.diff(l[2].clone(),i),c=Vt.integration.decompose_arg(c.clone(),i);if(pt.multiply(l[1],c[1]).power.equals(o.power)){c=pt.divide(l[0].clone(),c[0].clone()),c=pt.multiply(c.clone(),pt.pow(new dt(s.value),pt.multiply(l[0],new dt(u)))),c=pt.multiply(c,new dt(u));return Vt.integration.by_parts(c,u,0,{}).sub(u,l[1].clone())}}l=Vt.integrate(s.sub(p.clone(),new dt(u)),u,0);return pt.multiply(l.sub(new dt(u),p),r)}if(e===qt&&a!==qt){r=t(s,(p=o.power).clone());l=Vt.integrate(o.sub(p,new dt(u)),u,0);return pt.multiply(l.sub(new dt(u),p),r)}if(s.isComposite()||o.isComposite()){var a=function(e,t){t=Vt.diff(t,i),e=ct.Algebra.Factor.factor(e),t=ct.Algebra.Factor.factor(t);return pt.divide(e,t)},l=s.isComposite()?s.clone().toLinear():s.clone(),p=o.isComposite()?o.clone().toLinear():o.clone();return(r=t(l.clone(),p.clone(),a))?pt.multiply(Vt.integration.poly_integrate(o),r):(r=t(p.clone(),l.clone(),a))?pt.multiply(Vt.integration.poly_integrate(s),r):void 0}}},poly_integrate:function(e){var t=e.power.toString(),n=e.multiplier.toDecimal(),e=e.toUnitMultiplier().toLinear();return-1===Number(t)?pt.multiply(new dt(n),pt.symfunction(xt,[e])):pt.parse(yt("({0})*({1})^(({2})+1)/(({2})+1)",n,e,t))},stop:function(e){throw ct.Utils.warn(e=e||"Unable to compute integral!"),new Ft(e)},partial_fraction:function(e,t,n,r){var i;return mt(t)||(t=pt.parse(t)),i=new dt(0),(e=ct.Algebra.PartFrac.partfrac(e,t)).group===Et&&e.isLinear()?(e.each(function(e){e.isLinear()||Vt.integration.stop()}),e.each(function(e){i=pt.add(i,Vt.integrate(e,t,n,r))})):i=pt.add(i,Vt.integrate(e,t,n,r)),i},get_udv:function(e){function t(e){var t,n=e.group;n===gt?(t=e.fname,ct.Utils.in_trig(t)||ct.Utils.in_htrig(t)?r[3].push(e):ct.Utils.in_inverse_trig(t)?r[1].push(e):t===xt?r[0].push(e):Vt.integration.stop()):n===St||e.isComposite()&&e.isLinear()||n===Et&&e.isLinear()?r[2].push(e):n===qt||e.isComposite()&&!e.isLinear()?r[4].push(e):Vt.integration.stop()}var r=[[],[],[],[],[]];e.group===Et?e.each(function(e){t(dt.unwrapSQRT(e,!0))}):t(e);for(var n,i=new dt(1),s=0;s<5;s++){var o=r[s],a=o.length;if(0<a){if(1<a)for(var u=new dt(1),l=0;l<a;l++)u=pt.multiply(u,o[l].clone());else u=o[0].clone();n?i=pt.multiply(i,u):(n=u).multiplier=n.multiplier.multiply(e.multiplier)}}return[n,i]},trig_sub:function(e,t,n,r,i,s){(i=i||Vt.integration.decompose_arg(e.clone().toLinear(),t))[3],i[2];var o=i[0],a=i[1];if(a.power.equals(2)&&o.greaterThan(0)){t=ct.Utils.getU(e),i=pt.parse(It+vt(t)),o=pt.parse(Ut+vt(t)+"^2"),o=pt.multiply(e.sub(a,i),o),a=Vt.integrate(o,t,n,r).sub(i,a);return ct.Utils.clearU(i),a}},by_parts:function(e,t,n,r){var i,s,o,a,u,l;return r.previous=r.previous||[],o=(s=Vt.integration.get_udv(e))[0],i=s[1],u=(a=dt.unwrapSQRT(pt.expand(Vt.diff(o.clone(),t)),!0)).clone().stripVar(t),a=pt.divide(a,u.clone()),e=Vt.integrate(i.clone(),t,n||0),a=(s=pt.multiply(e.clone(),a)).toString(),-1!==r.previous.indexOf(a)&&ct.Utils.in_trig(o.fname)&&i.isE()?(r.is_cyclic=!0,new dt(1)):(r.previous.push(a),o=pt.multiply(o,e),e=s.multiplier.clone(),s.toUnitMultiplier(),(u=pt.multiply(Vt.integrate(s.clone(),t,n,r),u)).multiplier=u.multiplier.multiply(e),u=pt.subtract(o,u),r.is_cyclic&&(r.previous.pop(),0===r.previous.length&&(u=pt.expand(u),l=new dt(0),u.each(function(e){e.contains(t)||(l=pt.add(l,e.clone()))}),u=pt.divide(pt.subtract(u,l.clone()),pt.subtract(new dt(1),l)))),u)},decompose_arg:ct.Utils.decompose_fn},integrate:function(ot,at,ut,lt){var e;if(at||(e=ct.Utils.variables(ot),at=(at=1===e.length?e[0]:at)||"x"),ct.Utils.isVector(ot)){var t=new ct.Vector([]);return ot.each(function(e){t.elements.push(Vt.integrate(e,at))}),t}return isNaN(at)||pt.error("variable expected but received "+at),ot.isConstant(!0)?pt.multiply(ot.clone(),pt.parse(at)):(lt=lt||{},ct.Utils.block("PARSE2NUMBER",function(){ut=ut||0;var t,n=mt(at)?at.toString():at,e=(ce=dt.unwrapSQRT(ot.clone(),!0)).group;try{if(++ut>ct.Settings.integration_depth&&Vt.integration.stop("Maximum depth reached. Exiting!"),ce.contains(n,!0)){if(e===St)t=Vt.integration.poly_integrate(ce,n,ut);else if(e===qt)if(ce.previousGroup===gt&&"sqrt"!==ce.fname&&ce.fname!==ht.PARENTHESIS&&Vt.integration.stop(),ce.contains(n)&&ce.previousGroup!==gt)ce.power.contains(n)?Vt.integration.stop():((We=Vt.diff(ce.clone().toLinear(),n)).contains(n)&&Vt.integration.stop(),t=Vt.integration.poly_integrate(ce,n,ut));else{if((f=Vt.diff(ce.power.clone(),n)).contains(n)){var r=f.stripVar(n);if((h=pt.divide(f.clone(),r.clone())).group===St&&h.isLinear())return r.multiplier=r.multiplier.divide(new ft(2)),pt.parse(yt("({2})*(sqrt(pi)*erf(sqrt(-{0})*{1}))/(2*sqrt(-{0}))",r,n,ce.multiplier));Vt.integration.stop()}ce.isE()?f.isLinear()?t=ce:f.isE()&&f.power.group===St&&f.power.power.equals(1)?t=pt.multiply(pt.symfunction("Ei",[ce.power.clone()]),ce.power):Vt.integration.stop():(g=pt.symfunction(xt,[pt.parse(ce.value)]),t=pt.divide(ce,g)),t=pt.divide(t,f)}else if(ce.isComposite()&&ce.isLinear()){var i=pt.parse(ce.multiplier);ce.toUnitMultiplier(),t=new dt(0),ce.each(function(e){t=pt.add(t,Vt.integrate(e,n,ut))}),t=pt.multiply(i,t)}else if(e===Nt)if((ce=ce.power.greaterThan(1)?pt.expand(ce):ce).power.equals(1))t=new dt(0),ce.each(function(e){t=pt.add(t,Vt.integrate(e,n,ut))},!0);else{var s=Number(ce.power),i=ce.multiplier.clone();ce.toUnitMultiplier();var o,a,u,l=ce.clone().toLinear(),c=(Ve=Vt.integration.decompose_arg(l,n))[3],p=Ve[2],f=Ve[0],h=Ve[1];if(-1===s&&h.group!==Mt&&h.power.equals(2)){var m,g,d,v,w,y,b,S,M,N,E,q=!wt(c)||0<c;t=h.group===St&&h.power.equals(2)&&q?(m=function(e){var t=new dt(1);return e.each(function(e){t=pt.multiply(t,"abs"===e.fname?e.args[0]:e)}),t},d=f.clone(),v=c.clone(),d=pt.pow(d,new dt(.5)),v=pt.pow(v,new dt(.5)),g=pt.multiply(m(v),m(d)),R=pt.symfunction(Tt,[pt.divide(pt.multiply(f,h.toLinear()),g.clone())]),pt.divide(R,g)):h.group===St&&h.isLinear()?pt.divide(Vt.integration.poly_integrate(ce),f):h.power.equals(4)?(E=vt,d=pt.parse(At+E(f)+"*"+n+"^2"),v=pt.parse(At+E(2)+"*"+E(f)+"^"+E("1/4")+"*"+E(c)+"^"+E("1/4")+"*"+n),w=pt.parse(At+E(c)),P=pt.add(pt.add(d.clone(),v.clone()),w.clone()),X=pt.add(pt.subtract(d,v),w),y=pt.parse(At+E(2)+"*"+E(c)+"^"+E("3/4")),b=pt.parse(At+E(c)+"*"+E(c)+"^"+E("1/4")+"*"+n),S=pt.parse("2*"+E(c)+"*"+At+E(2)+"*"+E(c)+"^"+E("1/4")),M=pt.divide(pt.subtract(y.clone(),b.clone()),pt.multiply(S.clone(),X)),N=pt.divide(pt.add(y,b),pt.multiply(S,P.clone())),pt.add(Vt.integrate(M,n,ut,lt),Vt.integrate(N,n,ut,lt))):Vt.integration.partial_fraction(ce,n,ut)}else if(-.5===s)h.group===St&&h.power.equals(2)&&p.multiplier.lessThan(0)&&!c.multiplier.lessThan(0)?(f.negate(),t=c.isConstant()&&f.isConstant()?(g=pt.symfunction(At,[f.clone()]),o=pt.symfunction(At,[pt.multiply(f.clone(),c)]),pt.divide(pt.symfunction(Rt,[pt.divide(p.toLinear(),o)]),g)):(a=pt.symfunction(At,[f]),u=pt.multiply(a.clone(),h.clone().toLinear()),pt.divide(pt.symfunction(Tt,[pt.divide(u,pt.symfunction(At,[l.clone()]))]),a))):Vt.integration.stop();else if(.5===s&&h.power.equals(2)&&f.greaterThan(0))Vt.integration.stop();else if(h.isLinear()&&h.group!==Mt)t=pt.divide(Vt.integration.poly_integrate(ce),f);else{if(h.power.equals(2)&&f.greaterThan(0)){var x=pt.parse(At+vt(f)),A=pt.parse(At+vt(c)),C=pt.multiply(x.clone(),A.clone()).invert(),L=pt.pow(c,new dt(ce.power)),I=ct.Utils.getU(ce);Ze=pt.multiply(C,h.clone().toLinear());var U=pt.parse(Tt+vt(Ze)),_=2*(Math.abs(ce.power)-1),O=Vt.integrate(pt.parse(Lt+vt(I)+"^"+_));return ct.Utils.clearU(I),pt.multiply(O.sub(I,U),L)}if(ce.group===Et||ce.power.lessThan(0)){var R=ce.clone().toLinear(),T=ct.Algebra.Factor.factor(R).toString()!==R.toString();if(ct.Algebra.degree(R,pt.parse(n)).equals(2)&&!T)try{var P,k,D=ct.Algebra.sqComplete(R,n);Ze=ct.Utils.getU(R),P=D.f.sub(D.a,Ze),k=pt.pow(P,pt.parse(ce.power)),t=Vt.integrate(k,Ze).sub(Ze,D.a)}catch(e){Vt.integration.stop()}else t=Vt.integration.partial_fraction(ce,n,ut,lt)}else t=Vt.integration.by_parts(ce,n,ut,lt)}t.multiplier=t.multiplier.multiply(i)}else if(e===gt){var F=ce.args[0],i=ce.multiplier.clone();ce.toUnitMultiplier();var B,G,V,H,j,X,$,Z,z,f=(Ve=Vt.integration.decompose_arg(F,n))[0],h=Ve[1],Q=ce.fname;if(Q===xt||Q===Rt||"acos"===Q||Q===Tt&&h.isLinear()){var Y,s=ce.power.toString();wt(s)&&(ut-=s),t=F.isComposite()?(Ze=ct.Utils.getU(ce),R=pt.pow(pt.parse(xt+vt(Ze)),new dt(s)),Ce=Vt.diff(F,n),Y=pt.multiply(R,Ce),O=Vt.integrate(Y,Ze,ut,lt),pt.multiply(pt.parse(i),O.sub(Ze,F))):pt.multiply(pt.parse(i),Vt.integration.by_parts(ce,n,ut,lt))}else{if(Q===It&&ce.power.lessThan(0))return(Je=ce.clone()).power.negate(),Je.fname=Ot,pt.multiply(pt.parse(i),Vt.integrate(Je,n,ut));if(!f.contains(n,!0)&&ce.isLinear())if("abs"===Q)(h=pt.divide(F.clone(),f.clone())).group!==St||h.power.lessThan(0)?Vt.integration.stop():t=ct.Utils.even(h.power)?Vt.integrate(F,n,ut):((z=Vt.integrate(h,n,ut)).power=z.power.subtract(new ft(1)),pt.multiply(pt.multiply(pt.symfunction("abs",[h.toLinear()]),z),f));else{var W=ce.args[0].group,J=Vt.integration.decompose_arg(F,n);switch((W!==Nt&&W!==St&&W!==Et||!J[1].power.equals(1)||F.hasFunc())&&Vt.integration.stop(),Q){case Lt:t=pt.symfunction(Ct,[F]);break;case Ct:(t=pt.symfunction(Lt,[F])).negate();break;case It:t=pt.parse(yt(ht.LOG+"(sec({0}))",F));break;case Ut:t=pt.parse(yt(ht.LOG+"(tan({0})+sec({0}))",F));break;case _t:t=pt.parse(yt("-"+ht.LOG+"(csc({0})+cot({0}))",F));break;case Ot:t=pt.parse(yt(ht.LOG+"(sin({0}))",F));break;case Pt:t=pt.symfunction(kt,[F]);break;case kt:t=pt.symfunction(Pt,[F]);break;case Dt:t=pt.parse(yt(ht.LOG+"(cosh({0}))",F));break;case"asec":case"acsc":case"acot":case"asech":case"acsch":case"acoth":t=Vt.integration.by_parts(ce,n,ut,lt);break;case"sech":t=pt.parse(yt("atan(sinh({0}))",F));break;case"csch":t=pt.parse(yt(ht.LOG+"(tanh(({0})/2))",F));break;case"coth":t=pt.parse(yt(ht.LOG+"(sinh({0}))",F));break;case"exp":t=Vt.integrate(pt.parse(yt("e^({0})",F)),n,ut);break;case"S":var F=ce.args[0].clone(),K=(Se=Vt.integration.decompose_arg(F,n))[1],ee=Se[0],te=Se[3];t=pt.parse(yt("(cos((1/2)*pi*(({1})+({0})*({2}))^2)+pi*(({1})+({0})*({2}))*S(({1})+({0})*({2})))/(({0})*pi)",ee,te,h));break;case"C":F=ce.args[0].clone(),K=(Se=Vt.integration.decompose_arg(F,n))[1],ee=Se[0],te=Se[3];t=pt.parse(yt("(pi*(({1})+({0})*({2}))*C(({1})+({0})*({2}))-sin((1/2)*pi*(({1})+({0})*({2}))^2))/(({0})*pi)",ee,te,K));break;case"erf":F=ce.args[0].clone(),K=(Se=Vt.integration.decompose_arg(F,n))[1],ee=Se[0];t=pt.parse(yt("e^(-(({2}))^2)/(({0})*sqrt(pi))+(1/({0})+({1}))*erf(({2}))",ee,K,F));break;case"sign":t=pt.multiply(ce.clone(),F.clone());break;default:Vt.integration.stop()}t=pt.divide(t,f)}else h.isLinear()?Q===Lt||Q===Ct?(s=Number(ce.power),t=s<0?(ce.fname=Q===Ct?_t:Ut,ce.invert().updateHash(),Vt.integrate(ce,n,ut)):(F=ce.args[0],B=ce.clone(),G=ce.clone(),Ie=new dt((s-1)/s),V=pt.multiply(f.clone(),new dt(s)).invert(),B.power=B.power.subtract(new ft(1)),G.power=G.power.subtract(new ft(2)),We=pt.symfunction(Q===Lt?Ct:Lt,[F.clone()]),Q===Ct&&We.negate(),pt.add(pt.multiply(pt.multiply(V,B),We),pt.multiply(Ie,Vt.integrate(pt.parse(G),n,ut))))):Q===It||Q===Ot?ce.args[0].isLinear(n)&&(_=ce.power.subtract(new ft(1)).toString(),nt=ce.clone().toUnitMultiplier(),Z=pt.parse(yt((Q===Ot?"-":"")+"1/({2}*{0})*{3}({1})^({0})",_,F,f,Q)),nt.power=nt.power.subtract(new ft(2)),nt.power.equals(0)&&(nt=pt.parse(nt)),t=pt.subtract(Z,Vt.integrate(nt,n,ut))):Q===Ut||Q===_t?(H=ce.power.subtract(new ft(1)).toString(),j=ce.power.subtract(new ft(2)).toString(),X=Q===Ut?It:Ot,nt=ce.clone().toUnitMultiplier(),$=yt((Q===_t?"-":"")+"1/({0}*{1})*{4}({3})^({2})*{5}({3})",f,H,j,F,Q,X),Z=pt.parse($),nt.power=nt.power.subtract(new ft(2)),nt.power.equals(0)&&(nt=pt.parse(nt)),t=pt.add(Z,pt.multiply(new dt(j/H),Vt.integrate(nt,n,ut)))):Q!==kt&&Q!==Pt||!ce.power.equals(2)?Vt.integration.stop():t=Vt.integrate(ce.fnTransform(),n,ut):Vt.integration.stop();t.multiplier=t.multiplier.multiply(i)}}else if(e===Mt)t=Vt.integration.partial_fraction(ce,n,ut);else if(e===Et){var ne=(ce=ce.getDenom().group===St?pt.expand(ce):ce).stripVar(n),re=pt.divide(ce.clone(),ne.clone());if(ne.contains(n)&&(re=pt.multiply(re,ne),ne=new dt(1)),re.group!==Et){if(re.equals(1))return Vt.integrate(pt.expand(ce),n,ut);re.clone().toLinear().isPoly(!0)&&1<ct.Utils.variables(re).length&&(re=ct.Algebra.Factor.factor(re)),t=Vt.integrate(re,n,ut)}else{var ie=re.collectSymbols().sort(function(e,t){return e.group===t.group?Number(e.power)===Number(t.power)?e<t?1:-1:t.power-e.power:t.group-e.group}).map(function(e){e=dt.unwrapSQRT(e,!0);return"exp"===e.fname?pt.parse(yt("({1})*e^({0})",e.args[0],e.multiplier)):e}),se=ie.length;if(ce.power<0){if(2===se)return Vt.integrate(pt.expand(ce),n,ut,lt)}else if(2===se){try{t=Vt.integration.u_substitution(ie,n)}catch(e){}if(!t){var oe,ae,ue,le,ce,pe,fe,he,me,ge,de,ve,we,ye,be,Se,Me,Ne,Ee,qe,xe,Ae,Ce,Le,Ie,Ue,_e,Oe,Re,Te,Pe=ie[0].group,ke=ie[1].group,De=ie[0],Fe=ie[1],Be=De.fname,Ge=Fe.fname;if(ce=pt.multiply(De.clone(),Fe.clone()),Pe===gt&&ke===gt)if(Be===xt||Ge===xt)t=Vt.integration.by_parts(ce.clone(),n,ut,lt);else{ie.sort(function(e,t){return t.fname>e.fname});var Ve,He=De.args[0];He.isLinear()&&(He.group===Nt||He.group===Et||He.group===St)||Vt.integration.stop(),h=(Ve=Vt.integration.decompose_arg(He,n))[1],f=Ve[0],h.isLinear()||Vt.integration.stop();var je,Xe=Fe.args[0];if(He.equals(Xe))if(Be===Ct&&Ge===Lt||Be===Lt&&Ge===Ct)if(De.power.lessThan(0)&&Vt.integration.stop(),Be===Ct&&De.power.add(Fe.power).equals(0))De.fname=It,De.updateHash(),t=Vt.integrate(De,n,ut);else if(bt(De.power)&&Ge===Lt&&Fe.power.lessThan(0)){var _=Number(De.power)/2,$e=pt.parse(yt("(1-cos({0})^2)^({1})",De.args[0],_));t=Vt.integrate(pt.expand(pt.multiply($e,Fe.clone())),n,ut,lt)}else if(bt(De.power)&&Ge===Ct&&Fe.power.lessThan(0)){_=Number(De.power)/2,$e=pt.parse(yt("(1-sin({0})^2)^({1})",De.args[0],_));t=Vt.integrate(pt.expand(pt.multiply($e,Fe.clone())),n,ut,lt)}else{var Ze,ze=ct.Utils.even(De.power),Qe=ct.Utils.even(Fe.power);if(t=new dt(0),ze&&Qe){var Ye=function(e){var t=e.power/2,t=e.fname===Lt?"((1/2)+(cos(2*("+e.args[0]+"))/2))^"+t:"((1/2)-(cos(2*("+e.args[0]+"))/2))^"+t;return pt.parse(t)},f=Ye(De),c=Ye(Fe),We=pt.multiply(f,c);return(Je=pt.expand(We)).each(function(e){t=pt.add(t,Vt.integrate(e,n,ut))}),pt.multiply(t,ne)}nt=ze?(Ze=De,Fe):(Ze=Fe,De);var Je,Ke=Ze.fname===Lt?-1:1,et=((_=nt.power)-1)/2,tt=pt.parse("(1-"+Ze.fname+ct.Utils.inBrackets(He)+"^2)^"+et);(Je=pt.expand(pt.multiply(new dt(Ke),pt.multiply(Ze.clone(),tt)))).each(function(e){t=pt.add(t,Vt.integration.poly_integrate(e.clone()))})}else Be===Ut&&Ge===It&&h.isLinear()&&Fe.isLinear()?t=pt.parse(yt("sec({0})^({1})/({1})",De.args[0],De.power)):Be===It&&Ge===Ut&&h.isLinear()?De.isLinear()&&Fe.isLinear()?t=pt.divide(pt.symfunction(Ut,[He.clone()]),f):bt(De.power)?(s=Number(De.power)/2,We=pt.parse(yt("(sec({0})^2-1)^({1})",De.args[0],s)),t=Vt.integrate(pt.expand(pt.multiply(We,Fe)),n,ut)):Vt.integration.stop():t=Be===Ut&&Ge===Lt?(De.fname=Lt,De.invert().updateHash(),Vt.integrate(pt.multiply(De,Fe),n,ut)):Be===Ct&&Ge===_t?(Fe.fname=Ct,Fe.invert().updateHash(),Vt.integrate(pt.multiply(De,Fe),n,ut)):(We=Be!==It||Ge!==Lt&&Ge!==Ct||!Fe.power.lessThan(0)?pt.multiply(De.fnTransform(),Fe.fnTransform()):pt.multiply(De.fnTransform(),Fe),Vt.integrate(pt.expand(We),n,ut));else Be!==Ct&&Be!==Lt||Ge!==Ct&&Ge!==Lt?Vt.integration.stop():De.isLinear()&&Fe.isLinear()?t=De.args[0].isLinear()&&Fe.args[0].isLinear()?(Ge===Ct?(p=De.args[0],je=Fe.args[0]):(je=De.args[0],p=Fe.args[0]),R=pt.parse(yt("(sin(({1})+({0}))+sin(({1})-({0})))/2",p.toString(),je.toString())),Vt.integrate(R,n,ut)):(st=Gt(ie),Vt.integrate(pt.expand(st),n,ut)):(st=new dt(1),ie.map(function(e){e=e.fnTransform();st=pt.multiply(st,e)}),We=pt.expand(st),(t=Vt.integrate(We,n,ut)).hasIntegral()&&(t=Vt.integrate(Gt(st.collectSymbols()),n,ut)))}else Pe===gt&&ke===St?(oe=De.isLinear(),De.fname===Lt&&oe&&Fe.power.equals(-1)?t=pt.symfunction("Ci",[De.args[0]]):De.fname===Lt&&Fe.power.equals(-1)?t=Vt.integrate(pt.multiply(De.fnTransform(),Fe.clone()),n,ut):De.fname===kt&&oe&&Fe.power.equals(-1)?t=pt.symfunction("Chi",[De.args[0]]):De.fname===kt&&Fe.power.equals(-1)?t=Vt.integrate(pt.multiply(De.fnTransform(),Fe.clone()),n,ut):De.fname===Ct&&oe&&Fe.power.equals(-1)?t=pt.symfunction("Si",[De.args[0]]):De.fname===Ct&&Fe.power.equals(-1)?t=Vt.integrate(pt.multiply(De.fnTransform(),Fe.clone()),n,ut):De.fname===Pt&&oe&&Fe.power.equals(-1)?t=pt.symfunction("Shi",[De.args[0]]):De.fname===Pt&&Fe.power.equals(-1)?t=Vt.integrate(pt.multiply(De.fnTransform(),Fe.clone()),n,ut):De.fname===xt&&Fe.power.equals(-1)?t=Vt.integration.poly_integrate(De,n,ut):"erf"===De.fname?Fe.power.equals(1)&&(ee=(Se=Vt.integration.decompose_arg(De.args[0],n))[0],K=Se[1],F=De.args[0].toString(),t=pt.parse(yt("(e^(-(({2}))^2)*(sqrt(pi)*e^((({2}))^2)*(2*({0})^2*({1})^2-3)*erf(({2}))+2*({0})*({1})-2))/(4*sqrt(pi)*({0})^2)",ee,K,F))):t=Vt.integration.by_parts(ce,n,ut,lt)):Pe===qt&&ke===St?(h=Be===xt?Vt.integration.decompose_arg(De.args[0],n)[1]:null,t=De.isE()&&(De.power.group===St||De.power.group===Et)&&Fe.power.equals(-1)?pt.symfunction("Ei",[De.power.clone()]):Be===xt&&h.value===Fe.value?Vt.integration.poly_integrate(De,n,ut):Vt.integration.by_parts(ce,n,ut,lt)):Pe===Mt&&ke===St?(ce=Fe.value===De.value&&De.power.equals(-1)?(ae=Math.min.apply(null,ct.Utils.keys(De.symbols)),ue=Math.min(ae,Fe.power),(le=Fe.clone()).power=new ft(ue),Fe=pt.divide(Fe,le.clone()),We=new dt(0),De.each(function(e){We=pt.add(We,pt.divide(e.clone(),le.clone()))}),We.multiplier=De.multiplier,pt.divide(Fe,We)):pt.expand(ce),t=Vt.integration.partial_fraction(ce,n,ut)):Pe===Nt&&ke===St?(R=De.clone().toLinear(),pe=ct.Algebra.degree(R,pt.parse(n)).equals(1),De.power.equals(-.5)?(f=(Ve=Vt.integration.decompose_arg(De.clone().toLinear(),n))[0].negate(),h=Ve[1],c=Ve[3],xe=Number(De.power),Ae=Number(Fe.power),wt(Ae)&&ct.Utils.even(Ae)&&h.power.equals(2)?(Me=pt.divide(pt.multiply(pt.pow(c.clone(),new dt(2)),pt.symfunction(At,[pt.divide(c.clone(),f.clone())])),pt.pow(f.clone(),new dt(2))),Me=pt.multiply(Me,pt.symfunction(At,[c]).invert()),(fe=pt.parse("sin(u)")).power=fe.power.multiply(Fe.power),O=Vt.integrate(fe,"u",ut),he=pt.parse("asin(sqrt("+f+"/"+c+")*"+n+")"),t=pt.multiply(Me,O.sub(new dt("u"),he))):-.5===xe&&(me=function(e,t){t=pt.parse(Vt.integrate(e,n,ut,lt).sub(n,yt(t,n)));if(!t.hasIntegral())return t},-1===Ae?t=me(pt.expand(pt.expand(pt.pow(pt.multiply(De.invert(),Fe.invert()),new dt(2)))).invert(),"sqrt(1-1/({0})^2)"):-2===Ae&&(t=me(pt.sqrt(pt.expand(pt.divide(pt.pow(ce,new dt(2)).invert(),pt.pow(new dt(n),new dt(2))).negate())).invert(),"sqrt(1-1/({0})^2)")))):De.power.equals(-1)&&Fe.isLinear()&&pe?t=Vt.integration.partial_fraction(ce,n,ut):!De.power.lessThan(0)&&wt(De.power)?(ge=pt.expand(De),t=new dt(0),ge.each(function(e){e.group===Mt?e.each(function(e){t=pt.add(t,Vt.integrate(pt.multiply(Fe.clone(),e),n,ut))}):t=pt.add(t,Vt.integrate(pt.multiply(Fe.clone(),e),n,ut))})):De.power.lessThan(-2)?t=Vt.integration.by_parts(ce,n,ut,lt):De.power.lessThan(0)&&Fe.power.greaterThan(1)?(f=(Ve=Vt.integration.decompose_arg(De.clone().toLinear(),n))[0].negate(),h=Ve[1],c=Ve[3],l=De.clone().toLinear(),t=h.group!==Mt&&h.isLinear()?(s=Number(Fe.power),Ze=new dt(Ce="_u_"),de=pt.expand(pt.divide(pt.pow(pt.subtract(Ze.clone(),c.clone()),new dt(s)),Ze.clone())),(ve={})[Ce]=l,we=pt.parse(de,ve),Vt.integrate(we,n,0)):Fe.power.greaterThan(h.power)||Fe.power.equals(h.power)?(ye=new ct.Algebra.Classes.Factors,De=ct.Algebra.Factor.coeffFactor(De.invert(),ye),(be=ct.Algebra.divide(Fe,De)).group!==Et?(t=new dt(0),be.each(function(e){t=pt.add(t,Vt.integrate(e,n,ut))}),ye.each(function(e){t=pt.divide(t,e)}),pt.expand(t)):Vt.integration.by_parts(ce,n,ut,lt)):Vt.integration.partial_fraction(ce,n,ut)):De.power.den.equals(2)?(f=(Se=Vt.integration.decompose_arg(De.clone().toLinear(),n))[3],h=Se[1],c=Se[0],je=Se[2],t=h.power.equals(2)&&c.lessThan(0)?(f.equals(1)||(ne=pt.multiply(ne,pt.pow(f,new dt(2)))),Ze=n,Me=pt.divide(pt.pow(c.clone().negate(),new dt(.5)),pt.pow(f,new dt(.5))),Ce=pt.symfunction(Lt,[new dt(Ze)]),Ne=pt.pow(pt.symfunction(Lt,[new dt(Ze)]),new dt(De.power.num)),Ee=pt.pow(pt.symfunction(Ct,[new dt(Ze)]),new dt(Fe.power)),qe=pt.multiply(pt.multiply(Ne,Ce),Ee),(O=Vt.integrate(qe,Ze,ut)).sub(Ze,pt.symfunction(Rt,[pt.multiply(new dt(n),Me)]))):Vt.integration.partial_fraction(ce,n,ut,lt)):pe&&(t=Vt.integration.partial_fraction(ce,n,ut))):De.isComposite()&&Fe.isComposite()?(t=new dt(0),De.power.greaterThan(0)&&Fe.power.greaterThan(0)?(Je=pt.expand(ce)).each(function(e){t=pt.add(t,Vt.integrate(e,n,ut))},!0):(xe=Number(De.power),Ae=Number(Fe.power),xe<0&&0<Ae&&(We=De,De=Fe,Fe=We),-1===xe&&-1===Ae?t=Vt.integration.partial_fraction(ce,n):De.each(function(e){e=pt.multiply(e,Fe.clone()),e=Vt.integrate(e,n,ut);t=pt.add(t,e)}))):Pe===Nt&&ie[0].power.greaterThan(0)?(De=pt.expand(De),t=new dt(0),De.each(function(e){t=pt.add(t,Vt.integrate(pt.multiply(e,Fe.clone()),n,ut))},!0)):Pe===gt&&ke===qt&&ct.Utils.in_htrig(De.fname)?(De=De.fnTransform(),t=Vt.integrate(pt.expand(pt.multiply(De,Fe)),n,ut)):Pe===gt&&ke===Nt||ke===gt&&Pe===Nt?(ke===gt&&Pe===Nt&&(We=De,De=Fe,Fe=We),Ce=dt.unwrapSQRT(Vt.diff(De.clone(),n),!0),Le=dt.unwrapSQRT(Fe,!0),Ce.power.equals(Le.power)?(s=new dt(Fe.power),Ue=Ce.clone().toLinear(),_e=Fe.clone().toLinear(),(Ie=ct.Algebra.divide(Ue.toLinear(),_e)).isConstant()&&(Oe=pt.pow(Ie,s.negate()),t=pt.multiply(Oe,Vt.integration.poly_integrate(De.clone())))):t=Vt.integration.by_parts(ce,n,ut,lt)):(Re=De.clone().toLinear(),Te=Fe.clone().toLinear(),t=Pe===qt&&ke===qt&&De.power.contains(n)&&Fe.power.contains(n)&&!Re.contains(n)&&!Te.contains(n)?pt.parse(yt("(({0})^(({2})*({4}))*({1})^(({3})*({4})))/(log(({0})^({2}))+log(({1})^({3})))",Re.toString(),Te.toString(),De.power.multiplier.toString(),Fe.power.multiplier.toString(),n)):Vt.integration.by_parts(ce,n,ut,lt))}}else if(3===se&&(ie[2].group===St&&ie[2].power.lessThan(2)||ie[0].group===Nt)){var nt,rt=ie[0];rt.group===Nt?(rt.power.greaterThan(1)&&(rt=pt.expand(rt)),nt=pt.multiply(ie[1],ie[2]),t=new dt(0),rt.each(function(e){e=pt.multiply(e,nt.clone()),e=Vt.integrate(e,n,ut);t=pt.add(t,e)},!0)):t=Vt.integration.by_parts(ce,n,ut,lt)}else if(Bt(ie)){for(var We=new dt(1),it=0,se=ie.length;it<se;it++)We=pt.multiply(We,ie[it].fnTransform());We=pt.expand(We),t=Vt.integrate(We,n,ut)}else{var st=Gt(ie);t=Vt.integrate(pt.expand(st),n,ut)}}t=pt.multiply(t,ne)}}else t=pt.multiply(ce.clone(),pt.parse(n));if(t)return t}catch(e){if(!(e instanceof Ft||e instanceof ct.exceptions.DivisionByZero))throw e}return pt.symfunction("integrate",[ot,at])},!1))},defint:function(e,t,n,r){r=r||"x";function i(t,e,n){try{return pt.parse(t,e)}catch(e){return Vt.Limit.limit(t,r,n)}}var s,o,a=ct.Utils.variables(e),u=e.hasTrig();return 1!==a.length||r||(r=a[0]),u||(s=Vt.integrate(e,r)),u||s.hasIntegral()?1===a.length&&t.isConstant()&&n.isConstant()?(o=ct.Utils.build(e),new dt(ct.Math2.num_integrate(o,Number(t),Number(n)))):pt.symfunction("defint",[e,t,n,r]):(o={},(e={})[r]=n,o[r]=t,n=i(s,e,n),t=i(s,o,t),pt.subtract(n,t))},Limit:{interval:function(e,t){return pt.parse(yt("[{0}, {1}]",e,t))},diverges:function(){return Vt.Limit.interval("-Infinity","Infinity")},divide:function(e,t,n,r,i){if(!(i++>ht.max_lim_depth)){e.clone();var s=t.clone();if("abs"===t.fname){var o=e.sign(),a=r.sign();if(r.isInfinity)return pt.multiply(new dt(o),new dt(a));if(r.equals(0)){var a=pt.parse(e.multiplier),u=pt.parse(t.multiplier);return pt.divide(pt.multiply(a,Vt.Limit.interval("-1","1")),u)}Vt.Limit.diverges()}var l=function(e){if(ct.Utils.isVector(e)){for(var t=0;t<e.elements.length;t++)if(!e.elements[t].isInfinity)return!1;return!0}return e.isInfinity},c=function(e,t){return!ct.Utils.isVector(e)&&e.equals(t)};do{var p,f,h=k(Vt.Limit.limit(e.clone(),n,r,i)),m=k(Vt.Limit.limit(t.clone(),n,r,i)),g=l(h)&&l(m)||c(h,0)&&c(m,0)}while(g&&(p=Vt.diff(e.clone(),n),f=Vt.diff(t.clone(),n),e=(f=pt.expand(pt.divide(p,f))).getNum(),t=f.getDenom()),g);u=m.equals(0),s=Number(s.power);return r.isConstant(!0)&&u?dt.infinity(ct.Utils.even(s)&&h.lessThan(0)?-1:void 0):u?Vt.Limit.diverges():pt.divide(h,m)}},rewriteToLog:function(e){var t=e.power.clone();return e.toLinear(),pt.pow(new dt("e"),pt.multiply(t,pt.symfunction(ht.LOG+"",[e])))},getSubbed:function(t,e,n){var r;t.group===qt&&(t=Vt.rewriteToLog(t));try{r=t.sub(e,n)}catch(e){r=t}return r},isInterval:function(e){return ct.Utils.isVector(e)},isConvergent:function(e){return!(Vt.Limit.isInterval(e)&&e.elements[0].isInfinity&&e.elements[1].isInfinity||e.containsFunction("limit"))},limit:function(t,n,r,i){if(t.isLinear()&&t.isComposite()){var s=new dt(0);return t.each(function(e){s=pt.add(s,Vt.Limit.limit(e,n,r,i))},!0),s}if(t=ct.Algebra.Simplify.simplify(t),i=i||1,!(i++>ht.max_lim_depth)){var e=pt.parse(t.multiplier);t.toUnitMultiplier();try{if(t.isConstant(!0))d=t;else{var o={};o[n]=r;try{var a=pt.parse(t.sub(n,r),o);(a.isConstant(!0)||a.isInfinity)&&(d=a)}catch(e){}if(!d){var u,l=t.getNum(),c=t.getDenom();if(c.isConstant(!0)){if(t.group===qt){var p,f,h,m,g,d,v=t.clone().toLinear(),w=(t.power.clone(),v.getNum()),y=v.getDenom(),b=ct.Utils.decompose_fn(y,n,!0);d=w.group===St&&w.multiplier.isOne()&&b.ax.group===St&&b.b.isConstant(!0)&&b.a.isOne()&&b.b.isConstant(!0)?pt.parse(yt("(1/e^({0}))",b.b)):(f=(p=Vt.Limit.rewriteToLog(t.clone())).power.clone(),h=p.clone().toLinear(),m=Vt.Limit.limit(h,n,r,i),g=Vt.Limit.limit(f,n,r,i),pt.pow(m,g))}else if(t.group===gt&&1===t.args.length){var S,M=Vt.Limit.limit(t.args[0],n,r,i);if(ct.Utils.isVector(M))return d=M.map(function(e){return t.clone().args[0]=e,Vt.Limit.limit(pt.symfunction(t.fname,[e]),n,r,i)}),pt.multiply(e,d);if(M.isConstant(!0)){var N=pt.symfunction(t.fname,[M]);try{k(N),S=!0}catch(e){S=!1}}if(S)d=N;else if(Vt.Limit.isConvergent(M))if(t.fname===xt)switch(M.toString()){case"0":d=dt.infinity().negate();break;case"Infinity":case"-Infinity":d=dt.infinity()}else if(t.fname!==Lt&&t.fname!==Ct||!r.isInfinity){if(t.fname===It){var E=t.args[0],q=E.getNum(),x=E.getDenom(),A=q.toUnitMultiplier();(r.isInfinity||A.equals("pi")&&x.equals(2))&&(d=divergent())}else if(t.fname===ht.FACTORIAL&&M.isInfinity)return dt.infinity()}else d=Vt.Limit.interval(-1,1)}else if(t.group===St){if(0<t.power)return pt.parse(t,o);d=ct.Utils.even(t.power)?dt.infinity():Vt.Limit.diverges()}else if(t.group===Et){for(var v=(U=t.collectSymbols().sort(function(e,t){return e.group-t.group})).pop(),C=k(Vt.Limit.limit(v,n,r,i));U.length;){var L=U.pop(),I=k(Vt.Limit.limit(L,n,r,i));C.isInfinity||!Vt.Limit.isConvergent(C)&&I.equals(0)||C.equals(0)&&Vt.Limit.isConvergent(I)?((L=L.containsFunction(xt)?[v,v=L][0]:L).invert(),C=C.isInfinity&&I.isInfinity?dt.infinity():Vt.Limit.divide(v,L,n,r,i)):(C=pt.multiply(C,I),v=pt.multiply(v,L))}d=C}else if(t.isComposite()){t.isLinear()||(t=pt.expand(t)),d=new dt(0);for(var U=t.collectSymbols().sort(function(e,t){return t.group-e.group}),_=[],O=new dt(0),R=0,T=U.length;R<T;R++)(P=U[R].clone()).group===gt||P.group===Et&&P.hasFunc()?O=pt.add(O,P):_.push(P);_.unshift(O),1!==_.length&&(U=_);for(R=0,T=U.length;R<T;R++){var P=U[R];try{u=Vt.Limit.limit(P,n,r,i)}catch(e){u=Vt.Limit.diverges()}try{d=pt.add(d,u)}catch(e){if(i++>ht.max_lim_depth)return;d=Vt.Limit.limit(Vt.diff(t,n),n,r,i)}}}}else d=Vt.Limit.divide(l,c,n,r,i)}}d=d||pt.symfunction("limit",[t,n,r])}catch(e){d=pt.symfunction("limit",[t,n,r])}return pt.multiply(e,d)}}},Fresnel:{S:function(e){return e.isConstant(!0)?Vt.defint(pt.parse("sin(pi*x^2/2)"),dt(0),e,"x"):pt.symfunction("S",arguments)},C:function(e){return e.isConstant(!0)?Vt.defint(pt.parse("cos(pi*x^2/2)"),dt(0),e,"x"):pt.symfunction("C",arguments)}}};nerdamer.register([{name:"diff",visible:!0,numargs:[1,3],build:function(){return Vt.diff}},{name:"sum",visible:!0,numargs:4,build:function(){return Vt.sum}},{name:"product",visible:!0,numargs:4,build:function(){return Vt.product}},{name:"integrate",visible:!0,numargs:[1,2],build:function(){return Vt.integrate}},{name:"defint",visible:!0,numargs:[3,4],build:function(){return Vt.defint}},{name:"S",visible:!0,numargs:1,build:function(){return Vt.Fresnel.S}},{name:"C",visible:!0,numargs:1,build:function(){return Vt.Fresnel.C}},{name:"limit",visible:!0,numargs:[3,4],build:function(){return Vt.Limit.limit}}]),nerdamer.updateAPI()}(),"undefined"!=typeof module&&(nerdamer=require("./nerdamer.core.js"),require("./Calculus.js"),require("./Algebra.js")),function(){var t,H=nerdamer.getCore(),j=H.PARSER,X=H.Algebra,$=H.Calculus,Z=$.integration.decompose_arg,z=H.Utils.evaluate,q=H.Utils.remove,c=H.Utils.format,Q=H.Utils.build,f=H.Utils.knownVariable,Y=H.Symbol,W=H.Utils.isSymbol,l=H.Utils.variables,J=H.groups.S,K=H.groups.PL,ee=H.groups.CB,te=H.groups.CP,ne=H.groups.FN,re=H.Settings,s=H.Utils.range,ie=H.Utils.isArray;function se(e,t){if(t.isConstant()&&e.isConstant()&&!e.equals(t)||e.equals(H.Settings.IMAGINARY)&&t.isConstant(!0)||t.equals(H.Settings.IMAGINARY)&&e.isConstant(!0))throw new H.exceptions.NerdamerValueError(e.toString()+" does not equal "+t.toString());this.LHS=e,this.RHS=t}H.Settings.SOLVE_RADIUS=1e3,H.Settings.ROOTS_PER_SIDE=10,H.Settings.make_pi_conversions=!1,H.Settings.STEP_SIZE=.1,H.Settings.EPSILON=1e-13,H.Settings.MAX_NEWTON_ITERATIONS=200,H.Settings.MAX_NON_LINEAR_TRIES=12,H.Settings.NON_LINEAR_JUMP_AT=50,H.Settings.NON_LINEAR_JUMP_SIZE=100,H.Settings.NON_LINEAR_START=.01,H.Settings.NEWTON_SLICES=200,H.Settings.NEWTON_EPSILON=2*Number.EPSILON,H.Settings.SOLUTION_PROXIMITY=1e-14,H.Settings.FILTER_SOLUTIONS=!0,H.Settings.MAX_SOLVE_DEPTH=10,H.Settings.ZERO_EPSILON=1e-9,H.Settings.MAX_BISECTION_ITER=2e3,H.Settings.BI_SECTION_EPSILON=1e-12,H.Symbol.prototype.hasTrig=function(){return this.containsFunction(["cos","sin","tan","cot","csc","sec"])},H.Symbol.prototype.hasNegativeTerms=function(){if(this.isComposite())for(var e in this.symbols){var t=this.symbols[e];if(t.group===K&&t.hasNegativeTerms()||this.symbols[e].power.lessThan(0))return!0}return!1},se.prototype={toString:function(){return this.LHS.toString()+"="+this.RHS.toString()},text:function(e){return this.LHS.text(e)+"="+this.RHS.text(e)},toLHS:function(e){var t=(n=(e=void 0===e)?this.removeDenom():this.clone()).LHS,n=n.RHS;t.isConstant(!0)&&!n.isConstant(!0)&&([t,n]=[n,t]);n=j.subtract(t,n);return new se(e?j.expand(n):n,new Y(0)).removeDenom().LHS},removeDenom:function(){var e=this.LHS.clone(),t=this.RHS.clone(),n=j.multiply(e.getDenom(),t.getDenom());if(e=j.expand(j.multiply(e,n.clone())),(t=j.expand(j.multiply(t,n))).group===te&&t.group!==te&&(r=e,e=t,t=r),e.group===ee){var r=new Y(e.multiplier),i=t.clone();e.each(function(e){e.power.lessThan(0)?i=j.divide(i,e):r=j.multiply(r,e)}),e=r,t=i}else if(e.group===te)for(var s in e.symbols){var o=e.symbols[s];if(o.group===ee)for(var a in o.symbols){a=o.symbols[a];if(a.power.lessThan(0))return new se(j.expand(j.multiply(a.clone().toLinear(),e)),j.expand(j.multiply(a.clone().toLinear(),t)))}}return new se(e,t)},clone:function(){return new se(this.LHS.clone(),this.RHS.clone())},sub:function(e,t){var n=this.clone();return n.LHS=n.LHS.sub(e.clone(),t.clone()),n.RHS=n.RHS.sub(e.clone(),t.clone()),n},isZero:function(){return H.Utils.evaluate(this.toLHS()).equals(0)},latex:function(e){return[this.LHS.latex(e),this.RHS.latex(e)].join("=")}},j.equals=function(e,t){return new se(e,t)},t=j.functions.simplify[0],j.functions.simplify[0]=function(e){return e instanceof se?(e.LHS=t(e.LHS),e.RHS=t(e.RHS),e):t(e)},H.Expression.prototype.equals=function(e){return e instanceof H.Expression&&(e=e.symbol),new se(this.symbol,e)},H.Expression.prototype.solveFor=function(e){var t;if(this.symbol instanceof se){if(this.symbol.LHS.isConstant()&&this.symbol.RHS.equals(e))return new H.Expression(this.symbol.LHS);if(this.symbol.RHS.isConstant()&&this.symbol.LHS.equals(e))return new H.Expression(this.symbol.RHS);t=this.symbol.toLHS()}else t=this.symbol;return ue(t,e).map(function(e){return new H.Expression(e)})},H.Expression.prototype.expand=function(){if(this.symbol instanceof se){var e=this.symbol.clone();return e.RHS=j.expand(e.RHS),e.LHS=j.expand(e.LHS),new H.Expression(e)}return new H.Expression(j.expand(this.symbol))},H.Expression.prototype.variables=function(){return this.symbol instanceof se?H.Utils.arrayUnique(l(this.symbol.LHS).concat(l(this.symbol.RHS))):l(this.symbol)};function e(e,t){return j.equals(e,t)}H.Equation=se;var oe=H.Utils.checkAll=function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return!1;return!0},ae=H.Solve={version:"2.0.3",solutions:[],solve:function(e,t){t=ue(e,String(t));return new H.Vector(t)},toLHS:function(e,t){return W(e)?e:(e instanceof se||((n=e.split("="))[1]=n[1]||"0",e=new se(j.parse(n[0]),j.parse(n[1]))),e.toLHS(t));var n},solveCircle:function(e,t){for(var n=t.map(function(e){return j.parse(e)}),r=[],i=[],s=0;s<e.length;s++){for(var o=[],a=0;a<n.length;a++)o.push(Number(H.Algebra.degree(e[s],n[a])));o.push(H.Utils.arraySum(o,!0)),r.push(o)}var u,l,c=e[0],p=e[1];return r[0][2]>r[1][2]&&([p,c]=[c,p],[r[1],r[0]]=[r[0],r[1]]),1===r[0][0]&&2===r[0][2]&&2===r[1][0]&&4===r[1][2]&&(u=t[0],l=t[1],t=ue(j.parse(p,f(u,ue(j.parse(c),u)[0])),l).map(function(e){return e.toString()}),p=[ue(j.parse(c,f(l,t[0])))[0].toString()],t[1]&&p.push(ue(j.parse(c,f(l,t[1])))[0].toString()),re.SOLUTIONS_AS_OBJECT?((i={})[u]=p,i[l]=t):(t.unshift(l),p.unshift(u),i=[p,t])),i},solveNonLinearSystem:function(e,t,r){if(t<0)return[];r=void 0===r?H.Settings.NON_LINEAR_START:r;var i=H.Settings.MAX_NON_LINEAR_TRIES,s=Math.floor(i/2);t=void 0===t?i:t;var o,a,u,l,c,p=H.Settings.NON_LINEAR_JUMP_AT,f=H.Settings.NON_LINEAR_JUMP_SIZE,h=!0,m=H.Utils.arrayGetVariables(e),i=H.Matrix.jacobian(e,m,function(e){return Q(e,m)},!0),g=H.Settings.MAX_NEWTON_ITERATIONS,d=e.map(function(e){return Q(e,m)}),v=i.map(function(e){return Q(e,m)},!0),w=H.Matrix.cMatrix(0,m),y=H.Matrix.cMatrix(r,m),b=0;do{if(g<b)break;o=function(e,n){return e.map(function(e,t){return Number(n.get(t,0))})}(m,y),l=y.clone(),d.forEach(function(e,t){y.set(t,0,e.apply(null,o))});var S=new H.Matrix;if(v.each(function(e,t,n){e=e.apply(null,o);S.set(t,n,e)}),S=S.invert(),c=(a=j.multiply(S,y).negate()).subtract(w,function(e){return j.parse(Number(e))}),w=l.add(a,function(e){return j.parse(Number(e))}),y=w,p<=b&&1<u){t===s&&(r=0);var M=s<t?1:-1;return n=t%Math.floor(s)+1,r+=M*n*f,ae.solveNonLinearSystem(e,--t,r)}}while((M=u,b++,u=c.max(),Number(u)!==Number(M))&&Number(u)>=Number.EPSILON);return h?ae.systemSolutions(y,m,!0,function(e){return H.Utils.round(Number(e),14)}):[]},systemSolutions:function(e,r,i,s){var o=H.Settings.SOLUTIONS_AS_OBJECT?{}:[];return e.each(function(e,t){var n=(i?j.expand(e):e).valueOf();s&&(n=s.call(e,n));t=r[t];H.Settings.SOLUTIONS_AS_OBJECT?o[t]=n:o.push([t,n])}),o},solveSystemBySubstitution:function(e){var t=l(e[0]),n=l(e[1]);return 2===e.length&&2===t.length&&H.Utils.arrayEqual(t,n)?ae.solveCircle(e,t):[]},solveSystem:function(e,t){for(var n=0;n<e.length;n++)e[n]=ae.toLHS(e[n]);var r,i=e.length,s=new H.Matrix,o=new H.Matrix,a=!1;if(void 0===t){if(!X.allLinear(e))try{return ae.solveNonLinearSystem(e)}catch(c){if(c instanceof H.exceptions.DivisionByZero)return ae.solveSystemBySubstitution(e)}if(1===(r=H.Utils.arrayGetVariables(e)).length){var u,l=0;do{var c=e[l].clone()}while(0<l&&(c=c.sub(r[0],u[0])),u=ue(c,r[0]),++l<e.length);return re.SOLUTIONS_AS_OBJECT?(h={})[r[0]]=u:h=0===u.length?u:[r[0],u],h}if(r.length<e.length){for(var p=[],l=e.length,n=0;n<l-1;n++)p.push(j.parse(e[n]));var f={},h=ae.solveSystem(p,r);Array.isArray(h)?h.forEach(function(e){f[e[0]]=e[1]}):f=h;for(var m=!0,n=l-1;n<l;n++)j.parse(e[n],f).equals(0)||(m=!1);if(m)return h}for(n=0;n<r.length;n++)nerdamer.setVar(r[n],"delete");for(n=0;n<i;n++){for(var c=e[n],g=0;g<r.length;g++){var d=r[g],v=[];c.each(function(e){e.contains(d)&&(v=v.concat(e.coeffs()))});var w=H.Utils.arraySum(v);s.set(n,g,w)}var y=c.clone();r.map(function(e){y=y.stripVar(e,!0)}),o.set(n,0,y.negate())}}else for(r=t,a=!0,n=0;n<i;n++){o.set(n,0,new Y(0));for(c=j.expand(e[n]).collectSymbols(),g=0;g<t.length;g++){s.set(n,g,new Y(0));for(var d=t[g],b=0;b<c.length;b++){for(var S,M=c[b],N=!1,E=0;E<t.length;E++)M.contains(t[E])&&(N&&H.err("Multiple variables found for term "+M),N=!0);M.contains(d)&&(S=Z(q(c,b),d),s.set(n,g,j.add(s.get(n,g),S[0])))}}for(b=0;b<c.length;b++)o.set(n,0,j.add(o.get(n,0),c[b]))}if(r.length!==e.length||s.determinant().equals(0))throw new H.exceptions.SolveError("System does not have a distinct solution");h=(s=s.invert()).multiply(o);return H.Utils.isArray(t)&&h.each(function(e){return e.negate()}),ae.systemSolutions(h,r,a)},quad:function(e,t,n){e=j.subtract(j.pow(t.clone(),Y(2)),j.multiply(j.multiply(n.clone(),e.clone()),Y(4))),e=j.expand(e),e=j.pow(e,Y(.5)),n=j.parse(j.multiply(new Y(2),n.clone()));return[j.parse(c("(-({0})+({1}))/({2})",t,e,n)),j.parse(c("(-({0})-({1}))/({2})",t,e,n))]},cubic:function(e,t,n,r){r=r.text(),n=n.text(),t=t.text(),e=`(-(${n})^3/(27*(${r})^3)+(${n})*(${t})/(6*(${r})^2)-(${e.text()})/(2*(${r})))`,t=`((${t})/(3*(${r}))-(${n})^2/(9*(${r})^2))`,n=`((${e})+sqrt((${e})^2+(${t})^3))^(1/3)+((${e})-sqrt((${e})^2+(${t})^3))^(1/3)-(${`(${n})/(3*(${r}))`})`,r="1/2+sqrt(3)/2*i";return[j.parse(n),j.parse(`(${n})(${r})`),j.parse(`(${n})(${r})^2`)]},quartic:function(e,t,n,r,i){var s,o,a,u={};return H.Utils.arrayUnique(l(i).concat(l(r)).concat(l(n)).concat(l(t)).concat(l(e))).map(function(e){u[e]=1}),i=i.toString(),r=r.toString(),n=n.toString(),t=t.toString(),e=e.toString(),s=j.parse(c("(8*({0})*({2})-3*({1})^2)/(8*({0})^2)",i,r,n)).toString(),o=j.parse(c("(({1})^3-4*({0})*({1})*({2})+8*({0})^2*({3}))/(8*({0})^3)",i,r,n,t)).toString(),a=j.parse(c("12*({0})*({4})-3*({1})*({3})+({2})^2",i,r,n,t,e)).toString(),e=j.parse(c("2*({2})^3-9*({1})*({2})*({3})+27*({1})^2*({4})+27*({0})*({3})^2-72*({0})*({2})*({4})",i,r,n,t,e)).toString(),e=j.parse(c("((({1})+(({1})^2-4*({0})^3)^(1/2))/2)^(1/3)",a,e)).toString(),J=j.parse(c("(1/2)*(-(2/3)*({1})+(1/(3*({0}))*(({2})+(({3})/({2})))))^(1/2)",i,s,e,a)).toString(),[j.parse(c("-(({1})/(4*({0})))-({4})+(1/2)*sqrt(-4*({4})^2-2*({2})+(({3})/({4})))",i,r,s,o,J)),j.parse(c("-(({1})/(4*({0})))-({4})-(1/2)*sqrt(-4*({4})^2-2*({2})+(({3})/({4})))",i,r,s,o,J)),j.parse(c("-(({1})/(4*({0})))+({4})+(1/2)*sqrt(-4*({4})^2-2*({2})-(({3})/({4})))",i,r,s,o,J)),j.parse(c("-(({1})/(4*({0})))+({4})-(1/2)*sqrt(-4*({4})^2-2*({2})-(({3})/({4})))",i,r,s,o,J))]},divideAndConquer:function(e,t){var n=[],e=H.Algebra.Factor.factor(e);return e.group===ee&&e.each(function(e){e=Y.unwrapPARENS(e),n=n.concat(ue(e,t))}),n},csolve:function(u,l){return H.Utils.block("IGNORE_E",function(){var e=[],t=H.Utils.decompose_fn(u,l,!0);if(t.x.group===J)for(var n,r=j.parse(t.x.power),i=Number(r),s=j.pow(j.divide(t.b.negate(),t.a),r.invert()),s=(t=Y.toPolarFormArray(s))[0],o=(t[1],s.toString()),a=(r.toString(),0);a<i;a++)n=c("({0})*e^(2*{1}*pi*{2}*{3})",o,a,r,H.Settings.IMAGINARY),n=j.parse(n),e.push(n);return e},!0)},getPoints:function(e,t,u){t=t||.01,u=u||[];var l=Q(e),n=Math.round(0),r=l(n),c=r/Math.abs(r),i=H.Settings.ROOTS_PER_SIDE,r=i;u.push(Math.floor(n/2)),u.push(Math.abs(n)),u.push(n),e.each(function(e){e.containsFunction(H.Settings.LOG)&&u.push(.1)});e=s(-H.Settings.SOLVE_RADIUS,n,t),n=s(n,H.Settings.SOLVE_RADIUS,t),t=function(e,t){for(var n,r,i,s=[],o=0,a=e.length;o<a;o++)n=e[o],i=(r=l(n))/Math.abs(r),isNaN(r)||!isFinite(r)||s.length>t||(i!==c&&s.push(n),c=i);u=u.concat(s)};return t(e,r),t(n,i),u},bisection:function(e,t){var n=e-1,r=e+1;if(Math.sign(t(n))!==Math.sign(t(r))){var i,s,o=0;do{if(i=Math.abs(r-n),o++>H.Settings.MAX_BISECTION_ITER||isNaN(i))return}while(s=(n+r)/2,0<t(n)*t(s)?n=s:r=s,i>=re.EPSILON);var a=(n+r)/2,e=t(a);if(!isNaN(e)&&Math.abs(e)<=H.Settings.BI_SECTION_EPSILON)return H.Utils.round(a,13)}},Newton:function(e,t,n){var r=H.Settings.MAX_NEWTON_ITERATIONS,i=0,s=e;do{var o=t(s);if(0===s&&0===o){a=0;break}if(r<++i)return;var a=s-o/n(s),o=Math.abs(a-s),s=a}while(o>re.NEWTON_EPSILON);if(Math.abs(t(a))<=re.EPSILON)return a},rewrite:function(e,t,n){var r,i;t=t||new Y(0),e.isComposite()&&e.isLinear()?(r=[],i=[],e.each(function(e){("sqrt"===(e=e.clone()).fname&&e.contains(n)?r:i).push(e)},!0),1===r.length&&(t=j.expand(j.pow(j.subtract(t,H.Utils.arraySum(i)),new Y(2))),e=j.expand(j.pow(Y.unwrapSQRT(r[0]),new Y(2))))):e=Y.unwrapSQRT(j.expand(e));var s=0,o=e.length;if(e.group===te&&e.contains(n)&&e.isLinear()){e.distributeMultiplier();var a=new Y(0);return e.each(function(e){e.contains(n)?(s++,a=j.add(a,e.clone())):t=j.subtract(t,e.clone())}),e=a,s!==o?ae.rewrite(e,t,n):[e,t]}if(e.group===ee&&e.contains(n)&&e.isLinear()){if(e.multiplier.lessThan(0)&&(e.multiplier=e.multiplier.multiply(new H.Frac(-1)),t.multiplier=t.multiplier.multiply(new H.Frac(-1))),t.equals(0))return new Y(0);a=new Y(1);return e.each(function(e){e.contains(n)?a=j.multiply(a,e.clone()):t=j.divide(t,e.clone())}),ae.rewrite(e=a,t,n)}if(!e.isLinear()&&e.contains(n)){o=j.parse(e.power.clone().invert());return e=j.pow(e,o.clone()),t=j.pow(j.expand(t),o.clone()),ae.rewrite(e,t,n)}if(e.group===ne||e.group===J||e.group===K)return[e,t]},sqrtSolve:function(n,r){var t=new Y(0),i=new Y(0);if(n.isComposite()&&(n.each(function(e){"sqrt"===e.fname&&e.contains(r)?t=j.add(t,e.clone()):i=j.add(i,e.clone())}),!t.equals(0))){var e=j.expand(j.multiply(j.parse(n.multiplier),j.subtract(j.pow(i,new Y(2)),j.pow(t,new Y(2)))));return ue(e,r).filter(function(e){if(e.isImaginary())return e;var t={};return t[r]=e,z(n,t).equals(0)?e:void 0})}}},ue=function(n,p,i,t,e){if(t=t||0,t++>re.MAX_SOLVE_DEPTH)return i;if(n instanceof se){if(n.isZero())return[new Y(0)];if(n.LHS.equals(p)&&!n.RHS.contains(p))return[n.RHS];if(n.RHS.equals(p)&&!n.LHS.contains(p))return[n.LHS]}if(n instanceof H.Vector&&(n=n.elements),p=p||"x",ie(n))return ae.solveSystem.apply(void 0,arguments);i=i||[];var s={},r={};if(r[p]=0,W(n)&&!0===z(n.getDenom(),r).equals(0))return i;var o=function(e,t){var n,r=W(e);void 0===e||"number"==typeof e&&isNaN(e)||(ie(e)?e.forEach(function(e){o(e)}):"null"!==e.valueOf()&&("function"==typeof H.Settings.PRE_ADD_SOLUTION&&(e=H.Settings.PRE_ADD_SOLUTION(e)),r||(e=j.parse(e)),H.Settings.make_pi_conversions&&t&&(r=(n=j.divide(e.clone(),new Y(Math.PI))).multiplier,t=Math.abs(r.num),r=Math.abs(r.den),t<10&&r<10&&(e=j.multiply(n,new Y("pi")))),n=e.toString(),s[n]||i.push(e),s[n]=!0))};if(n.group===J&&n.contains(p)){try{var a={};a[p]=0,z(e,a,"numer"),o(new Y(0))}catch(e){}return i}if(n.group===ee){var u=n.getNum();if(u.group!==ee)return ue(u,p,i,t,e);var l=String(p);return u.each(function(e){e.contains(l)&&ue(e,p,i,t,n)}),i}n.group===ne&&"sqrt"===n.fname&&(n=j.pow(Y.unwrapSQRT(n),new Y(2)));var c=(H.Utils.isSymbol(n)?n:ae.toLHS(n,!1)).getNum(),r=H.Utils.variables(c),a=r.length;if((c=H.Utils.isInt(c.power)&&0<c.power?j.parse(c).toLinear():c).group===J||c.group===ee&&c.contains(p))return[new Y(0)];function f(e){var t=new Y(0),n=new Y(0);return e.each(function(e){e.contains(p,!0)?t=j.add(t,e.clone()):n=j.subtract(n,e.clone())}),[t,n]}var h,m={},g=function(n){var e=(n=j.expand(n,{expand_denominator:!0,expand_functions:!0})).clone();if(n.symbols)for(var t in n.symbols){var r=n.symbols[t],i=r.getDenom();if(!i.isConstant(!0)&&n.isComposite()){var s=new Y(0);return n.each(function(e){s=j.add(s,j.multiply(e,i.clone()))}),g(j.multiply(j.parse(n.multiplier),s))}var o=Z(r,p),a=o[1].fname===H.Settings.SQRT,u=Y.unwrapSQRT(o[1]),t=u.power.clone();if(!W(t)&&!t.equals(.5))if(t.den.gt(1)){if(a)return n=j.subtract(n,r.clone()),n=j.add(n,j.multiply(o[0].clone(),u)),g(n);u=m[t.den];m[t.den]=u?u++:1}else{if(-1===t.sign()){var l=j.parse(p+"^"+Math.abs(t));return n.each(function(e,t){e.contains(p)&&(n.symbols[t]=j.multiply(e,l.clone()))}),m={},g(j.parse(n))}if(r.group===K){r=H.Utils.arrayMin(H.Utils.keys(r.symbols));if(r<0){var l=j.parse(p+"^"+Math.abs(r)),c=new Y(0);return e.each(function(e){c=j.add(c,j.multiply(e.clone(),l.clone()))},!0),c}}}}return n};if(ae.inverseFunctionSolve=function(e,t,n){var r=Z(t.args[0],p);if(r[1].group===J)return j.divide(j.symfunction(e,[j.divide(n,j.parse(t.multiplier))]),r[0])},(c=g(c)).equals(0))return[c];var d,v,u=H.Utils.keys(m);if(1===u.length&&(h=u[0],c.each(function(e,t){var n,r;!e.contains(p)||(e=(r=(n=Z(e,p))[1]).power).den.gt(1)&&(r.power=e.multiply(new H.Frac(h)),c.symbols[t]=j.multiply(r,n[0]))}),c=j.parse(c)),o(ae.sqrtSolve(c,p)),1===a)if(c.isPoly(!0)){var w=new H.Algebra.Classes.Factors;if(H.Algebra.Factor.factor(c,w),1<w.getNumberSymbolics())for(var y in w.factors)o(ue(w.factors[y],p));else{var b,S,M=(b=H.Utils.getCoeffs(c,p)).length-1,a=!1;r[0]===p&&(oe(b,function(e){return e.group!==H.groups.N})&&(r=H.Algebra.proots(c),oe(r,function(e){return!H.Utils.isInt(e)})&&(a=!0,r.map(function(e){o(new Y(e))}))),a||((n=j.parse(n))instanceof H.Equation&&(n=n.toLHS()),1===M?o(j.divide(b[0],b[1].negate())):2===M?o(j.expand(ae.quad.apply(void 0,b))):3===M?(i=[],S=H.Algebra.Factor.factor(n),0<(i=[]).length?o(i):o(ae.cubic.apply(void 0,b))):X.proots(c).map(o)))}}else try{for(var N,E,q=c.hasTrig(),x=ae.getPoints(c,.1),A=ae.getPoints(c,.05),C=ae.getPoints(c,.01),L=H.Utils.arrayUnique(x.concat(A).concat(C)).sort(function(e,t){return e-t}),I=Q(c.clone()),U=[],_=0;_<L.length;_++)N=L[_],void 0!==(E=ae.bisection(N,I))?o(E,q):U.push(N);var L=U,O=$.diff(c.clone()),R=Q(O);for(_=0;_<L.length;_++)N=L[_],o(ae.Newton(N,I,R),q);i.sort()}catch(e){console.log(e)}else if(!c.hasFunc(p)&&c.isComposite())try{if((S=H.Algebra.Factor.factor(c.clone())).group===ee)S.each(function(e){o(ue(e,p))});else{switch(M=(b=H.Utils.getCoeffs(c,p)).length-1){case 0:var T,P,k,D=(T=f(c))[0],F=T[1];D.group===H.groups.EX&&(k=`${P=H.Settings.LOG}((${F})/(${D.multiplier}))/${P}(${D.value})/${D.power.multiplier}`,o(j.parse(k)));break;case 1:o(j.divide(b[0],b[1].negate()));break;case 2:o(ae.quad.apply(void 0,b));break;case 3:o(ae.cubic.apply(void 0,b));break;case 4:o(ae.quartic.apply(void 0,b));break;default:o(ae.csolve(c,p)),0===i.length&&o(ae.divideAndConquer(c,p))}0===i.length&&o(ue(S,p,i,t))}}catch(e){}else try{var B,G=ae.rewrite(c,null,p),D=G[0],F=G[1];if(D.group===ne)"abs"===D.fname?o([F.clone(),F.negate()]):"sin"===D.fname?o(ae.inverseFunctionSolve("asin",D,F)):"cos"===D.fname?o(ae.inverseFunctionSolve("acos",D,F)):"tan"===D.fname?o(ae.inverseFunctionSolve("atan",D,F)):D.fname===H.Settings.LOG?(y=(B=Z(D.args[0],p))[1]).group===J&&(c=new se(y,F=j.divide(j.subtract(j.pow(1<D.args.length?D.args[1]:new Y("e"),j.divide(F,j.parse(D.multiplier))),B[3]),B[0])).toLHS(),o(ue(c,p))):o(j.subtract(D,F));else{var V=new se(D,F).toLHS();if(V.equals(c))throw new Error("Stopping. No stop condition exists");o(ue(V,p))}}catch(e){try{c.group===ee?o(0):c.group===te&&(D=(T=f(c))[0],F=T[1],D.group===H.groups.EX&&D.value===p&&(d=D.power.clone().invert(),o(j.pow(F,d))))}catch(e){}}return h&&(i=i.map(function(e){return j.pow(e,new Y(h))})),W(n)&&(v={},i=i.filter(function(e){try{v[p]=e;var t=Number(z(n,v));return isNaN(t)?!0:!0}catch(e){return!1}})),i};nerdamer.register([{name:"solveEquations",parent:"nerdamer",numargs:-1,visible:!0,build:function(){return ue}},{name:"solve",parent:"Solve",numargs:2,visible:!0,build:function(){return H.Solve.solve}},{name:"setEquation",parent:"Solve",visible:!0,build:function(){return e}}]),nerdamer.updateAPI()}(),"undefined"!=typeof module&&(nerdamer=require("./nerdamer.core.js"),require("./Calculus"),require("./Algebra")),function(){"use strict";var x=nerdamer.getCore(),A=x.PARSER,C=x.Symbol,L=x.Utils.format,a=x.Utils.isVector,u=x.Utils.isArray,I=(x.Vector,x.groups.S),U=(x.groups.EX,x.groups.CP),_=x.groups.CB,l=x.groups.FN;x.Settings.Laplace_integration_depth=40,C.prototype.findFunction=function(e){if(this.group===l&&this.fname===e)return this.clone();var t;if(this.symbols)for(var n in this.symbols)if(t=this.symbols[n].findFunction(e))break;return t};var O=x.Extra={version:"1.4.2",LaPlace:{transform:function(n,r,i){n=n.clone(),r=r.toString();var e=(n=C.unwrapSQRT(n,!0)).stripVar(r),t=n.group;if((n=A.divide(n,e.clone())).isConstant()||!n.contains(r,!0))o=A.parse(L("({0})/({1})",n,i));else if(t===I&&x.Utils.isInt(n.power))var s=String(n.power),o=A.parse(L("factorial({0})/({1})^({0}+1)",s,i));else if(n.group===I&&n.power.equals(.5))o=A.parse(L("sqrt(pi)/(2*({0})^(3/2))",i));else if(n.isComposite())o=new C(0),n.each(function(e){o=A.add(o,O.LaPlace.transform(e,r,i))},!0);else if(!n.isE()||n.power.group!==I&&n.power.group!==_)if(n.group!==l||-1===["sin","cos","sinh","cosh"].indexOf(n.fname)||n.args[0].group!==I&&n.args[0].group!==_){var a,s=x.Settings.integration_depth<x.Settings.Laplace_integration_depth;s&&(a=x.Settings.integration_depth,x.Settings.integration_depth=x.Settings.Laplace_integration_depth),x.Utils.block("PARSE2NUMBER",function(){var e=r,t=n.sub(r,e),t=A.parse("e^(-"+i+"*"+e+")*"+t);if((o=x.Calculus.integrate(t,e)).hasIntegral())return A.symfunction("laplace",arguments);o=o.sub(r,0),o=(o=A.expand(A.multiply(o,new C(-1)))).sub(e,r)},!1),o=x.Utils.block("PARSE2NUMBER",function(){return A.parse(o)},!0),s&&(x.Settings.integration_depth=a)}else{u=n.args[0].stripVar(r);switch(n.fname){case"sin":o=A.parse(L("({0})/(({1})^2+({0})^2)",u,i));break;case"cos":o=A.parse(L("({1})/(({1})^2+({0})^2)",u,i));break;case"sinh":o=A.parse(L("({0})/(({1})^2-({0})^2)",u,i));break;case"cosh":o=A.parse(L("({1})/(({1})^2-({0})^2)",u,i))}}else{var u=n.power.stripVar(r);o=A.parse(L("1/(({1})-({0}))",u,i))}return A.multiply(o,e)},inverse:function(M,N,E){var q=M.clone();return x.Utils.block("POSITIVE_MULTIPLIERS",function(){if((M=M.group===_?x.Algebra.PartFrac.partfrac(A.expand(M),N):M).group===I||M.group===_||M.isComposite()){var e,t,n,r,i,s,o,a,u,l,c,p,f,h,m,g=function(){(s=A.multiply(s,e)).multiplier=s.multiplier.multiply(M.multiplier),s=A.divide(s,r.a)},d=M.multiplier.clone();if(M.toUnitMultiplier(),e=M.getNum(),(t=M.getDenom().toUnitMultiplier()).group===U?(i=t.power.clone(),t.toLinear()):i=new x.Frac(1),n=N.toString(),r=x.Utils.decompose_fn(t,n,!0),x.Utils.decompose_fn(A.expand(e.clone()),n,!0),e.multiplier=e.multiplier.multiply(d),(t.group===I||t.group===_)&&r.x.value===n&&r.b.equals(0)&&x.Utils.isInt(r.x.power))p=r.x.power-1,f=x.Math2.factorial(p),s=A.divide(A.pow(E,new C(p)),new C(f)),g();else if(t.group===U&&i.equals(1))r.x.group===x.groups.PL&&x.Algebra.degree(t).equals(2)?(u=x.Algebra.sqComplete(t,n),l=x.Utils.getU(t),h=x.Utils.decompose_fn(u.a,n,!0).b,c=O.LaPlace.inverse(A.parse(`1/((${l})^2+(${u.c}))`),l,E),s=A.multiply(c,A.parse(`(${d})*e^(-(${h})*(${E}))`))):r.x.isLinear()&&!e.contains(n)?(E=A.divide(E,r.a.clone()),s=A.parse(L("(({0})^({3}-1)*e^(-(({2})*({0}))/({1})))/(({4})*({1})^({3}))",E,r.a,r.b,i,f=0===(p=i-1)||1===p?"1":`(${i}-1)!`)),g()):r.x.group===I&&r.x.power.equals(2)&&(e.contains(n)?(h=new C(1),e.group===_&&(o=new C(1),e.each(function(e){e.contains(n)?o=A.multiply(o,e):h=A.multiply(h,e)}),e=o),u=(a=x.Utils.decompose_fn(e,n,!0)).a,l=a.b,c=u.containsFunction("sin"),p=u.containsFunction("cos"),f=l.containsFunction("cos"),g=l.containsFunction("sin"),a.x.value===n&&a.x.isLinear()&&!(c&&f||p||g)?s=A.parse(L("(({1})*cos((sqrt(({2})*({3}))*({0}))/({2})))/({2})",E,a.a,r.a,r.b)):c&&f&&(c=u.findFunction("sin"),f=l.findFunction("cos"),c.args[0].equals(f.args[0])&&!c.args[0].contains(n)&&(v=A.divide(l,f.toUnitMultiplier()).toString(),f=c.args[0].toString(),m=r.b,c=A.divide(u,c.toUnitMultiplier()),s=A.parse(L("(({1})*({2})*cos({3})*sin(sqrt({4})*({0})))/sqrt({4})+({1})*sin({3})*({5})*cos(sqrt({4})*({0}))",E,h,v,f,m,c))))):s=A.parse(L("(({1})*sin((sqrt(({2})*({3}))*({0}))/({2})))/sqrt(({2})*({3}))",E,e,r.a,r.b)));else if(r.x.power.num&&r.x.power.num.equals(3)&&r.x.power.den.equals(2)&&e.contains("sqrt(pi)")&&!e.contains(n)&&e.isLinear()){var v=A.divide(e.clone(),A.parse("sqrt(pi)"));s=A.parse(L("(2*({2})*sqrt({0}))/({1})",E,r.a,v,e))}else if(i.equals(2)&&r.x.power.equals(2))if(e.contains(n))if((a=x.Utils.decompose_fn(A.expand(e.clone()),n,!0)).x.isComposite()){var w=[],y=e.collectSymbols(function(e){e=C.unwrapPARENS(e);var t=x.Utils.decompose_fn(e,n,!0);return t.symbol=e,t}).sort(function(e,t){e=e.x.value!==n?0:e.x.power;return(t.x.value!==n?0:t.x.power)-e});h=new C(-1);for(var b=0;b<y.length;b++){var S=y[b];S.x.value===n?w.push(S):h=A.multiply(h,S.symbol)}w[0].x.power.equals(2)&&w[1].x.power.equals(1)&&w[1].b.equals(0)&&!w[0].b.equals(0)&&(v=w[0].a.negate(),s=A.parse(L("-(({1})*({2})*({5})*({0})*sin((sqrt(({4})*({5}))*({0}))/({4})))/(2*({4})^2*sqrt(({4})*({5})))-(({1})*({3})*({0})*sin((sqrt(({4})*({5}))*({0}))/({4})))/(2*({4})*sqrt(({4})*({5})))+(({1})*({2})*cos((sqrt(({4})*({5}))*({0}))/({4})))/({4})^2",E,h,v,w[0].b,r.a,r.b)))}else a.x.isLinear()?(h=A.divide(a.a,new C(2)),s=A.parse(L("(({1})*({0})*sin((sqrt(({2})*({3}))*({0}))/({2})))/(({2})*sqrt(({2})*({3})))",E,h,r.a,r.b))):a.x.power.equals(2)&&(s=a.b.equals(0)?(h=A.divide(a.a,new C(2)),A.parse(L("(({1})*sin((sqrt(({2})*({3}))*({0}))/({2})))/(({2})*sqrt(({2})*({3})))+(({1})*({0})*cos((sqrt(({2})*({3}))*({0}))/({2})))/({2})^2",E,h,r.a,r.b))):(h=A.divide(a.a,new C(2)),m=a.b.negate(),A.parse(L("-((({2})*({4})-2*({1})*({3}))*sin((sqrt(({2})*({3}))*({0}))/({2})))/(2*({2})*({3})*sqrt(({2})*({3})))+(({4})*({0})*cos((sqrt(({2})*({3}))*({0}))/({2})))/(2*({2})*({3}))+(({1})*({0})*cos((sqrt(({2})*({3}))*({0}))/({2})))/({2})^2",E,h,r.a,r.b,m))));else h=A.divide(e,new C(2)),s=A.parse(L("(({1})*sin((sqrt(({2})*({3}))*({0}))/({2})))/(({3})*sqrt(({2})*({3})))-(({1})*({0})*cos((sqrt(({2})*({3}))*({0}))/({2})))/(({2})*({3}))",E,h,r.a,r.b));else M.isComposite()&&(i.equals(2)&&r.x.group===I?s=A.parse(`(${d})*(${E})*e^(-(${r.b})*(${E}))`):(s=new C(0),M.each(function(e){s=A.add(s,O.LaPlace.inverse(e,N,E))},!0)))}return s=s||A.symfunction("ilt",[q,N,E])},!0)}},Statistics:{frequencyMap:function(e){for(var t={},n=0,r=e.length;n<r;n++){var i=e[n].toString();t[i]||(t[i]=0),t[i]++}return t},sort:function(e){return e.sort(function(e,t){return e.isConstant()&&t.isConstant()||A.error("Unable to sort! All values must be numeric"),e.multiplier.subtract(t.multiplier)})},count:function(e){return new C(e.length)},sum:function(e,t){for(var n=new C(0),r=0,i=e.length;r<i;r++)var s=e[r].clone(),n=t?A.add(A.pow(A.subtract(s,t.clone()),new C(2)),n):A.add(s,n);return n},mean:function(){var e=[].slice.call(arguments);return a(e[0])?O.Statistics.mean.apply(this,e[0].elements):A.divide(O.Statistics.sum(e),O.Statistics.count(e))},median:function(){var t=[].slice.call(arguments);if(a(t[0]))return O.Statistics.median.apply(this,t[0].elements);try{var e,n,r=O.Statistics.sort(t),i=t.length;n=x.Utils.even(i)?(e=i/2,O.Statistics.mean(r[e-1],r[e])):r[Math.floor(i/2)]}catch(e){n=A.symfunction("median",t)}return n},mode:function(){var e=[].slice.call(arguments);if(a(e[0]))return O.Statistics.mode.apply(this,e[0].elements);var t=O.Statistics.frequencyMap(e);if(1===x.Utils.keys(t).length)o=e[0];else{var n,r={};for(n in t){var i,s=t[n];s in r?(i=r[s],u(i)?i.push(n):r[s]=[n,r[s]]):r[s]=n}var e=r[Math.max.apply(null,x.Utils.keys(r))],o=u(e)?A.symfunction("mode",e.sort()):A.parse(e)}return o},gVariance:function(e,t){var n=O.Statistics.mean.apply(O.Statistics,t),n=O.Statistics.sum(t,n);return A.multiply(e,n)},variance:function(){var e=[].slice.call(arguments);if(a(e[0]))return O.Statistics.variance.apply(this,e[0].elements);var t=A.divide(new C(1),O.Statistics.count(e));return O.Statistics.gVariance(t,e)},sampleVariance:function(){var e=[].slice.call(arguments);if(a(e[0]))return O.Statistics.sampleVariance.apply(this,e[0].elements);var t=A.divide(new C(1),A.subtract(O.Statistics.count(e),new C(1)));return O.Statistics.gVariance(t,e)},standardDeviation:function(){var e=[].slice.call(arguments);return a(e[0])?O.Statistics.standardDeviation.apply(this,e[0].elements):A.pow(O.Statistics.variance.apply(O.Statistics,e),new C(.5))},sampleStandardDeviation:function(){var e=[].slice.call(arguments);return a(e[0])?O.Statistics.sampleStandardDeviation.apply(this,e[0].elements):A.pow(O.Statistics.sampleVariance.apply(O.Statistics,e),new C(.5))},zScore:function(e,t,n){return A.divide(A.subtract(e,t),n)}},Units:{table:{foot:"12 inch",meter:"100 cm",decimeter:"10 cm"}}};nerdamer.register([{name:"laplace",visible:!0,numargs:3,build:function(){return O.LaPlace.transform}},{name:"ilt",visible:!0,numargs:3,build:function(){return O.LaPlace.inverse}},{name:"mean",visible:!0,numargs:-1,build:function(){return O.Statistics.mean}},{name:"median",visible:!0,numargs:-1,build:function(){return O.Statistics.median}},{name:"mode",visible:!0,numargs:-1,build:function(){return O.Statistics.mode}},{name:"smpvar",visible:!0,numargs:-1,build:function(){return O.Statistics.sampleVariance}},{name:"variance",visible:!0,numargs:-1,build:function(){return O.Statistics.variance}},{name:"smpstdev",visible:!0,numargs:-1,build:function(){return O.Statistics.sampleStandardDeviation}},{name:"stdev",visible:!0,numargs:-1,build:function(){return O.Statistics.standardDeviation}},{name:"zscore",visible:!0,numargs:3,build:function(){return O.Statistics.zScore}}]),nerdamer.updateAPI()}(),"undefined"!=typeof module&&(module.exports=nerdamer);