Icon representing a recipe

Recipe: ST - QuickStabilize ( w/ MVANN )

created by Seagat2011

Profile


Name
ST - QuickStabilize ( w/ MVANN )
ID
100593
Shared with
Public
Parent
None
Children
None
Created on
January 17, 2015 at 14:58 PM UTC
Updated on
January 17, 2015 at 14:58 PM UTC
Description

Use after a pull or a tug (after a pose-altering operation). Saveslot two (2) is used. Press Ctrl+N to restore best. This recipe incorporates an Anthropic Dreams experimental Majority Vote Adaptive Neural Network. Recipe is not compatible with Exploratory Puzzles. Note: If the recipe does not detect a fruitful stabilization technique, it wil abort the round back to the user. (Some users may not be accustomed to this.)

Best for


Code


--[[------------------------------------------------------------------------------------------------ ST-QuickStabilize w/ MVANN -recipe - v1.0 -- Majority Vote, Adaptive Neural Network-Based QuickStabilize Copyright (C) 2015 Seagat2011 <http://fold.it/port/user/1992490> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ------------------------------------------------------------------------------------------------]]-- --[[ v1.0 - inception - Added g_keyparts_archive[] (performance) - fixed Hebbian weight (post-stabilization) index bug - Increased the separation boundary between sh and wa stabilizers (NeuralNet calibration) - Added subscoreHISTORY attributes to primaryKey - Added addToSubscoreStack and pushToSubscoreStack methods to g_obj object factory __import ( NeuralNetBestScoringScorePartsPrimer.5.lua ) __import ( ST-QuickStabilize_MVANN_data1.xml ) __import ( PrimaryKey_Pruner.5.lua ) __import ( PercentOfSubscore.2.lua ) __import ( PrimaryKey_Refactor.lua ) __import ( LUA_os_timer_object.lua ) __import ( NumberToBinary.2.lua ) __import ( serializeObject.lua ) __import ( Binary2Decimal.lua ) __import ( Number2Unary.lua ) __import ( SelectCase.lua ) __import ( system.var ) __import ( qtest.lua ) - Substantially expanded Hebbian weights - Imported pruning algorithm to induce Hebbian saturation, and prevent unbounded growth of the g_GlobalKey {} library - Imported Lua SELECT statement construct - revised returnTYPE g_buildKey:buildKey_subscoreFRACTION() (toBinary(), deprecated; export new toUnary() as bitstring) - revised returnTYPE g_buildKey:buildKey_percentSubscoreGAIN_HISTORY() (toBinary(), deprecated; export new toUnary() as bitstring) - NeuralNet Performance consistently now above 92% with the above changes - further training (updated weights) - further training (updated weights) - discovered Prune() algorithm was causing string pollution in PrimaryKey library (patched) - further training (updated weights) - reverted completely from binary PrimaryKeys, upgraded to Unary. Unary keys meet the orthogonality test, and are less susceptible to overtraining. - Added group-related customizations (eg. implement a user-specified recipe upon completion (see line 2268, line 2349)) - This MVANN is modeled using an (N)2240-2-1-1 purelin/purelin-hardlim-hardlims-compet NeuralNet, where N = Number of Protein segments ]]-- --local g_numScoreParts = 10 local g_version = 'v1.6' local g_thresh = 0.9948 -- 99.48% local g_minPPI = 1e6--0.001 local g_minNPGAIN = 0.1 local g_saveslot = 1 -- saveslot for structure (after Nudge) -- local g_tempslot = 2 -- tmp saveslot -- local g_verbose = true -- show score parts output to screen -- local g_idx = 1 local g_idx2 = structure.GetCount () local g_wiggle_mult = 1--3 -- wiggle( iters * g_wiggle_mult ) -- local g_nResolution = 1 -- initial Number of iPattern objects local g_nOutputs = 10 -- length of output history buffer -- local g_maxExtremumDEPTH = 10--4 -- maximum depth to sort score-parts -- local platform = ui.GetPlatform () local system = { x86_64 = (string.find ( platform, '(64)' )),ZERO = -1e-4 } --[[-------OBJECT------------- Description: compet(a) = wp + b, where p[i] and p[i+n] are orthogonal vectors (inner dot products sum to zero), and b is the secant, offset, or bias (set to zero) and w = g_Hebbianweight; each Hebbian weight is generated via the permutation of a (1) context-sensitive PrimaryKey, p, (distilled in the g_GlobalKey library) and a (2) target pattern targetQSTAB object member, generated by iPattern 1. a[i][k] = w[i][j] * p[j][k] + b bit-value Legend 1: true 0: false -------------------------]]-- local wt_compet = { [1]={[1]=1,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,}, [2]={[1]=0,[2]=1,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,}, [3]={[1]=0,[2]=0,[3]=1,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,}, [4]={[1]=0,[2]=0,[3]=0,[4]=1,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,}, [5]={[1]=0,[2]=0,[3]=0,[4]=0,[5]=1,[6]=0,[7]=0,[8]=0,[9]=0,[10]=0,}, [6]={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=1,[7]=0,[8]=0,[9]=0,[10]=0,}, [7]={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=1,[8]=0,[9]=0,[10]=0,}, [8]={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=1,[9]=0,[10]=0,}, [9]={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=1,[10]=0,}, [10]={[1]=0,[2]=0,[3]=0,[4]=0,[5]=0,[6]=0,[7]=0,[8]=0,[9]=0,[10]=1,}, } -- wt_compet {} -- --[[-------OBJECT------------- Description: satlins(a) = wp + b, where p[i] and p[i+n] are orthogonal vectors (inner dot products sum to zero), and b is the secant, offset, or bias (set to zero) and w = g_Hebbianweight; each Hebbian weight is generated via the permutation of a (1) context-sensitive PrimaryKey, p, (distilled in the g_GlobalKey library) and a (2) target pattern targetQSTAB object member, generated by iPattern 1. a[i][k] = w[i][j] * p[j][k] + b bit-value Legend 1: 1 (true) -1: 0 (false) 0: wildcard (dont care) Training Duration: 1,000 iterations (10 hours) -------------------------]]-- local wt_satlins = { [4]={[1]= 0,[2]=-1,[3]=-1,[4]= 0,[5]=-1,[6]=-1,[7]=-1,[8]= 0,[9]=-1,[10]=-1,[11]= 0,[12]= 0,[13]=-1,[14]= 0,[15]=-1,[16]=-1,[17]= 0,[18]= 0,[19]=-1,[20]=-1,[21]= 0,[22]= 0,[23]=-1,[24]= 0,[25]=-1,[26]=-1,[27]= 0,[28]= 0,[29]=-1,[30]=-1,[31]= 0,[32]= 0,[33]=-1,[34]= 0,[35]=-1,[36]=-1,[37]= 0,[38]= 0,[39]=-1,[40]=-1,[41]= 0,[42]= 0,[43]=-1,[44]= 0,[45]=-1,[46]= 0,[47]=-1,[48]=-1,[49]= 0,[50]=-1,[51]= 0,[52]=-1,[53]=-1,[54]=-1,[55]=-1,[56]= 0,[57]=-1,[58]=-1,[59]= 0,[60]=-1,[61]= 0,[62]=-1,[63]=-1,[64]=-1,[65]=-1,[66]=-1,[67]=-1,[68]=-1,[69]= 0,[70]= 0,[71]= 0,[72]=-1,[73]=-1,[74]=-1,[75]= 0,[76]=-1,[77]=-1,[78]=-1,[79]=-1,[80]= 0,[81]= 0,[82]=-1,[83]=-1,[84]=-1,[85]= 0,[86]=-1,[87]=-1,[88]=-1,[89]= 0,[90]=-1,[91]=-1,[92]=-1,[93]= 1,[94]=-1,[95]=-1,[96]=-1,[97]=-1,[98]=-1,[99]=-1,[100]=-1,[101]= 1,[102]=-1,[103]=-1,[104]=-1,[105]=-1,[106]=-1,[107]=-1,[108]=-1,[109]=-1,[110]=-1,[111]=-1,[112]=-1,[113]=-1,[114]=-1,[115]=-1,[116]=-1,[117]=-1,[118]=-1,[119]=-1,[120]=-1,[121]=-1,[122]=-1,[123]=-1,[124]=-1,[125]=-1,[126]=-1,[127]=-1,[128]=-1,[129]=-1,[130]=-1,[131]=-1,[132]=-1,[133]=-1,[134]=-1,[135]=-1,[136]=-1,[137]=-1,[138]=-1,[139]=-1,[140]=-1,[141]=-1,[142]=-1,[143]=-1,[144]=-1,[145]=-1,[146]=-1,[147]=-1,[148]=-1,[149]=-1,[150]=-1,[151]=-1,[152]=-1,[153]=-1,[154]=-1,[155]=-1,[156]=-1,[157]=-1,[158]=-1,[159]=-1,[160]=-1,[161]=-1,[162]= 0,[163]=-1,[164]=-1,[165]= 0,[166]=-1,[167]=-1,[168]=-1,[169]= 0,[170]=-1,[171]=-1,[172]=-1,[173]=-1,[174]=-1,[175]=-1,[176]=-1,[177]= 0,[178]=-1,[179]= 0,[180]=-1,[181]= 0,[182]=-1,[183]= 0,[184]= 0,[185]= 0,[186]= 0,[187]= 0,[188]=-1,[189]=-1,[190]=-1,[191]=-1,[192]=-1,[193]=-1,[194]=-1,[195]=-1,[196]=-1,[197]=-1,[198]=-1,[199]=-1,[200]=-1,[201]=-1,[202]=-1,[203]= 1,[204]=-1,[205]=-1,[206]=-1,[207]=-1,[208]=-1,[209]=-1,[210]=-1,[211]=-1,[212]=-1,[213]=-1,[214]=-1,[215]=-1,[216]=-1,[217]=-1,[218]=-1,[219]=-1,[220]=-1,[221]=-1,[222]=-1,[223]=-1,[224]=-1,[225]=-1,[226]=-1,[227]=-1,[228]=-1,[229]=-1,[230]=-1,[231]=-1,[232]=-1,[233]=-1,[234]=-1,[235]=-1,[236]=-1,[237]=-1,[238]=-1,[239]=-1,[240]=-1,[241]=-1,[242]=-1,[243]=-1,[244]=-1,[245]=-1,[246]=-1,[247]=-1,[248]=-1,[249]=-1,[250]=-1,[251]=-1,[252]=-1,[253]=-1,[254]=-1,[255]=-1,[256]=-1,[257]=-1,[258]=-1,[259]=-1,[260]=-1,[261]=-1,[262]=-1,[263]=-1,[264]=-1,[265]=-1,[266]=-1,[267]=-1,[268]=-1,[269]=-1,[270]=-1,[271]=-1,[272]=-1,[273]=-1,[274]=-1,[275]=-1,[276]= 0,[277]=-1,[278]=-1,[279]=-1,[280]=-1,[281]= 0,[282]= 0,[283]= 0,[284]= 0,[285]=-1,[286]=-1,[287]= 0,[288]= 0,[289]= 0,[290]= 0,[291]=-1,[292]= 0,[293]= 0,[294]=-1,[295]= 0,[296]=-1,[297]=-1,[298]=-1,[299]=-1,[300]=-1,[301]=-1,[302]=-1,[303]=-1,[304]=-1,[305]= 1,[306]=-1,[307]=-1,[308]=-1,[309]=-1,[310]=-1,[311]=-1,[312]=-1,[313]=-1,[314]=-1,[315]=-1,[316]=-1,[317]=-1,[318]=-1,[319]=-1,[320]=-1,[321]=-1,[322]=-1,[323]=-1,[324]=-1,[325]=-1,[326]=-1,[327]=-1,[328]=-1,[329]=-1,[330]=-1,[331]=-1,[332]=-1,[333]=-1,[334]=-1,[335]=-1,[336]=-1,[337]=-1,[338]=-1,[339]=-1,[340]=-1,[341]=-1,[342]=-1,[343]=-1,[344]=-1,[345]=-1,[346]=-1,[347]=-1,[348]=-1,[349]=-1,[350]=-1,[351]=-1,[352]=-1,[353]=-1,[354]=-1,[355]=-1,[356]=-1,[357]=-1,[358]=-1,[359]=-1,[360]=-1,[361]=-1,[362]=-1,[363]=-1,[364]=-1,[365]=-1,[366]=-1,[367]=-1,[368]=-1,[369]=-1,[370]=-1,[371]=-1,[372]=-1,[373]=-1,[374]=-1,[375]=-1,[376]=-1,[377]=-1,[378]=-1,[379]=-1,[380]=-1,[381]=-1,[382]=-1,[383]=-1,[384]=-1,[385]=-1,[386]=-1,[387]=-1,[388]=-1,[389]=-1,[390]=-1,[391]=-1,[392]= 0,[393]= 0,[394]= 0,[395]= 0,[396]= 0,[397]= 0,[398]=-1,[399]=-1,[400]=-1,[401]= 0,[402]=-1,[403]=-1,[404]=-1,[405]=-1,[406]=-1,[407]= 1,[408]=-1,[409]=-1,[410]=-1,[411]=-1,[412]=-1,[413]=-1,[414]=-1,[415]=-1,[416]=-1,[417]=-1,[418]=-1,[419]=-1,[420]=-1,[421]=-1,[422]=-1,[423]=-1,[424]=-1,[425]=-1,[426]=-1,[427]=-1,[428]=-1,[429]=-1,[430]=-1,[431]=-1,[432]=-1,[433]=-1,[434]=-1,[435]=-1,[436]=-1,[437]=-1,[438]=-1,[439]=-1,[440]=-1,[441]=-1,[442]=-1,[443]=-1,[444]=-1,[445]=-1,[446]=-1,[447]=-1,[448]=-1,[449]=-1,[450]=-1,[451]=-1,[452]=-1,[453]=-1,[454]=-1,[455]=-1,[456]=-1,[457]=-1,[458]=-1,[459]=-1,[460]=-1,[461]=-1,[462]=-1,[463]=-1,[464]=-1,[465]=-1,[466]=-1,[467]=-1,[468]=-1,[469]=-1,[470]=-1,[471]=-1,[472]=-1,[473]=-1,[474]=-1,[475]=-1,[476]=-1,[477]=-1,[478]=-1,[479]=-1,[480]=-1,[481]=-1,[482]=-1,[483]=-1,[484]=-1,[485]=-1,[486]=-1,[487]=-1,[488]=-1,[489]=-1,[490]=-1,[491]=-1,[492]=-1,[493]=-1,[494]=-1,[495]=-1,[496]= 0,[497]= 0,[498]= 0,[499]= 0,[500]= 0,[501]= 0,[502]= 0,[503]= 0,[504]= 0,[505]=-1,[506]=-1,[507]=-1,[508]=-1,[509]= 0,[510]=-1,[511]=-1,[512]=-1,[513]=-1,[514]=-1,[515]=-1,[516]=-1,[517]=-1,[518]=-1,[519]=-1,[520]=-1,[521]=-1,[522]=-1,[523]=-1,[524]=-1,[525]=-1,[526]=-1,[527]=-1,[528]=-1,[529]=-1,[530]=-1,[531]=-1,[532]=-1,[533]=-1,[534]=-1,[535]=-1,[536]=-1,[537]=-1,[538]=-1,[539]=-1,[540]=-1,[541]=-1,[542]=-1,[543]=-1,[544]=-1,[545]=-1,[546]=-1,[547]=-1,[548]=-1,[549]=-1,[550]=-1,[551]=-1,[552]=-1,[553]=-1,[554]=-1,[555]=-1,[556]=-1,[557]=-1,[558]=-1,[559]=-1,[560]=-1,[561]=-1,[562]=-1,[563]=-1,[564]=-1,[565]=-1,[566]=-1,[567]=-1,[568]=-1,[569]=-1,[570]=-1,[571]=-1,[572]=-1,[573]=-1,[574]=-1,[575]=-1,[576]=-1,[577]=-1,[578]=-1,[579]=-1,[580]=-1,[581]=-1,[582]=-1,[583]=-1,[584]=-1,[585]=-1,[586]=-1,[587]=-1,[588]=-1,[589]=-1,[590]=-1,[591]=-1,[592]=-1,[593]=-1,[594]=-1,[595]=-1,[596]=-1,[597]=-1,[598]=-1,[599]=-1,[600]=-1,[601]=-1,[602]=-1,[603]=-1,[604]= 0,[605]= 0,[606]= 0,[607]= 0,[608]= 0,[609]= 0,[610]= 0,[611]= 0,[612]=-1,[613]=-1,[614]=-1,[615]=-1,[616]=-1,[617]=-1,[618]=-1,[619]=-1,[620]=-1,[621]=-1,[622]=-1,[623]=-1,[624]=-1,[625]=-1,[626]=-1,[627]=-1,[628]=-1,[629]=-1,[630]=-1,[631]=-1,[632]=-1,[633]=-1,[634]=-1,[635]=-1,[636]=-1,[637]=-1,[638]=-1,[639]=-1,[640]=-1,[641]=-1,[642]=-1,[643]=-1,[644]=-1,[645]=-1,[646]=-1,[647]=-1,[648]=-1,[649]=-1,[650]=-1,[651]=-1,[652]=-1,[653]=-1,[654]=-1,[655]=-1,[656]=-1,[657]=-1,[658]=-1,[659]=-1,[660]=-1,[661]=-1,[662]=-1,[663]=-1,[664]=-1,[665]=-1,[666]=-1,[667]=-1,[668]=-1,[669]=-1,[670]=-1,[671]=-1,[672]=-1,[673]=-1,[674]=-1,[675]=-1,[676]=-1,[677]=-1,[678]=-1,[679]=-1,[680]=-1,[681]=-1,[682]=-1,[683]=-1,[684]=-1,[685]=-1,[686]=-1,[687]=-1,[688]=-1,[689]=-1,[690]=-1,[691]=-1,[692]=-1,[693]=-1,[694]=-1,[695]=-1,[696]=-1,[697]=-1,[698]=-1,[699]=-1,[700]=-1,[701]=-1,[702]=-1,[703]=-1,[704]=-1,[705]=-1,[706]=-1,[707]= 0,[708]=-1,[709]= 0,[710]= 0,[711]= 0,[712]= 0,[713]=-1,[714]=-1,[715]=-1,[716]=-1,[717]=-1,[718]=-1,[719]=-1,[720]=-1,[721]=-1,[722]=-1,[723]=-1,[724]=-1,[725]=-1,[726]=-1,[727]=-1,[728]=-1,[729]=-1,[730]=-1,[731]=-1,[732]=-1,[733]=-1,[734]=-1,[735]=-1,[736]=-1,[737]=-1,[738]=-1,[739]=-1,[740]=-1,[741]=-1,[742]=-1,[743]=-1,[744]=-1,[745]=-1,[746]=-1,[747]=-1,[748]=-1,[749]=-1,[750]=-1,[751]=-1,[752]=-1,[753]=-1,[754]=-1,[755]=-1,[756]=-1,[757]=-1,[758]=-1,[759]=-1,[760]=-1,[761]=-1,[762]=-1,[763]=-1,[764]=-1,[765]=-1,[766]=-1,[767]=-1,[768]=-1,[769]=-1,[770]=-1,[771]=-1,[772]=-1,[773]=-1,[774]=-1,[775]=-1,[776]=-1,[777]=-1,[778]=-1,[779]=-1,[780]=-1,[781]=-1,[782]=-1,[783]=-1,[784]=-1,[785]=-1,[786]=-1,[787]=-1,[788]=-1,[789]=-1,[790]=-1,[791]=-1,[792]=-1,[793]=-1,[794]=-1,[795]=-1,[796]=-1,[797]=-1,[798]=-1,[799]=-1,[800]=-1,[801]=-1,[802]=-1,[803]=-1,[804]=-1,[805]=-1,[806]=-1,[807]=-1,[808]=-1,[809]=-1,[810]= 0,[811]= 0,[812]= 0,[813]= 0,[814]=-1,[815]=-1,[816]=-1,[817]=-1,[818]=-1,[819]=-1,[820]=-1,[821]=-1,[822]=-1,[823]=-1,[824]=-1,[825]=-1,[826]=-1,[827]=-1,[828]=-1,[829]=-1,[830]=-1,[831]=-1,[832]=-1,[833]=-1,[834]=-1,[835]=-1,[836]=-1,[837]=-1,[838]=-1,[839]=-1,[840]=-1,[841]=-1,[842]=-1,[843]=-1,[844]=-1,[845]=-1,[846]=-1,[847]=-1,[848]=-1,[849]=-1,[850]=-1,[851]=-1,[852]=-1,[853]=-1,[854]=-1,[855]=-1,[856]=-1,[857]=-1,[858]=-1,[859]=-1,[860]=-1,[861]=-1,[862]=-1,[863]=-1,[864]=-1,[865]=-1,[866]=-1,[867]=-1,[868]=-1,[869]=-1,[870]=-1,[871]=-1,[872]=-1,[873]=-1,[874]=-1,[875]=-1,[876]=-1,[877]=-1,[878]=-1,[879]=-1,[880]=-1,[881]=-1,[882]=-1,[883]=-1,[884]=-1,[885]=-1,[886]=-1,[887]=-1,[888]=-1,[889]=-1,[890]=-1,[891]=-1,[892]=-1,[893]=-1,[894]=-1,[895]=-1,[896]=-1,[897]=-1,[898]=-1,[899]=-1,[900]=-1,[901]=-1,[902]=-1,[903]=-1,[904]=-1,[905]=-1,[906]=-1,[907]=-1,[908]=-1,[909]=-1,[910]= 0,[911]= 0,[912]= 0,[913]= 0,[914]= 0,[915]= 0,[916]=-1,[917]=-1,[918]=-1,[919]=-1,[920]=-1,[921]=-1,[922]=-1,[923]=-1,[924]=-1,[925]=-1,[926]=-1,[927]=-1,[928]=-1,[929]=-1,[930]=-1,[931]=-1,[932]=-1,[933]=-1,[934]=-1,[935]=-1,[936]=-1,[937]=-1,[938]=-1,[939]=-1,[940]=-1,[941]=-1,[942]=-1,[943]=-1,[944]=-1,[945]=-1,[946]=-1,[947]=-1,[948]=-1,[949]=-1,[950]=-1,[951]=-1,[952]=-1,[953]=-1,[954]=-1,[955]=-1,[956]=-1,[957]=-1,[958]=-1,[959]=-1,[960]=-1,[961]=-1,[962]=-1,[963]=-1,[964]=-1,[965]=-1,[966]=-1,[967]=-1,[968]=-1,[969]=-1,[970]=-1,[971]=-1,[972]=-1,[973]=-1,[974]=-1,[975]=-1,[976]=-1,[977]=-1,[978]=-1,[979]=-1,[980]=-1,[981]=-1,[982]=-1,[983]=-1,[984]=-1,[985]=-1,[986]=-1,[987]=-1,[988]=-1,[989]=-1,[990]=-1,[991]=-1,[992]=-1,[993]=-1,[994]=-1,[995]=-1,[996]=-1,[997]=-1,[998]=-1,[999]=-1,[1000]=-1,[1001]=-1,[1002]=-1,[1003]=-1,[1004]=-1,[1005]=-1,[1006]=-1,[1007]=-1,[1008]= 0,[1009]= 0,[1010]= 0,[1011]= 0,[1012]= 0,[1013]= 0,[1014]= 0,[1015]= 0,[1016]= 0,[1017]= 0,[1018]=-1,[1019]=-1,[1020]=-1,[1021]=-1,[1022]=-1,[1023]=-1,[1024]=-1,[1025]=-1,[1026]=-1,[1027]=-1,[1028]=-1,[1029]=-1,[1030]=-1,[1031]=-1,[1032]=-1,[1033]=-1,[1034]=-1,[1035]=-1,[1036]=-1,[1037]=-1,[1038]=-1,[1039]=-1,[1040]=-1,[1041]=-1,[1042]=-1,[1043]=-1,[1044]=-1,[1045]=-1,[1046]=-1,[1047]=-1,[1048]=-1,[1049]=-1,[1050]=-1,[1051]=-1,[1052]=-1,[1053]=-1,[1054]=-1,[1055]=-1,[1056]=-1,[1057]=-1,[1058]=-1,[1059]=-1,[1060]=-1,[1061]=-1,[1062]=-1,[1063]=-1,[1064]=-1,[1065]=-1,[1066]=-1,[1067]=-1,[1068]=-1,[1069]=-1,[1070]=-1,[1071]=-1,[1072]=-1,[1073]=-1,[1074]=-1,[1075]=-1,[1076]=-1,[1077]=-1,[1078]= 0,[1079]= 0,[1080]=-1,[1081]= 0,[1082]= 0,[1083]= 0,[1084]= 0,[1085]=-1,[1086]= 0,[1087]= 0,[1088]= 0,[1089]= 0,[1090]= 0,[1091]= 0,[1092]= 0,[1093]= 0,[1094]= 0,[1095]=-1,[1096]=-1,[1097]=-1,[1098]= 0,[1099]= 0,[1100]= 0,[1101]=-1,[1102]=-1,[1103]=-1,[1104]=-1,[1105]=-1,[1106]= 0,[1107]=-1,[1108]=-1,[1109]= 0,[1110]=-1,[1111]=-1,[1112]= 0,[1113]=-1,[1114]=-1,[1115]=-1,[1116]=-1,[1117]=-1,[1118]=-1,[1119]=-1,[1120]=-1,[1121]= 0,[1122]=-1,[1123]=-1,[1124]=-1,[1125]=-1,[1126]=-1,[1127]=-1,[1128]=-1,[1129]=-1,[1130]=-1,[1131]=-1,[1132]=-1,[1133]=-1,[1134]=-1,[1135]=-1,[1136]=-1,[1137]=-1,[1138]=-1,[1139]=-1,[1140]=-1,[1141]=-1,[1142]=-1,[1143]=-1,[1144]=-1,[1145]=-1,[1146]=-1,[1147]=-1,[1148]=-1,[1149]=-1,[1150]=-1,[1151]=-1,[1152]=-1,[1153]=-1,[1154]=-1,[1155]=-1,[1156]=-1,[1157]=-1,[1158]=-1,[1159]=-1,[1160]= 0,[1161]=-1,[1162]=-1,[1163]=-1,[1164]=-1,[1165]=-1,[1166]=-1,[1167]= 0,[1168]=-1,[1169]=-1,[1170]=-1,[1171]=-1,[1172]=-1,[1173]=-1,[1174]=-1,[1175]=-1,[1176]=-1,[1177]=-1,[1178]=-1,[1179]=-1,[1180]= 0,[1181]=-1,[1182]=-1,[1183]=-1,[1184]=-1,[1185]=-1,[1186]=-1,[1187]=-1,[1188]=-1,[1189]=-1,[1190]=-1,[1191]=-1,[1192]=-1,[1193]=-1,[1194]=-1,[1195]=-1,[1196]=-1,[1197]= 0,[1198]=-1,[1199]=-1,[1200]=-1,[1201]=-1,[1202]=-1,[1203]= 0,[1204]= 0,[1205]= 0,[1206]= 0,[1207]= 0,[1208]= 0,[1209]= 0,[1210]= 0,[1211]=-1,[1212]= 0,[1213]= 0,[1214]= 0,[1215]= 0,[1216]= 0,[1217]= 0,[1218]= 0,[1219]= 0,[1220]= 0,[1221]= 0,[1222]= 0,[1223]= 0,[1224]=-1,[1225]=-1,[1226]=-1,[1227]=-1,[1228]=-1,[1229]=-1,[1230]=-1,[1231]=-1,[1232]=-1,[1233]=-1,[1234]=-1,[1235]=-1,[1236]=-1,[1237]=-1,[1238]=-1,[1239]=-1,[1240]=-1,[1241]=-1,[1242]=-1,[1243]=-1,[1244]=-1,[1245]=-1,[1246]=-1,[1247]=-1,[1248]=-1,[1249]=-1,[1250]=-1,[1251]=-1,[1252]=-1,[1253]=-1,[1254]=-1,[1255]=-1,[1256]=-1,[1257]=-1,[1258]=-1,[1259]=-1,[1260]=-1,[1261]=-1,[1262]= 0,[1263]=-1,[1264]=-1,[1265]=-1,[1266]=-1,[1267]=-1,[1268]=-1,[1269]= 0,[1270]=-1,[1271]=-1,[1272]=-1,[1273]=-1,[1274]=-1,[1275]=-1,[1276]=-1,[1277]=-1,[1278]=-1,[1279]=-1,[1280]=-1,[1281]=-1,[1282]=-1,[1283]=-1,[1284]=-1,[1285]=-1,[1286]=-1,[1287]=-1,[1288]=-1,[1289]=-1,[1290]=-1,[1291]=-1,[1292]= 0,[1293]=-1,[1294]=-1,[1295]=-1,[1296]=-1,[1297]=-1,[1298]=-1,[1299]= 0,[1300]=-1,[1301]=-1,[1302]=-1,[1303]=-1,[1304]=-1,[1305]= 0,[1306]= 0,[1307]= 0,[1308]= 0,[1309]= 0,[1310]= 0,[1311]= 0,[1312]= 0,[1313]=-1,[1314]=-1,[1315]= 0,[1316]= 0,[1317]= 0,[1318]= 0,[1319]= 0,[1320]= 0,[1321]= 0,[1322]= 0,[1323]= 0,[1324]= 0,[1325]= 0,[1326]=-1,[1327]=-1,[1328]=-1,[1329]=-1,[1330]=-1,[1331]=-1,[1332]=-1,[1333]=-1,[1334]=-1,[1335]=-1,[1336]=-1,[1337]=-1,[1338]=-1,[1339]=-1,[1340]=-1,[1341]=-1,[1342]=-1,[1343]=-1,[1344]=-1,[1345]=-1,[1346]=-1,[1347]=-1,[1348]=-1,[1349]=-1,[1350]=-1,[1351]=-1,[1352]=-1,[1353]=-1,[1354]=-1,[1355]=-1,[1356]=-1,[1357]=-1,[1358]=-1,[1359]=-1,[1360]=-1,[1361]=-1,[1362]=-1,[1363]=-1,[1364]= 0,[1365]=-1,[1366]=-1,[1367]=-1,[1368]=-1,[1369]=-1,[1370]=-1,[1371]= 0,[1372]=-1,[1373]=-1,[1374]=-1,[1375]=-1,[1376]=-1,[1377]=-1,[1378]=-1,[1379]=-1,[1380]=-1,[1381]=-1,[1382]=-1,[1383]=-1,[1384]= 0,[1385]=-1,[1386]=-1,[1387]=-1,[1388]=-1,[1389]=-1,[1390]=-1,[1391]=-1,[1392]=-1,[1393]=-1,[1394]= 0,[1395]=-1,[1396]=-1,[1397]=-1,[1398]=-1,[1399]=-1,[1400]=-1,[1401]= 0,[1402]=-1,[1403]=-1,[1404]=-1,[1405]=-1,[1406]=-1,[1407]= 0,[1408]= 0,[1409]= 0,[1410]= 0,[1411]= 0,[1412]= 0,[1413]= 0,[1414]= 0,[1415]=-1,[1416]=-1,[1417]= 0,[1418]= 0,[1419]= 0,[1420]= 0,[1421]= 0,[1422]= 0,[1423]= 0,[1424]= 0,[1425]= 0,[1426]= 0,[1427]= 0,[1428]=-1,[1429]=-1,[1430]=-1,[1431]=-1,[1432]=-1,[1433]=-1,[1434]=-1,[1435]=-1,[1436]=-1,[1437]=-1,[1438]=-1,[1439]=-1,[1440]=-1,[1441]=-1,[1442]=-1,[1443]=-1,[1444]=-1,[1445]=-1,[1446]=-1,[1447]=-1,[1448]=-1,[1449]=-1,[1450]=-1,[1451]=-1,[1452]=-1,[1453]=-1,[1454]=-1,[1455]=-1,[1456]=-1,[1457]=-1,[1458]=-1,[1459]=-1,[1460]=-1,[1461]=-1,[1462]=-1,[1463]=-1,[1464]=-1,[1465]=-1,[1466]= 0,[1467]=-1,[1468]=-1,[1469]=-1,[1470]=-1,[1471]=-1,[1472]=-1,[1473]= 0,[1474]=-1,[1475]=-1,[1476]=-1,[1477]=-1,[1478]=-1,[1479]=-1,[1480]=-1,[1481]=-1,[1482]=-1,[1483]=-1,[1484]=-1,[1485]=-1,[1486]= 0,[1487]=-1,[1488]=-1,[1489]=-1,[1490]=-1,[1491]=-1,[1492]=-1,[1493]=-1,[1494]=-1,[1495]=-1,[1496]= 0,[1497]=-1,[1498]=-1,[1499]=-1,[1500]=-1,[1501]=-1,[1502]=-1,[1503]= 0,[1504]=-1,[1505]=-1,[1506]=-1,[1507]=-1,[1508]=-1,[1509]= 0,[1510]= 0,[1511]= 0,[1512]= 0,[1513]= 0,[1514]= 0,[1515]= 0,[1516]= 0,[1517]=-1,[1518]= 0,[1519]= 0,[1520]= 0,[1521]= 0,[1522]= 0,[1523]= 0,[1524]= 0,[1525]= 0,[1526]= 0,[1527]= 0,[1528]= 0,[1529]= 0,[1530]=-1,[1531]=-1,[1532]=-1,[1533]=-1,[1534]=-1,[1535]=-1,[1536]=-1,[1537]=-1,[1538]=-1,[1539]=-1,[1540]=-1,[1541]=-1,[1542]=-1,[1543]=-1,[1544]=-1,[1545]=-1,[1546]=-1,[1547]=-1,[1548]=-1,[1549]=-1,[1550]=-1,[1551]=-1,[1552]=-1,[1553]=-1,[1554]=-1,[1555]=-1,[1556]=-1,[1557]=-1,[1558]=-1,[1559]=-1,[1560]=-1,[1561]=-1,[1562]=-1,[1563]=-1,[1564]=-1,[1565]=-1,[1566]=-1,[1567]=-1,[1568]= 0,[1569]=-1,[1570]=-1,[1571]=-1,[1572]=-1,[1573]=-1,[1574]=-1,[1575]= 0,[1576]=-1,[1577]=-1,[1578]=-1,[1579]=-1,[1580]=-1,[1581]=-1,[1582]=-1,[1583]=-1,[1584]=-1,[1585]=-1,[1586]=-1,[1587]=-1,[1588]= 0,[1589]=-1,[1590]=-1,[1591]=-1,[1592]=-1,[1593]=-1,[1594]=-1,[1595]=-1,[1596]=-1,[1597]=-1,[1598]= 0,[1599]=-1,[1600]=-1,[1601]=-1,[1602]=-1,[1603]=-1,[1604]=-1,[1605]= 0,[1606]=-1,[1607]=-1,[1608]=-1,[1609]=-1,[1610]=-1,[1611]= 0,[1612]= 0,[1613]= 0,[1614]= 0,[1615]= 0,[1616]= 0,[1617]= 0,[1618]= 0,[1619]=-1,[1620]=-1,[1621]= 0,[1622]= 0,[1623]= 0,[1624]= 0,[1625]= 0,[1626]= 0,[1627]= 0,[1628]= 0,[1629]= 0,[1630]= 0,[1631]= 0,[1632]=-1,[1633]=-1,[1634]=-1,[1635]=-1,[1636]=-1,[1637]=-1,[1638]=-1,[1639]=-1,[1640]=-1,[1641]=-1,[1642]=-1,[1643]=-1,[1644]=-1,[1645]=-1,[1646]=-1,[1647]=-1,[1648]=-1,[1649]=-1,[1650]=-1,[1651]=-1,[1652]=-1,[1653]=-1,[1654]=-1,[1655]=-1,[1656]=-1,[1657]=-1,[1658]=-1,[1659]=-1,[1660]=-1,[1661]=-1,[1662]=-1,[1663]=-1,[1664]=-1,[1665]=-1,[1666]=-1,[1667]=-1,[1668]=-1,[1669]=-1,[1670]= 0,[1671]=-1,[1672]=-1,[1673]=-1,[1674]=-1,[1675]=-1,[1676]=-1,[1677]= 0,[1678]=-1,[1679]=-1,[1680]=-1,[1681]=-1,[1682]=-1,[1683]=-1,[1684]=-1,[1685]=-1,[1686]=-1,[1687]=-1,[1688]=-1,[1689]=-1,[1690]= 0,[1691]=-1,[1692]=-1,[1693]=-1,[1694]=-1,[1695]=-1,[1696]=-1,[1697]=-1,[1698]=-1,[1699]=-1,[1700]= 0,[1701]=-1,[1702]=-1,[1703]=-1,[1704]=-1,[1705]=-1,[1706]=-1,[1707]= 0,[1708]=-1,[1709]=-1,[1710]=-1,[1711]=-1,[1712]=-1,[1713]= 0,[1714]= 0,[1715]= 0,[1716]= 0,[1717]= 0,[1718]= 0,[1719]= 0,[1720]=-1,[1721]=-1,[1722]=-1,[1723]= 0,[1724]= 0,[1725]= 0,[1726]= 0,[1727]= 0,[1728]= 0,[1729]= 0,[1730]= 0,[1731]= 0,[1732]= 0,[1733]= 0,[1734]=-1,[1735]=-1,[1736]=-1,[1737]=-1,[1738]=-1,[1739]=-1,[1740]=-1,[1741]=-1,[1742]=-1,[1743]=-1,[1744]=-1,[1745]=-1,[1746]=-1,[1747]=-1,[1748]=-1,[1749]=-1,[1750]=-1,[1751]=-1,[1752]=-1,[1753]=-1,[1754]=-1,[1755]=-1,[1756]=-1,[1757]=-1,[1758]=-1,[1759]=-1,[1760]=-1,[1761]=-1,[1762]=-1,[1763]=-1,[1764]=-1,[1765]=-1,[1766]=-1,[1767]=-1,[1768]=-1,[1769]=-1,[1770]=-1,[1771]=-1,[1772]= 0,[1773]=-1,[1774]=-1,[1775]=-1,[1776]=-1,[1777]=-1,[1778]=-1,[1779]= 0,[1780]=-1,[1781]=-1,[1782]=-1,[1783]=-1,[1784]=-1,[1785]=-1,[1786]=-1,[1787]=-1,[1788]=-1,[1789]=-1,[1790]=-1,[1791]=-1,[1792]= 0,[1793]=-1,[1794]=-1,[1795]=-1,[1796]=-1,[1797]=-1,[1798]=-1,[1799]=-1,[1800]=-1,[1801]=-1,[1802]= 0,[1803]=-1,[1804]=-1,[1805]=-1,[1806]=-1,[1807]=-1,[1808]=-1,[1809]= 0,[1810]=-1,[1811]=-1,[1812]=-1,[1813]=-1,[1814]=-1,[1815]= 0,[1816]= 0,[1817]= 0,[1818]= 0,[1819]= 0,[1820]= 0,[1821]= 0,[1822]= 0,[1823]=-1,[1824]= 0,[1825]= 0,[1826]= 0,[1827]= 0,[1828]= 0,[1829]= 0,[1830]= 0,[1831]= 0,[1832]= 0,[1833]= 0,[1834]= 0,[1835]= 0,[1836]=-1,[1837]=-1,[1838]=-1,[1839]=-1,[1840]=-1,[1841]=-1,[1842]=-1,[1843]=-1,[1844]=-1,[1845]=-1,[1846]=-1,[1847]=-1,[1848]=-1,[1849]=-1,[1850]=-1,[1851]=-1,[1852]=-1,[1853]=-1,[1854]=-1,[1855]=-1,[1856]=-1,[1857]=-1,[1858]=-1,[1859]=-1,[1860]=-1,[1861]=-1,[1862]=-1,[1863]=-1,[1864]=-1,[1865]=-1,[1866]=-1,[1867]=-1,[1868]=-1,[1869]=-1,[1870]=-1,[1871]=-1,[1872]=-1,[1873]=-1,[1874]= 0,[1875]=-1,[1876]=-1,[1877]=-1,[1878]=-1,[1879]=-1,[1880]=-1,[1881]= 0,[1882]=-1,[1883]=-1,[1884]=-1,[1885]=-1,[1886]=-1,[1887]=-1,[1888]=-1,[1889]=-1,[1890]=-1,[1891]=-1,[1892]=-1,[1893]=-1,[1894]= 0,[1895]=-1,[1896]=-1,[1897]=-1,[1898]=-1,[1899]=-1,[1900]=-1,[1901]=-1,[1902]=-1,[1903]=-1,[1904]= 0,[1905]=-1,[1906]=-1,[1907]=-1,[1908]=-1,[1909]=-1,[1910]=-1,[1911]= 0,[1912]=-1,[1913]=-1,[1914]=-1,[1915]=-1,[1916]=-1,[1917]= 0,[1918]= 0,[1919]= 0,[1920]= 0,[1921]= 0,[1922]= 0,[1923]= 0,[1924]= 0,[1925]=-1,[1926]=-1,[1927]= 0,[1928]= 0,[1929]= 0,[1930]= 0,[1931]= 0,[1932]= 0,[1933]= 0,[1934]= 0,[1935]= 0,[1936]= 0,[1937]= 0,[1938]=-1,[1939]=-1,[1940]=-1,[1941]=-1,[1942]=-1,[1943]=-1,[1944]=-1,[1945]=-1,[1946]=-1,[1947]=-1,[1948]=-1,[1949]=-1,[1950]=-1,[1951]=-1,[1952]=-1,[1953]=-1,[1954]=-1,[1955]=-1,[1956]=-1,[1957]=-1,[1958]=-1,[1959]=-1,[1960]=-1,[1961]=-1,[1962]=-1,[1963]=-1,[1964]=-1,[1965]=-1,[1966]=-1,[1967]=-1,[1968]=-1,[1969]=-1,[1970]=-1,[1971]=-1,[1972]=-1,[1973]=-1,[1974]=-1,[1975]=-1,[1976]= 0,[1977]=-1,[1978]=-1,[1979]=-1,[1980]=-1,[1981]=-1,[1982]=-1,[1983]= 0,[1984]=-1,[1985]=-1,[1986]=-1,[1987]=-1,[1988]=-1,[1989]=-1,[1990]=-1,[1991]=-1,[1992]=-1,[1993]=-1,[1994]=-1,[1995]=-1,[1996]= 0,[1997]=-1,[1998]=-1,[1999]=-1,[2000]=-1,[2001]=-1,[2002]=-1,[2003]=-1,[2004]=-1,[2005]=-1,[2006]= 0,[2007]=-1,[2008]=-1,[2009]=-1,[2010]=-1,[2011]=-1,[2012]=-1,[2013]= 0,[2014]=-1,[2015]=-1,[2016]=-1,[2017]=-1,[2018]=-1,[2019]= 0,[2020]= 0,[2021]= 0,[2022]= 0,[2023]= 0,[2024]= 0,[2025]= 0,[2026]=-1,[2027]=-1,[2028]= 0,[2029]= 0,[2030]= 0,[2031]= 0,[2032]= 0,[2033]= 0,[2034]= 0,[2035]= 0,[2036]= 0,[2037]= 0,[2038]= 0,[2039]= 0,[2040]=-1,[2041]=-1,[2042]=-1,[2043]=-1,[2044]=-1,[2045]=-1,[2046]=-1,[2047]=-1,[2048]=-1,[2049]=-1,[2050]=-1,[2051]=-1,[2052]=-1,[2053]=-1,[2054]=-1,[2055]=-1,[2056]=-1,[2057]=-1,[2058]=-1,[2059]=-1,[2060]=-1,[2061]=-1,[2062]=-1,[2063]=-1,[2064]=-1,[2065]=-1,[2066]=-1,[2067]=-1,[2068]=-1,[2069]=-1,[2070]=-1,[2071]=-1,[2072]=-1,[2073]=-1,[2074]=-1,[2075]=-1,[2076]=-1,[2077]=-1,[2078]= 0,[2079]=-1,[2080]=-1,[2081]=-1,[2082]=-1,[2083]=-1,[2084]=-1,[2085]= 0,[2086]=-1,[2087]=-1,[2088]=-1,[2089]=-1,[2090]=-1,[2091]=-1,[2092]=-1,[2093]=-1,[2094]=-1,[2095]=-1,[2096]=-1,[2097]=-1,[2098]= 0,[2099]=-1,[2100]=-1,[2101]=-1,[2102]=-1,[2103]=-1,[2104]=-1,[2105]=-1,[2106]=-1,[2107]=-1,[2108]=-1,[2109]=-1,[2110]=-1,[2111]=-1,[2112]=-1,[2113]=-1,[2114]=-1,[2115]= 0,[2116]=-1,[2117]=-1,[2118]=-1,[2119]=-1,[2120]=-1,[2121]= 0,[2122]= 0,[2123]= 0,[2124]= 0,[2125]= 0,[2126]= 0,[2127]= 0,[2128]= 0,[2129]=-1,[2130]= 0,[2131]= 0,[2132]= 0,[2133]= 0,[2134]= 0,[2135]= 0,[2136]= 0,[2137]= 0,[2138]= 0,[2139]= 0,[2140]= 0,[2141]= 0,[2142]= 0,[2143]= 0,[2144]= 0,[2145]=-1,[2146]=-1,[2147]=-1,[2148]=-1,[2149]=-1,[2150]=-1,[2151]= 0,[2152]= 0,[2153]= 0,[2154]= 0,[2155]=-1,[2156]=-1,[2157]=-1,[2158]=-1,[2159]=-1,[2160]=-1,[2161]= 0,[2162]= 0,[2163]= 0,[2164]= 0,[2165]=-1,[2166]=-1,[2167]=-1,[2168]=-1,[2169]=-1,[2170]=-1,[2171]= 0,[2172]= 0,[2173]= 0,[2174]= 0,[2175]=-1,[2176]=-1,[2177]=-1,[2178]=-1,[2179]=-1,[2180]=-1,[2181]= 0,[2182]= 0,[2183]= 0,[2184]= 0,[2185]=-1,[2186]=-1,[2187]=-1,[2188]=-1,[2189]=-1,[2190]=-1,[2191]= 0,[2192]= 0,[2193]= 0,[2194]= 0,[2195]=-1,[2196]=-1,[2197]=-1,[2198]=-1,[2199]=-1,[2200]=-1,[2201]= 0,[2202]= 0,[2203]= 0,[2204]= 0,[2205]=-1,[2206]=-1,[2207]=-1,[2208]=-1,[2209]=-1,[2210]=-1,[2211]= 0,[2212]= 0,[2213]= 0,[2214]= 0,[2215]=-1,[2216]=-1,[2217]=-1,[2218]=-1,[2219]=-1,[2220]=-1,[2221]= 0,[2222]= 0,[2223]= 0,[2224]= 0,[2225]=-1,[2226]=-1,[2227]=-1,[2228]=-1,[2229]=-1,[2230]=-1,[2231]= 0,[2232]= 0,[2233]= 0,[2234]= 0,[2235]=-1,[2236]=-1,[2237]=-1,[2238]=-1,[2239]=-1,[2240]=-1,}, [2]={[1]= 0,[2]=-1,[3]=-1,[4]= 0,[5]=-1,[6]=-1,[7]=-1,[8]=-1,[9]=-1,[10]=-1,[11]=-1,[12]= 0,[13]=-1,[14]=-1,[15]=-1,[16]=-1,[17]=-1,[18]= 0,[19]=-1,[20]=-1,[21]=-1,[22]=-1,[23]=-1,[24]=-1,[25]=-1,[26]=-1,[27]= 0,[28]= 0,[29]=-1,[30]=-1,[31]= 0,[32]=-1,[33]=-1,[34]= 0,[35]=-1,[36]=-1,[37]=-1,[38]=-1,[39]=-1,[40]=-1,[41]=-1,[42]= 0,[43]=-1,[44]=-1,[45]=-1,[46]=-1,[47]= 0,[48]=-1,[49]=-1,[50]=-1,[51]=-1,[52]=-1,[53]=-1,[54]=-1,[55]=-1,[56]= 1,[57]=-1,[58]=-1,[59]=-1,[60]=-1,[61]=-1,[62]=-1,[63]=-1,[64]=-1,[65]=-1,[66]=-1,[67]=-1,[68]=-1,[69]= 1,[70]=-1,[71]=-1,[72]=-1,[73]=-1,[74]=-1,[75]=-1,[76]=-1,[77]=-1,[78]=-1,[79]=-1,[80]= 1,[81]=-1,[82]=-1,[83]=-1,[84]=-1,[85]= 1,[86]=-1,[87]=-1,[88]=-1,[89]=-1,[90]=-1,[91]=-1,[92]=-1,[93]= 1,[94]=-1,[95]=-1,[96]=-1,[97]=-1,[98]=-1,[99]=-1,[100]=-1,[101]= 1,[102]=-1,[103]=-1,[104]=-1,[105]=-1,[106]=-1,[107]=-1,[108]=-1,[109]=-1,[110]=-1,[111]=-1,[112]=-1,[113]=-1,[114]=-1,[115]=-1,[116]=-1,[117]=-1,[118]=-1,[119]=-1,[120]=-1,[121]=-1,[122]=-1,[123]=-1,[124]=-1,[125]=-1,[126]=-1,[127]=-1,[128]=-1,[129]=-1,[130]=-1,[131]=-1,[132]=-1,[133]=-1,[134]=-1,[135]=-1,[136]=-1,[137]=-1,[138]=-1,[139]=-1,[140]=-1,[141]=-1,[142]=-1,[143]=-1,[144]=-1,[145]=-1,[146]=-1,[147]=-1,[148]=-1,[149]=-1,[150]=-1,[151]=-1,[152]=-1,[153]=-1,[154]=-1,[155]=-1,[156]= 0,[157]=-1,[158]=-1,[159]=-1,[160]=-1,[161]=-1,[162]=-1,[163]=-1,[164]=-1,[165]=-1,[166]=-1,[167]=-1,[168]=-1,[169]=-1,[170]=-1,[171]=-1,[172]=-1,[173]=-1,[174]=-1,[175]=-1,[176]=-1,[177]=-1,[178]=-1,[179]=-1,[180]=-1,[181]=-1,[182]=-1,[183]=-1,[184]=-1,[185]= 0,[186]= 0,[187]=-1,[188]=-1,[189]=-1,[190]=-1,[191]=-1,[192]=-1,[193]=-1,[194]=-1,[195]=-1,[196]=-1,[197]=-1,[198]=-1,[199]=-1,[200]=-1,[201]=-1,[202]=-1,[203]= 1,[204]=-1,[205]=-1,[206]=-1,[207]=-1,[208]=-1,[209]=-1,[210]=-1,[211]=-1,[212]=-1,[213]=-1,[214]=-1,[215]=-1,[216]=-1,[217]=-1,[218]=-1,[219]=-1,[220]=-1,[221]=-1,[222]=-1,[223]=-1,[224]=-1,[225]=-1,[226]=-1,[227]=-1,[228]=-1,[229]=-1,[230]=-1,[231]=-1,[232]=-1,[233]=-1,[234]=-1,[235]=-1,[236]=-1,[237]=-1,[238]=-1,[239]=-1,[240]=-1,[241]=-1,[242]=-1,[243]=-1,[244]=-1,[245]=-1,[246]=-1,[247]=-1,[248]=-1,[249]=-1,[250]=-1,[251]=-1,[252]=-1,[253]=-1,[254]=-1,[255]=-1,[256]=-1,[257]=-1,[258]=-1,[259]=-1,[260]= 0,[261]=-1,[262]=-1,[263]=-1,[264]=-1,[265]=-1,[266]=-1,[267]=-1,[268]=-1,[269]=-1,[270]=-1,[271]=-1,[272]=-1,[273]=-1,[274]=-1,[275]=-1,[276]=-1,[277]=-1,[278]=-1,[279]=-1,[280]=-1,[281]=-1,[282]=-1,[283]=-1,[284]=-1,[285]=-1,[286]=-1,[287]=-1,[288]=-1,[289]= 0,[290]= 0,[291]=-1,[292]=-1,[293]=-1,[294]=-1,[295]=-1,[296]=-1,[297]=-1,[298]=-1,[299]=-1,[300]=-1,[301]=-1,[302]=-1,[303]=-1,[304]=-1,[305]= 1,[306]=-1,[307]=-1,[308]=-1,[309]=-1,[310]=-1,[311]=-1,[312]=-1,[313]=-1,[314]=-1,[315]=-1,[316]=-1,[317]=-1,[318]=-1,[319]=-1,[320]=-1,[321]=-1,[322]=-1,[323]=-1,[324]=-1,[325]=-1,[326]=-1,[327]=-1,[328]=-1,[329]=-1,[330]=-1,[331]=-1,[332]=-1,[333]=-1,[334]=-1,[335]=-1,[336]=-1,[337]=-1,[338]=-1,[339]=-1,[340]=-1,[341]=-1,[342]=-1,[343]=-1,[344]=-1,[345]=-1,[346]=-1,[347]=-1,[348]=-1,[349]=-1,[350]=-1,[351]=-1,[352]=-1,[353]=-1,[354]=-1,[355]=-1,[356]=-1,[357]=-1,[358]=-1,[359]=-1,[360]=-1,[361]=-1,[362]=-1,[363]=-1,[364]=-1,[365]=-1,[366]=-1,[367]=-1,[368]=-1,[369]=-1,[370]=-1,[371]=-1,[372]=-1,[373]=-1,[374]=-1,[375]=-1,[376]=-1,[377]=-1,[378]=-1,[379]=-1,[380]=-1,[381]=-1,[382]=-1,[383]=-1,[384]=-1,[385]=-1,[386]=-1,[387]=-1,[388]=-1,[389]=-1,[390]=-1,[391]=-1,[392]=-1,[393]=-1,[394]=-1,[395]= 0,[396]= 0,[397]=-1,[398]=-1,[399]=-1,[400]=-1,[401]=-1,[402]=-1,[403]= 0,[404]=-1,[405]=-1,[406]=-1,[407]= 1,[408]=-1,[409]=-1,[410]=-1,[411]=-1,[412]=-1,[413]=-1,[414]=-1,[415]=-1,[416]=-1,[417]=-1,[418]=-1,[419]=-1,[420]=-1,[421]=-1,[422]=-1,[423]=-1,[424]=-1,[425]=-1,[426]=-1,[427]=-1,[428]=-1,[429]=-1,[430]=-1,[431]=-1,[432]=-1,[433]=-1,[434]=-1,[435]=-1,[436]=-1,[437]=-1,[438]=-1,[439]=-1,[440]=-1,[441]=-1,[442]=-1,[443]=-1,[444]=-1,[445]=-1,[446]=-1,[447]=-1,[448]=-1,[449]=-1,[450]=-1,[451]=-1,[452]=-1,[453]=-1,[454]=-1,[455]=-1,[456]=-1,[457]=-1,[458]=-1,[459]=-1,[460]=-1,[461]=-1,[462]=-1,[463]=-1,[464]=-1,[465]=-1,[466]=-1,[467]=-1,[468]=-1,[469]=-1,[470]=-1,[471]=-1,[472]=-1,[473]=-1,[474]=-1,[475]=-1,[476]=-1,[477]=-1,[478]=-1,[479]=-1,[480]=-1,[481]=-1,[482]=-1,[483]=-1,[484]=-1,[485]=-1,[486]=-1,[487]=-1,[488]=-1,[489]=-1,[490]=-1,[491]=-1,[492]=-1,[493]=-1,[494]=-1,[495]=-1,[496]=-1,[497]=-1,[498]=-1,[499]=-1,[500]= 0,[501]= 0,[502]=-1,[503]=-1,[504]=-1,[505]=-1,[506]=-1,[507]= 0,[508]=-1,[509]= 1,[510]=-1,[511]=-1,[512]=-1,[513]=-1,[514]=-1,[515]=-1,[516]=-1,[517]=-1,[518]=-1,[519]=-1,[520]=-1,[521]=-1,[522]=-1,[523]=-1,[524]=-1,[525]=-1,[526]=-1,[527]=-1,[528]=-1,[529]=-1,[530]=-1,[531]=-1,[532]=-1,[533]=-1,[534]=-1,[535]=-1,[536]=-1,[537]=-1,[538]=-1,[539]=-1,[540]=-1,[541]=-1,[542]=-1,[543]=-1,[544]=-1,[545]=-1,[546]=-1,[547]=-1,[548]=-1,[549]=-1,[550]=-1,[551]=-1,[552]=-1,[553]=-1,[554]=-1,[555]=-1,[556]=-1,[557]=-1,[558]=-1,[559]=-1,[560]=-1,[561]=-1,[562]=-1,[563]=-1,[564]=-1,[565]=-1,[566]=-1,[567]=-1,[568]=-1,[569]=-1,[570]=-1,[571]=-1,[572]=-1,[573]=-1,[574]=-1,[575]=-1,[576]=-1,[577]=-1,[578]=-1,[579]=-1,[580]=-1,[581]=-1,[582]=-1,[583]=-1,[584]=-1,[585]=-1,[586]=-1,[587]=-1,[588]=-1,[589]=-1,[590]=-1,[591]=-1,[592]=-1,[593]=-1,[594]=-1,[595]=-1,[596]=-1,[597]=-1,[598]=-1,[599]=-1,[600]=-1,[601]=-1,[602]=-1,[603]=-1,[604]=-1,[605]=-1,[606]= 0,[607]= 0,[608]=-1,[609]= 0,[610]=-1,[611]= 0,[612]=-1,[613]=-1,[614]=-1,[615]=-1,[616]=-1,[617]=-1,[618]=-1,[619]=-1,[620]=-1,[621]=-1,[622]=-1,[623]=-1,[624]=-1,[625]=-1,[626]=-1,[627]=-1,[628]=-1,[629]=-1,[630]=-1,[631]=-1,[632]=-1,[633]=-1,[634]=-1,[635]=-1,[636]=-1,[637]=-1,[638]=-1,[639]=-1,[640]=-1,[641]=-1,[642]=-1,[643]=-1,[644]=-1,[645]=-1,[646]=-1,[647]=-1,[648]=-1,[649]=-1,[650]=-1,[651]=-1,[652]=-1,[653]=-1,[654]=-1,[655]=-1,[656]=-1,[657]=-1,[658]=-1,[659]=-1,[660]=-1,[661]=-1,[662]=-1,[663]=-1,[664]=-1,[665]=-1,[666]=-1,[667]=-1,[668]=-1,[669]=-1,[670]=-1,[671]=-1,[672]=-1,[673]=-1,[674]=-1,[675]=-1,[676]=-1,[677]=-1,[678]=-1,[679]=-1,[680]=-1,[681]=-1,[682]=-1,[683]=-1,[684]=-1,[685]=-1,[686]=-1,[687]=-1,[688]=-1,[689]=-1,[690]=-1,[691]=-1,[692]=-1,[693]=-1,[694]=-1,[695]=-1,[696]=-1,[697]=-1,[698]=-1,[699]=-1,[700]=-1,[701]=-1,[702]=-1,[703]=-1,[704]=-1,[705]=-1,[706]=-1,[707]=-1,[708]=-1,[709]= 0,[710]= 0,[711]=-1,[712]= 0,[713]=-1,[714]=-1,[715]=-1,[716]=-1,[717]=-1,[718]=-1,[719]=-1,[720]=-1,[721]=-1,[722]=-1,[723]=-1,[724]=-1,[725]=-1,[726]=-1,[727]=-1,[728]=-1,[729]=-1,[730]=-1,[731]=-1,[732]=-1,[733]=-1,[734]=-1,[735]=-1,[736]=-1,[737]=-1,[738]=-1,[739]=-1,[740]=-1,[741]=-1,[742]=-1,[743]=-1,[744]=-1,[745]=-1,[746]=-1,[747]=-1,[748]=-1,[749]=-1,[750]=-1,[751]=-1,[752]=-1,[753]=-1,[754]=-1,[755]=-1,[756]=-1,[757]=-1,[758]=-1,[759]=-1,[760]=-1,[761]=-1,[762]=-1,[763]=-1,[764]=-1,[765]=-1,[766]=-1,[767]=-1,[768]=-1,[769]=-1,[770]=-1,[771]=-1,[772]=-1,[773]=-1,[774]=-1,[775]=-1,[776]=-1,[777]=-1,[778]=-1,[779]=-1,[780]=-1,[781]=-1,[782]=-1,[783]=-1,[784]=-1,[785]=-1,[786]=-1,[787]=-1,[788]=-1,[789]=-1,[790]=-1,[791]=-1,[792]=-1,[793]=-1,[794]=-1,[795]=-1,[796]=-1,[797]=-1,[798]=-1,[799]=-1,[800]=-1,[801]=-1,[802]=-1,[803]=-1,[804]=-1,[805]=-1,[806]=-1,[807]=-1,[808]=-1,[809]=-1,[810]=-1,[811]=-1,[812]= 0,[813]= 0,[814]=-1,[815]=-1,[816]=-1,[817]=-1,[818]=-1,[819]=-1,[820]=-1,[821]=-1,[822]=-1,[823]=-1,[824]=-1,[825]=-1,[826]=-1,[827]=-1,[828]=-1,[829]=-1,[830]=-1,[831]=-1,[832]=-1,[833]=-1,[834]=-1,[835]=-1,[836]=-1,[837]=-1,[838]=-1,[839]=-1,[840]=-1,[841]=-1,[842]=-1,[843]=-1,[844]=-1,[845]=-1,[846]=-1,[847]=-1,[848]=-1,[849]=-1,[850]=-1,[851]=-1,[852]=-1,[853]=-1,[854]=-1,[855]=-1,[856]=-1,[857]=-1,[858]=-1,[859]=-1,[860]=-1,[861]=-1,[862]=-1,[863]=-1,[864]=-1,[865]=-1,[866]=-1,[867]=-1,[868]=-1,[869]=-1,[870]=-1,[871]=-1,[872]=-1,[873]=-1,[874]=-1,[875]=-1,[876]=-1,[877]=-1,[878]=-1,[879]=-1,[880]=-1,[881]=-1,[882]=-1,[883]=-1,[884]=-1,[885]=-1,[886]=-1,[887]=-1,[888]=-1,[889]=-1,[890]=-1,[891]=-1,[892]=-1,[893]=-1,[894]=-1,[895]=-1,[896]=-1,[897]=-1,[898]=-1,[899]=-1,[900]=-1,[901]=-1,[902]=-1,[903]=-1,[904]=-1,[905]=-1,[906]=-1,[907]=-1,[908]=-1,[909]=-1,[910]=-1,[911]=-1,[912]= 0,[913]= 0,[914]=-1,[915]= 0,[916]=-1,[917]=-1,[918]=-1,[919]=-1,[920]=-1,[921]=-1,[922]=-1,[923]=-1,[924]=-1,[925]=-1,[926]=-1,[927]=-1,[928]=-1,[929]=-1,[930]=-1,[931]=-1,[932]=-1,[933]=-1,[934]=-1,[935]=-1,[936]=-1,[937]=-1,[938]=-1,[939]=-1,[940]=-1,[941]=-1,[942]=-1,[943]=-1,[944]=-1,[945]=-1,[946]=-1,[947]=-1,[948]=-1,[949]=-1,[950]=-1,[951]=-1,[952]=-1,[953]=-1,[954]=-1,[955]=-1,[956]=-1,[957]=-1,[958]=-1,[959]=-1,[960]=-1,[961]=-1,[962]=-1,[963]=-1,[964]=-1,[965]=-1,[966]=-1,[967]=-1,[968]=-1,[969]=-1,[970]=-1,[971]=-1,[972]=-1,[973]=-1,[974]=-1,[975]=-1,[976]=-1,[977]=-1,[978]=-1,[979]=-1,[980]=-1,[981]=-1,[982]=-1,[983]=-1,[984]=-1,[985]=-1,[986]=-1,[987]=-1,[988]=-1,[989]=-1,[990]=-1,[991]=-1,[992]=-1,[993]=-1,[994]=-1,[995]=-1,[996]=-1,[997]=-1,[998]=-1,[999]=-1,[1000]=-1,[1001]=-1,[1002]=-1,[1003]=-1,[1004]=-1,[1005]=-1,[1006]=-1,[1007]=-1,[1008]=-1,[1009]=-1,[1010]=-1,[1011]=-1,[1012]=-1,[1013]= 0,[1014]=-1,[1015]=-1,[1016]=-1,[1017]= 0,[1018]=-1,[1019]=-1,[1020]=-1,[1021]=-1,[1022]=-1,[1023]=-1,[1024]=-1,[1025]=-1,[1026]=-1,[1027]=-1,[1028]=-1,[1029]=-1,[1030]=-1,[1031]=-1,[1032]=-1,[1033]=-1,[1034]=-1,[1035]=-1,[1036]=-1,[1037]=-1,[1038]=-1,[1039]=-1,[1040]=-1,[1041]=-1,[1042]=-1,[1043]=-1,[1044]=-1,[1045]=-1,[1046]=-1,[1047]=-1,[1048]=-1,[1049]=-1,[1050]=-1,[1051]=-1,[1052]=-1,[1053]=-1,[1054]=-1,[1055]=-1,[1056]=-1,[1057]=-1,[1058]=-1,[1059]=-1,[1060]=-1,[1061]=-1,[1062]=-1,[1063]=-1,[1064]=-1,[1065]=-1,[1066]=-1,[1067]=-1,[1068]=-1,[1069]=-1,[1070]=-1,[1071]=-1,[1072]=-1,[1073]=-1,[1074]=-1,[1075]=-1,[1076]=-1,[1077]=-1,[1078]=-1,[1079]=-1,[1080]=-1,[1081]=-1,[1082]=-1,[1083]=-1,[1084]=-1,[1085]=-1,[1086]= 0,[1087]= 0,[1088]=-1,[1089]=-1,[1090]=-1,[1091]=-1,[1092]=-1,[1093]=-1,[1094]=-1,[1095]=-1,[1096]=-1,[1097]=-1,[1098]=-1,[1099]=-1,[1100]=-1,[1101]=-1,[1102]=-1,[1103]=-1,[1104]=-1,[1105]=-1,[1106]=-1,[1107]=-1,[1108]=-1,[1109]=-1,[1110]=-1,[1111]=-1,[1112]=-1,[1113]=-1,[1114]=-1,[1115]=-1,[1116]=-1,[1117]= 0,[1118]=-1,[1119]=-1,[1120]=-1,[1121]= 0,[1122]=-1,[1123]=-1,[1124]=-1,[1125]=-1,[1126]=-1,[1127]=-1,[1128]=-1,[1129]=-1,[1130]=-1,[1131]=-1,[1132]=-1,[1133]=-1,[1134]=-1,[1135]=-1,[1136]=-1,[1137]=-1,[1138]=-1,[1139]=-1,[1140]=-1,[1141]=-1,[1142]=-1,[1143]=-1,[1144]=-1,[1145]=-1,[1146]=-1,[1147]=-1,[1148]=-1,[1149]=-1,[1150]=-1,[1151]=-1,[1152]=-1,[1153]=-1,[1154]=-1,[1155]=-1,[1156]=-1,[1157]=-1,[1158]=-1,[1159]=-1,[1160]=-1,[1161]=-1,[1162]=-1,[1163]=-1,[1164]=-1,[1165]=-1,[1166]=-1,[1167]=-1,[1168]=-1,[1169]=-1,[1170]=-1,[1171]=-1,[1172]=-1,[1173]=-1,[1174]=-1,[1175]=-1,[1176]=-1,[1177]=-1,[1178]=-1,[1179]=-1,[1180]=-1,[1181]=-1,[1182]=-1,[1183]=-1,[1184]=-1,[1185]=-1,[1186]=-1,[1187]=-1,[1188]=-1,[1189]=-1,[1190]=-1,[1191]=-1,[1192]=-1,[1193]=-1,[1194]=-1,[1195]=-1,[1196]=-1,[1197]=-1,[1198]=-1,[1199]=-1,[1200]=-1,[1201]=-1,[1202]=-1,[1203]=-1,[1204]=-1,[1205]=-1,[1206]=-1,[1207]=-1,[1208]=-1,[1209]=-1,[1210]=-1,[1211]=-1,[1212]=-1,[1213]=-1,[1214]=-1,[1215]=-1,[1216]=-1,[1217]=-1,[1218]=-1,[1219]=-1,[1220]=-1,[1221]= 0,[1222]= 0,[1223]= 0,[1224]=-1,[1225]=-1,[1226]=-1,[1227]=-1,[1228]=-1,[1229]=-1,[1230]=-1,[1231]=-1,[1232]=-1,[1233]=-1,[1234]=-1,[1235]=-1,[1236]=-1,[1237]=-1,[1238]=-1,[1239]=-1,[1240]=-1,[1241]=-1,[1242]=-1,[1243]=-1,[1244]=-1,[1245]=-1,[1246]=-1,[1247]=-1,[1248]=-1,[1249]=-1,[1250]=-1,[1251]=-1,[1252]=-1,[1253]=-1,[1254]=-1,[1255]=-1,[1256]=-1,[1257]=-1,[1258]=-1,[1259]=-1,[1260]=-1,[1261]=-1,[1262]=-1,[1263]=-1,[1264]=-1,[1265]=-1,[1266]=-1,[1267]=-1,[1268]=-1,[1269]=-1,[1270]=-1,[1271]=-1,[1272]=-1,[1273]=-1,[1274]=-1,[1275]=-1,[1276]=-1,[1277]=-1,[1278]=-1,[1279]=-1,[1280]=-1,[1281]=-1,[1282]=-1,[1283]=-1,[1284]=-1,[1285]=-1,[1286]=-1,[1287]=-1,[1288]=-1,[1289]=-1,[1290]=-1,[1291]=-1,[1292]=-1,[1293]=-1,[1294]=-1,[1295]=-1,[1296]=-1,[1297]=-1,[1298]=-1,[1299]=-1,[1300]=-1,[1301]=-1,[1302]=-1,[1303]=-1,[1304]=-1,[1305]=-1,[1306]=-1,[1307]=-1,[1308]=-1,[1309]=-1,[1310]=-1,[1311]=-1,[1312]=-1,[1313]=-1,[1314]=-1,[1315]=-1,[1316]=-1,[1317]=-1,[1318]= 0,[1319]=-1,[1320]=-1,[1321]=-1,[1322]= 0,[1323]= 0,[1324]= 0,[1325]= 0,[1326]=-1,[1327]=-1,[1328]=-1,[1329]=-1,[1330]=-1,[1331]=-1,[1332]=-1,[1333]=-1,[1334]=-1,[1335]=-1,[1336]=-1,[1337]=-1,[1338]=-1,[1339]=-1,[1340]=-1,[1341]=-1,[1342]=-1,[1343]=-1,[1344]=-1,[1345]=-1,[1346]=-1,[1347]=-1,[1348]=-1,[1349]=-1,[1350]=-1,[1351]=-1,[1352]=-1,[1353]=-1,[1354]=-1,[1355]=-1,[1356]=-1,[1357]=-1,[1358]=-1,[1359]=-1,[1360]=-1,[1361]=-1,[1362]=-1,[1363]=-1,[1364]=-1,[1365]=-1,[1366]=-1,[1367]=-1,[1368]=-1,[1369]=-1,[1370]=-1,[1371]=-1,[1372]=-1,[1373]=-1,[1374]=-1,[1375]=-1,[1376]=-1,[1377]=-1,[1378]=-1,[1379]=-1,[1380]=-1,[1381]=-1,[1382]=-1,[1383]=-1,[1384]=-1,[1385]=-1,[1386]=-1,[1387]=-1,[1388]=-1,[1389]=-1,[1390]=-1,[1391]=-1,[1392]=-1,[1393]=-1,[1394]=-1,[1395]=-1,[1396]=-1,[1397]=-1,[1398]=-1,[1399]=-1,[1400]=-1,[1401]=-1,[1402]=-1,[1403]=-1,[1404]=-1,[1405]=-1,[1406]=-1,[1407]=-1,[1408]=-1,[1409]=-1,[1410]= 0,[1411]=-1,[1412]=-1,[1413]=-1,[1414]=-1,[1415]=-1,[1416]=-1,[1417]=-1,[1418]=-1,[1419]= 0,[1420]= 0,[1421]= 0,[1422]=-1,[1423]=-1,[1424]= 0,[1425]= 0,[1426]= 0,[1427]= 0,[1428]=-1,[1429]=-1,[1430]=-1,[1431]=-1,[1432]=-1,[1433]=-1,[1434]=-1,[1435]=-1,[1436]=-1,[1437]=-1,[1438]=-1,[1439]=-1,[1440]=-1,[1441]=-1,[1442]=-1,[1443]=-1,[1444]=-1,[1445]=-1,[1446]=-1,[1447]=-1,[1448]=-1,[1449]=-1,[1450]=-1,[1451]=-1,[1452]=-1,[1453]=-1,[1454]=-1,[1455]=-1,[1456]=-1,[1457]=-1,[1458]=-1,[1459]=-1,[1460]=-1,[1461]=-1,[1462]=-1,[1463]=-1,[1464]=-1,[1465]=-1,[1466]=-1,[1467]=-1,[1468]=-1,[1469]=-1,[1470]=-1,[1471]=-1,[1472]=-1,[1473]=-1,[1474]=-1,[1475]=-1,[1476]=-1,[1477]=-1,[1478]=-1,[1479]=-1,[1480]=-1,[1481]=-1,[1482]=-1,[1483]=-1,[1484]=-1,[1485]=-1,[1486]=-1,[1487]=-1,[1488]=-1,[1489]=-1,[1490]=-1,[1491]=-1,[1492]=-1,[1493]=-1,[1494]=-1,[1495]=-1,[1496]=-1,[1497]=-1,[1498]=-1,[1499]=-1,[1500]=-1,[1501]=-1,[1502]=-1,[1503]=-1,[1504]=-1,[1505]=-1,[1506]=-1,[1507]=-1,[1508]=-1,[1509]= 0,[1510]=-1,[1511]=-1,[1512]= 0,[1513]= 0,[1514]= 0,[1515]=-1,[1516]=-1,[1517]=-1,[1518]=-1,[1519]=-1,[1520]=-1,[1521]= 0,[1522]= 0,[1523]= 0,[1524]=-1,[1525]=-1,[1526]= 0,[1527]= 0,[1528]= 0,[1529]= 0,[1530]=-1,[1531]=-1,[1532]=-1,[1533]=-1,[1534]=-1,[1535]=-1,[1536]=-1,[1537]=-1,[1538]=-1,[1539]=-1,[1540]=-1,[1541]=-1,[1542]=-1,[1543]=-1,[1544]=-1,[1545]=-1,[1546]=-1,[1547]=-1,[1548]=-1,[1549]=-1,[1550]=-1,[1551]=-1,[1552]=-1,[1553]=-1,[1554]=-1,[1555]=-1,[1556]=-1,[1557]=-1,[1558]=-1,[1559]=-1,[1560]=-1,[1561]=-1,[1562]=-1,[1563]=-1,[1564]=-1,[1565]=-1,[1566]=-1,[1567]=-1,[1568]=-1,[1569]=-1,[1570]=-1,[1571]=-1,[1572]=-1,[1573]=-1,[1574]=-1,[1575]=-1,[1576]=-1,[1577]=-1,[1578]=-1,[1579]=-1,[1580]=-1,[1581]=-1,[1582]=-1,[1583]=-1,[1584]=-1,[1585]=-1,[1586]=-1,[1587]=-1,[1588]=-1,[1589]=-1,[1590]=-1,[1591]=-1,[1592]=-1,[1593]=-1,[1594]=-1,[1595]=-1,[1596]=-1,[1597]=-1,[1598]=-1,[1599]=-1,[1600]=-1,[1601]=-1,[1602]=-1,[1603]=-1,[1604]=-1,[1605]= 0,[1606]=-1,[1607]=-1,[1608]=-1,[1609]=-1,[1610]=-1,[1611]= 0,[1612]=-1,[1613]=-1,[1614]= 0,[1615]= 0,[1616]=-1,[1617]=-1,[1618]=-1,[1619]=-1,[1620]=-1,[1621]=-1,[1622]= 0,[1623]= 0,[1624]= 0,[1625]= 0,[1626]= 0,[1627]=-1,[1628]= 0,[1629]= 0,[1630]= 0,[1631]= 0,[1632]=-1,[1633]=-1,[1634]=-1,[1635]=-1,[1636]=-1,[1637]=-1,[1638]=-1,[1639]=-1,[1640]=-1,[1641]=-1,[1642]=-1,[1643]=-1,[1644]=-1,[1645]=-1,[1646]=-1,[1647]=-1,[1648]=-1,[1649]=-1,[1650]=-1,[1651]=-1,[1652]=-1,[1653]=-1,[1654]=-1,[1655]=-1,[1656]=-1,[1657]=-1,[1658]=-1,[1659]=-1,[1660]=-1,[1661]=-1,[1662]=-1,[1663]=-1,[1664]=-1,[1665]=-1,[1666]=-1,[1667]=-1,[1668]=-1,[1669]=-1,[1670]= 0,[1671]=-1,[1672]=-1,[1673]=-1,[1674]=-1,[1675]=-1,[1676]=-1,[1677]= 0,[1678]=-1,[1679]=-1,[1680]=-1,[1681]=-1,[1682]=-1,[1683]=-1,[1684]=-1,[1685]=-1,[1686]=-1,[1687]=-1,[1688]=-1,[1689]=-1,[1690]=-1,[1691]=-1,[1692]=-1,[1693]=-1,[1694]=-1,[1695]=-1,[1696]=-1,[1697]=-1,[1698]=-1,[1699]=-1,[1700]=-1,[1701]=-1,[1702]=-1,[1703]=-1,[1704]=-1,[1705]=-1,[1706]=-1,[1707]= 0,[1708]=-1,[1709]=-1,[1710]=-1,[1711]=-1,[1712]=-1,[1713]= 0,[1714]= 0,[1715]= 0,[1716]= 0,[1717]= 0,[1718]= 0,[1719]=-1,[1720]=-1,[1721]=-1,[1722]=-1,[1723]=-1,[1724]=-1,[1725]= 0,[1726]= 0,[1727]= 0,[1728]= 0,[1729]= 0,[1730]= 0,[1731]= 0,[1732]= 0,[1733]= 0,[1734]=-1,[1735]=-1,[1736]=-1,[1737]=-1,[1738]=-1,[1739]=-1,[1740]=-1,[1741]=-1,[1742]=-1,[1743]=-1,[1744]=-1,[1745]=-1,[1746]=-1,[1747]=-1,[1748]=-1,[1749]=-1,[1750]=-1,[1751]=-1,[1752]=-1,[1753]=-1,[1754]=-1,[1755]=-1,[1756]=-1,[1757]=-1,[1758]=-1,[1759]=-1,[1760]=-1,[1761]=-1,[1762]=-1,[1763]=-1,[1764]=-1,[1765]=-1,[1766]=-1,[1767]=-1,[1768]=-1,[1769]=-1,[1770]=-1,[1771]=-1,[1772]= 0,[1773]=-1,[1774]=-1,[1775]=-1,[1776]=-1,[1777]=-1,[1778]=-1,[1779]= 0,[1780]=-1,[1781]=-1,[1782]=-1,[1783]=-1,[1784]=-1,[1785]=-1,[1786]=-1,[1787]=-1,[1788]=-1,[1789]=-1,[1790]=-1,[1791]=-1,[1792]=-1,[1793]=-1,[1794]=-1,[1795]=-1,[1796]=-1,[1797]=-1,[1798]=-1,[1799]=-1,[1800]=-1,[1801]=-1,[1802]=-1,[1803]=-1,[1804]=-1,[1805]=-1,[1806]=-1,[1807]=-1,[1808]=-1,[1809]= 0,[1810]=-1,[1811]=-1,[1812]=-1,[1813]=-1,[1814]=-1,[1815]= 0,[1816]= 0,[1817]= 0,[1818]= 0,[1819]= 0,[1820]= 0,[1821]=-1,[1822]=-1,[1823]=-1,[1824]=-1,[1825]= 0,[1826]= 0,[1827]= 0,[1828]= 0,[1829]= 0,[1830]= 0,[1831]= 0,[1832]= 0,[1833]= 0,[1834]= 0,[1835]= 0,[1836]=-1,[1837]=-1,[1838]=-1,[1839]=-1,[1840]=-1,[1841]=-1,[1842]=-1,[1843]=-1,[1844]=-1,[1845]=-1,[1846]=-1,[1847]=-1,[1848]=-1,[1849]=-1,[1850]=-1,[1851]=-1,[1852]=-1,[1853]=-1,[1854]=-1,[1855]=-1,[1856]=-1,[1857]=-1,[1858]=-1,[1859]=-1,[1860]=-1,[1861]=-1,[1862]=-1,[1863]=-1,[1864]=-1,[1865]=-1,[1866]=-1,[1867]=-1,[1868]=-1,[1869]=-1,[1870]=-1,[1871]=-1,[1872]=-1,[1873]=-1,[1874]= 0,[1875]=-1,[1876]=-1,[1877]=-1,[1878]=-1,[1879]=-1,[1880]=-1,[1881]= 0,[1882]=-1,[1883]=-1,[1884]=-1,[1885]=-1,[1886]=-1,[1887]=-1,[1888]=-1,[1889]=-1,[1890]=-1,[1891]=-1,[1892]=-1,[1893]=-1,[1894]=-1,[1895]=-1,[1896]=-1,[1897]=-1,[1898]=-1,[1899]=-1,[1900]=-1,[1901]=-1,[1902]=-1,[1903]=-1,[1904]=-1,[1905]=-1,[1906]=-1,[1907]=-1,[1908]=-1,[1909]=-1,[1910]=-1,[1911]= 0,[1912]=-1,[1913]=-1,[1914]=-1,[1915]=-1,[1916]=-1,[1917]= 0,[1918]= 0,[1919]= 0,[1920]= 0,[1921]= 0,[1922]= 0,[1923]= 0,[1924]=-1,[1925]=-1,[1926]= 0,[1927]= 0,[1928]= 0,[1929]= 0,[1930]= 0,[1931]= 0,[1932]= 0,[1933]= 0,[1934]= 0,[1935]= 0,[1936]= 0,[1937]= 0,[1938]=-1,[1939]=-1,[1940]=-1,[1941]=-1,[1942]=-1,[1943]=-1,[1944]=-1,[1945]=-1,[1946]=-1,[1947]=-1,[1948]=-1,[1949]=-1,[1950]=-1,[1951]=-1,[1952]=-1,[1953]=-1,[1954]=-1,[1955]=-1,[1956]=-1,[1957]=-1,[1958]=-1,[1959]=-1,[1960]=-1,[1961]=-1,[1962]=-1,[1963]=-1,[1964]=-1,[1965]=-1,[1966]=-1,[1967]=-1,[1968]=-1,[1969]=-1,[1970]=-1,[1971]=-1,[1972]=-1,[1973]=-1,[1974]=-1,[1975]=-1,[1976]= 0,[1977]=-1,[1978]=-1,[1979]=-1,[1980]=-1,[1981]=-1,[1982]=-1,[1983]= 0,[1984]=-1,[1985]=-1,[1986]=-1,[1987]=-1,[1988]=-1,[1989]=-1,[1990]=-1,[1991]=-1,[1992]=-1,[1993]=-1,[1994]=-1,[1995]=-1,[1996]=-1,[1997]=-1,[1998]=-1,[1999]=-1,[2000]=-1,[2001]=-1,[2002]=-1,[2003]=-1,[2004]=-1,[2005]=-1,[2006]=-1,[2007]=-1,[2008]=-1,[2009]=-1,[2010]=-1,[2011]=-1,[2012]=-1,[2013]= 0,[2014]=-1,[2015]=-1,[2016]=-1,[2017]=-1,[2018]=-1,[2019]= 0,[2020]= 0,[2021]= 0,[2022]= 0,[2023]= 0,[2024]= 0,[2025]= 0,[2026]= 0,[2027]=-1,[2028]=-1,[2029]= 0,[2030]= 0,[2031]= 0,[2032]= 0,[2033]= 0,[2034]= 0,[2035]=-1,[2036]= 0,[2037]= 0,[2038]= 0,[2039]= 0,[2040]=-1,[2041]=-1,[2042]=-1,[2043]=-1,[2044]=-1,[2045]=-1,[2046]=-1,[2047]=-1,[2048]=-1,[2049]=-1,[2050]=-1,[2051]=-1,[2052]=-1,[2053]=-1,[2054]=-1,[2055]=-1,[2056]=-1,[2057]=-1,[2058]=-1,[2059]=-1,[2060]=-1,[2061]=-1,[2062]=-1,[2063]=-1,[2064]=-1,[2065]=-1,[2066]=-1,[2067]=-1,[2068]=-1,[2069]=-1,[2070]=-1,[2071]=-1,[2072]=-1,[2073]=-1,[2074]=-1,[2075]=-1,[2076]=-1,[2077]=-1,[2078]= 0,[2079]=-1,[2080]=-1,[2081]=-1,[2082]=-1,[2083]=-1,[2084]=-1,[2085]= 0,[2086]=-1,[2087]=-1,[2088]=-1,[2089]=-1,[2090]=-1,[2091]=-1,[2092]=-1,[2093]=-1,[2094]=-1,[2095]=-1,[2096]=-1,[2097]=-1,[2098]=-1,[2099]=-1,[2100]=-1,[2101]=-1,[2102]=-1,[2103]=-1,[2104]=-1,[2105]=-1,[2106]=-1,[2107]=-1,[2108]=-1,[2109]=-1,[2110]=-1,[2111]=-1,[2112]=-1,[2113]=-1,[2114]=-1,[2115]= 0,[2116]=-1,[2117]=-1,[2118]=-1,[2119]=-1,[2120]=-1,[2121]= 0,[2122]= 0,[2123]= 0,[2124]= 0,[2125]= 0,[2126]= 0,[2127]= 0,[2128]=-1,[2129]=-1,[2130]=-1,[2131]= 0,[2132]= 0,[2133]= 0,[2134]= 0,[2135]=-1,[2136]= 0,[2137]=-1,[2138]=-1,[2139]= 0,[2140]= 0,[2141]= 0,[2142]= 0,[2143]= 0,[2144]= 0,[2145]=-1,[2146]=-1,[2147]=-1,[2148]=-1,[2149]=-1,[2150]=-1,[2151]= 0,[2152]= 0,[2153]= 0,[2154]= 0,[2155]=-1,[2156]=-1,[2157]=-1,[2158]=-1,[2159]=-1,[2160]=-1,[2161]= 0,[2162]= 0,[2163]= 0,[2164]= 0,[2165]=-1,[2166]=-1,[2167]=-1,[2168]=-1,[2169]=-1,[2170]=-1,[2171]= 0,[2172]= 0,[2173]= 0,[2174]= 0,[2175]=-1,[2176]=-1,[2177]=-1,[2178]=-1,[2179]=-1,[2180]=-1,[2181]= 0,[2182]= 0,[2183]= 0,[2184]= 0,[2185]=-1,[2186]=-1,[2187]=-1,[2188]=-1,[2189]=-1,[2190]=-1,[2191]= 0,[2192]= 0,[2193]= 0,[2194]= 0,[2195]=-1,[2196]=-1,[2197]=-1,[2198]=-1,[2199]=-1,[2200]=-1,[2201]= 0,[2202]= 0,[2203]= 0,[2204]= 0,[2205]=-1,[2206]=-1,[2207]=-1,[2208]=-1,[2209]=-1,[2210]=-1,[2211]= 0,[2212]= 0,[2213]= 0,[2214]= 0,[2215]=-1,[2216]=-1,[2217]=-1,[2218]=-1,[2219]=-1,[2220]=-1,[2221]= 0,[2222]= 0,[2223]= 0,[2224]= 0,[2225]=-1,[2226]=-1,[2227]=-1,[2228]=-1,[2229]=-1,[2230]=-1,[2231]= 0,[2232]= 0,[2233]= 0,[2234]= 0,[2235]=-1,[2236]=-1,[2237]=-1,[2238]=-1,[2239]=-1,[2240]=-1,}, [3]={[1]= 0,[2]=-1,[3]=-1,[4]= 0,[5]=-1,[6]=-1,[7]=-1,[8]= 0,[9]=-1,[10]=-1,[11]= 0,[12]= 0,[13]=-1,[14]=-1,[15]=-1,[16]=-1,[17]= 0,[18]= 0,[19]=-1,[20]=-1,[21]=-1,[22]= 0,[23]=-1,[24]= 0,[25]=-1,[26]=-1,[27]= 0,[28]= 0,[29]=-1,[30]=-1,[31]= 0,[32]=-1,[33]=-1,[34]= 0,[35]=-1,[36]=-1,[37]= 0,[38]= 0,[39]=-1,[40]=-1,[41]=-1,[42]= 0,[43]=-1,[44]=-1,[45]=-1,[46]=-1,[47]= 0,[48]=-1,[49]= 0,[50]=-1,[51]=-1,[52]=-1,[53]=-1,[54]=-1,[55]=-1,[56]= 1,[57]=-1,[58]=-1,[59]=-1,[60]=-1,[61]=-1,[62]=-1,[63]=-1,[64]=-1,[65]=-1,[66]=-1,[67]=-1,[68]=-1,[69]= 0,[70]= 0,[71]=-1,[72]=-1,[73]=-1,[74]=-1,[75]= 0,[76]=-1,[77]=-1,[78]=-1,[79]=-1,[80]= 0,[81]= 0,[82]=-1,[83]=-1,[84]=-1,[85]= 0,[86]=-1,[87]=-1,[88]=-1,[89]=-1,[90]=-1,[91]=-1,[92]=-1,[93]= 1,[94]=-1,[95]=-1,[96]=-1,[97]=-1,[98]=-1,[99]=-1,[100]=-1,[101]= 1,[102]=-1,[103]=-1,[104]=-1,[105]=-1,[106]=-1,[107]=-1,[108]=-1,[109]=-1,[110]=-1,[111]=-1,[112]=-1,[113]=-1,[114]=-1,[115]=-1,[116]=-1,[117]=-1,[118]=-1,[119]=-1,[120]=-1,[121]=-1,[122]=-1,[123]=-1,[124]=-1,[125]=-1,[126]=-1,[127]=-1,[128]=-1,[129]=-1,[130]=-1,[131]=-1,[132]=-1,[133]=-1,[134]=-1,[135]=-1,[136]=-1,[137]=-1,[138]=-1,[139]=-1,[140]=-1,[141]=-1,[142]=-1,[143]=-1,[144]=-1,[145]=-1,[146]=-1,[147]=-1,[148]=-1,[149]=-1,[150]=-1,[151]=-1,[152]=-1,[153]=-1,[154]=-1,[155]=-1,[156]= 0,[157]=-1,[158]=-1,[159]=-1,[160]=-1,[161]=-1,[162]=-1,[163]=-1,[164]=-1,[165]=-1,[166]=-1,[167]=-1,[168]=-1,[169]=-1,[170]=-1,[171]=-1,[172]=-1,[173]=-1,[174]=-1,[175]=-1,[176]=-1,[177]=-1,[178]=-1,[179]= 0,[180]=-1,[181]= 0,[182]=-1,[183]=-1,[184]= 0,[185]= 0,[186]= 0,[187]=-1,[188]=-1,[189]=-1,[190]=-1,[191]=-1,[192]=-1,[193]=-1,[194]=-1,[195]=-1,[196]=-1,[197]=-1,[198]=-1,[199]=-1,[200]=-1,[201]=-1,[202]=-1,[203]= 1,[204]=-1,[205]=-1,[206]=-1,[207]=-1,[208]=-1,[209]=-1,[210]=-1,[211]=-1,[212]=-1,[213]=-1,[214]=-1,[215]=-1,[216]=-1,[217]=-1,[218]=-1,[219]=-1,[220]=-1,[221]=-1,[222]=-1,[223]=-1,[224]=-1,[225]=-1,[226]=-1,[227]=-1,[228]=-1,[229]=-1,[230]=-1,[231]=-1,[232]=-1,[233]=-1,[234]=-1,[235]=-1,[236]=-1,[237]=-1,[238]=-1,[239]=-1,[240]=-1,[241]=-1,[242]=-1,[243]=-1,[244]=-1,[245]=-1,[246]=-1,[247]=-1,[248]=-1,[249]=-1,[250]=-1,[251]=-1,[252]=-1,[253]=-1,[254]=-1,[255]=-1,[256]=-1,[257]=-1,[258]=-1,[259]=-1,[260]=-1,[261]=-1,[262]=-1,[263]=-1,[264]=-1,[265]= 0,[266]=-1,[267]=-1,[268]=-1,[269]=-1,[270]=-1,[271]=-1,[272]=-1,[273]=-1,[274]=-1,[275]=-1,[276]=-1,[277]=-1,[278]=-1,[279]=-1,[280]=-1,[281]=-1,[282]= 0,[283]=-1,[284]=-1,[285]=-1,[286]=-1,[287]= 0,[288]= 0,[289]= 0,[290]= 0,[291]=-1,[292]=-1,[293]=-1,[294]=-1,[295]= 0,[296]=-1,[297]=-1,[298]=-1,[299]=-1,[300]=-1,[301]=-1,[302]=-1,[303]=-1,[304]=-1,[305]= 1,[306]=-1,[307]=-1,[308]=-1,[309]=-1,[310]=-1,[311]=-1,[312]=-1,[313]=-1,[314]=-1,[315]=-1,[316]=-1,[317]=-1,[318]=-1,[319]=-1,[320]=-1,[321]=-1,[322]=-1,[323]=-1,[324]=-1,[325]=-1,[326]=-1,[327]=-1,[328]=-1,[329]=-1,[330]=-1,[331]=-1,[332]=-1,[333]=-1,[334]=-1,[335]=-1,[336]=-1,[337]=-1,[338]=-1,[339]=-1,[340]=-1,[341]=-1,[342]=-1,[343]=-1,[344]=-1,[345]=-1,[346]=-1,[347]=-1,[348]=-1,[349]=-1,[350]=-1,[351]=-1,[352]=-1,[353]=-1,[354]=-1,[355]=-1,[356]=-1,[357]=-1,[358]=-1,[359]=-1,[360]=-1,[361]=-1,[362]=-1,[363]=-1,[364]=-1,[365]=-1,[366]=-1,[367]=-1,[368]=-1,[369]=-1,[370]=-1,[371]=-1,[372]=-1,[373]=-1,[374]=-1,[375]=-1,[376]=-1,[377]=-1,[378]=-1,[379]=-1,[380]=-1,[381]=-1,[382]=-1,[383]=-1,[384]=-1,[385]=-1,[386]=-1,[387]=-1,[388]=-1,[389]=-1,[390]=-1,[391]=-1,[392]= 0,[393]= 0,[394]= 0,[395]= 0,[396]= 0,[397]=-1,[398]=-1,[399]= 0,[400]=-1,[401]= 0,[402]=-1,[403]=-1,[404]=-1,[405]=-1,[406]=-1,[407]= 1,[408]=-1,[409]=-1,[410]=-1,[411]=-1,[412]=-1,[413]=-1,[414]=-1,[415]=-1,[416]=-1,[417]=-1,[418]=-1,[419]=-1,[420]=-1,[421]=-1,[422]=-1,[423]=-1,[424]=-1,[425]=-1,[426]=-1,[427]=-1,[428]=-1,[429]=-1,[430]=-1,[431]=-1,[432]=-1,[433]=-1,[434]=-1,[435]=-1,[436]=-1,[437]=-1,[438]=-1,[439]=-1,[440]=-1,[441]=-1,[442]=-1,[443]=-1,[444]=-1,[445]=-1,[446]=-1,[447]=-1,[448]=-1,[449]=-1,[450]=-1,[451]=-1,[452]=-1,[453]=-1,[454]=-1,[455]=-1,[456]=-1,[457]=-1,[458]=-1,[459]=-1,[460]=-1,[461]=-1,[462]=-1,[463]=-1,[464]=-1,[465]=-1,[466]=-1,[467]=-1,[468]=-1,[469]=-1,[470]=-1,[471]=-1,[472]=-1,[473]=-1,[474]=-1,[475]=-1,[476]=-1,[477]=-1,[478]=-1,[479]=-1,[480]=-1,[481]=-1,[482]=-1,[483]=-1,[484]=-1,[485]=-1,[486]=-1,[487]=-1,[488]=-1,[489]=-1,[490]=-1,[491]=-1,[492]=-1,[493]=-1,[494]=-1,[495]=-1,[496]=-1,[497]= 0,[498]= 0,[499]= 0,[500]= 0,[501]= 0,[502]= 0,[503]=-1,[504]= 0,[505]=-1,[506]=-1,[507]= 0,[508]=-1,[509]= 0,[510]=-1,[511]=-1,[512]=-1,[513]=-1,[514]=-1,[515]=-1,[516]=-1,[517]=-1,[518]=-1,[519]=-1,[520]=-1,[521]=-1,[522]=-1,[523]=-1,[524]=-1,[525]=-1,[526]=-1,[527]=-1,[528]=-1,[529]=-1,[530]=-1,[531]=-1,[532]=-1,[533]=-1,[534]=-1,[535]=-1,[536]=-1,[537]=-1,[538]=-1,[539]=-1,[540]=-1,[541]=-1,[542]=-1,[543]=-1,[544]=-1,[545]=-1,[546]=-1,[547]=-1,[548]=-1,[549]=-1,[550]=-1,[551]=-1,[552]=-1,[553]=-1,[554]=-1,[555]=-1,[556]=-1,[557]=-1,[558]=-1,[559]=-1,[560]=-1,[561]=-1,[562]=-1,[563]=-1,[564]=-1,[565]=-1,[566]=-1,[567]=-1,[568]=-1,[569]=-1,[570]=-1,[571]=-1,[572]=-1,[573]=-1,[574]=-1,[575]=-1,[576]=-1,[577]=-1,[578]=-1,[579]=-1,[580]=-1,[581]=-1,[582]=-1,[583]=-1,[584]=-1,[585]=-1,[586]=-1,[587]=-1,[588]=-1,[589]=-1,[590]=-1,[591]=-1,[592]=-1,[593]=-1,[594]=-1,[595]=-1,[596]=-1,[597]=-1,[598]=-1,[599]=-1,[600]=-1,[601]=-1,[602]=-1,[603]=-1,[604]=-1,[605]= 0,[606]= 0,[607]= 0,[608]=-1,[609]= 0,[610]=-1,[611]= 0,[612]=-1,[613]=-1,[614]=-1,[615]=-1,[616]=-1,[617]=-1,[618]=-1,[619]=-1,[620]=-1,[621]=-1,[622]=-1,[623]=-1,[624]=-1,[625]=-1,[626]=-1,[627]=-1,[628]=-1,[629]=-1,[630]=-1,[631]=-1,[632]=-1,[633]=-1,[634]=-1,[635]=-1,[636]=-1,[637]=-1,[638]=-1,[639]=-1,[640]=-1,[641]=-1,[642]=-1,[643]=-1,[644]=-1,[645]=-1,[646]=-1,[647]=-1,[648]=-1,[649]=-1,[650]=-1,[651]=-1,[652]=-1,[653]=-1,[654]=-1,[655]=-1,[656]=-1,[657]=-1,[658]=-1,[659]=-1,[660]=-1,[661]=-1,[662]=-1,[663]=-1,[664]=-1,[665]=-1,[666]=-1,[667]=-1,[668]=-1,[669]=-1,[670]=-1,[671]=-1,[672]=-1,[673]=-1,[674]=-1,[675]=-1,[676]=-1,[677]=-1,[678]=-1,[679]=-1,[680]=-1,[681]=-1,[682]=-1,[683]=-1,[684]=-1,[685]=-1,[686]=-1,[687]=-1,[688]=-1,[689]=-1,[690]=-1,[691]=-1,[692]=-1,[693]=-1,[694]=-1,[695]=-1,[696]=-1,[697]=-1,[698]=-1,[699]=-1,[700]=-1,[701]=-1,[702]=-1,[703]=-1,[704]=-1,[705]=-1,[706]=-1,[707]=-1,[708]=-1,[709]= 0,[710]= 0,[711]= 0,[712]= 0,[713]=-1,[714]=-1,[715]=-1,[716]=-1,[717]=-1,[718]=-1,[719]=-1,[720]=-1,[721]=-1,[722]=-1,[723]=-1,[724]=-1,[725]=-1,[726]=-1,[727]=-1,[728]=-1,[729]=-1,[730]=-1,[731]=-1,[732]=-1,[733]=-1,[734]=-1,[735]=-1,[736]=-1,[737]=-1,[738]=-1,[739]=-1,[740]=-1,[741]=-1,[742]=-1,[743]=-1,[744]=-1,[745]=-1,[746]=-1,[747]=-1,[748]=-1,[749]=-1,[750]=-1,[751]=-1,[752]=-1,[753]=-1,[754]=-1,[755]=-1,[756]=-1,[757]=-1,[758]=-1,[759]=-1,[760]=-1,[761]=-1,[762]=-1,[763]=-1,[764]=-1,[765]=-1,[766]=-1,[767]=-1,[768]=-1,[769]=-1,[770]=-1,[771]=-1,[772]=-1,[773]=-1,[774]=-1,[775]=-1,[776]=-1,[777]=-1,[778]=-1,[779]=-1,[780]=-1,[781]=-1,[782]=-1,[783]=-1,[784]=-1,[785]=-1,[786]=-1,[787]=-1,[788]=-1,[789]=-1,[790]=-1,[791]=-1,[792]=-1,[793]=-1,[794]=-1,[795]=-1,[796]=-1,[797]=-1,[798]=-1,[799]=-1,[800]=-1,[801]=-1,[802]=-1,[803]=-1,[804]=-1,[805]=-1,[806]=-1,[807]=-1,[808]=-1,[809]=-1,[810]=-1,[811]= 0,[812]= 0,[813]= 0,[814]=-1,[815]=-1,[816]=-1,[817]=-1,[818]=-1,[819]=-1,[820]=-1,[821]=-1,[822]=-1,[823]=-1,[824]=-1,[825]=-1,[826]=-1,[827]=-1,[828]=-1,[829]=-1,[830]=-1,[831]=-1,[832]=-1,[833]=-1,[834]=-1,[835]=-1,[836]=-1,[837]=-1,[838]=-1,[839]=-1,[840]=-1,[841]=-1,[842]=-1,[843]=-1,[844]=-1,[845]=-1,[846]=-1,[847]=-1,[848]=-1,[849]=-1,[850]=-1,[851]=-1,[852]=-1,[853]=-1,[854]=-1,[855]=-1,[856]=-1,[857]=-1,[858]=-1,[859]=-1,[860]=-1,[861]=-1,[862]=-1,[863]=-1,[864]=-1,[865]=-1,[866]=-1,[867]=-1,[868]=-1,[869]=-1,[870]=-1,[871]=-1,[872]=-1,[873]=-1,[874]=-1,[875]=-1,[876]=-1,[877]=-1,[878]=-1,[879]=-1,[880]=-1,[881]=-1,[882]=-1,[883]=-1,[884]=-1,[885]=-1,[886]=-1,[887]=-1,[888]=-1,[889]=-1,[890]=-1,[891]=-1,[892]=-1,[893]=-1,[894]=-1,[895]=-1,[896]=-1,[897]=-1,[898]=-1,[899]=-1,[900]=-1,[901]=-1,[902]=-1,[903]=-1,[904]=-1,[905]=-1,[906]=-1,[907]=-1,[908]=-1,[909]=-1,[910]= 0,[911]=-1,[912]= 0,[913]= 0,[914]= 0,[915]= 0,[916]=-1,[917]=-1,[918]=-1,[919]=-1,[920]=-1,[921]=-1,[922]=-1,[923]=-1,[924]=-1,[925]=-1,[926]=-1,[927]=-1,[928]=-1,[929]=-1,[930]=-1,[931]=-1,[932]=-1,[933]=-1,[934]=-1,[935]=-1,[936]=-1,[937]=-1,[938]=-1,[939]=-1,[940]=-1,[941]=-1,[942]=-1,[943]=-1,[944]=-1,[945]=-1,[946]=-1,[947]=-1,[948]=-1,[949]=-1,[950]=-1,[951]=-1,[952]=-1,[953]=-1,[954]=-1,[955]=-1,[956]=-1,[957]=-1,[958]=-1,[959]=-1,[960]=-1,[961]=-1,[962]=-1,[963]=-1,[964]=-1,[965]=-1,[966]=-1,[967]=-1,[968]=-1,[969]=-1,[970]=-1,[971]=-1,[972]=-1,[973]=-1,[974]=-1,[975]=-1,[976]=-1,[977]=-1,[978]=-1,[979]=-1,[980]=-1,[981]=-1,[982]=-1,[983]=-1,[984]=-1,[985]=-1,[986]=-1,[987]=-1,[988]=-1,[989]=-1,[990]=-1,[991]=-1,[992]=-1,[993]=-1,[994]=-1,[995]=-1,[996]=-1,[997]=-1,[998]=-1,[999]=-1,[1000]=-1,[1001]=-1,[1002]=-1,[1003]=-1,[1004]=-1,[1005]=-1,[1006]=-1,[1007]=-1,[1008]= 0,[1009]= 0,[1010]= 0,[1011]=-1,[1012]= 0,[1013]= 0,[1014]= 0,[1015]= 0,[1016]=-1,[1017]= 0,[1018]=-1,[1019]=-1,[1020]=-1,[1021]=-1,[1022]=-1,[1023]=-1,[1024]=-1,[1025]=-1,[1026]=-1,[1027]=-1,[1028]=-1,[1029]=-1,[1030]=-1,[1031]=-1,[1032]=-1,[1033]=-1,[1034]=-1,[1035]=-1,[1036]=-1,[1037]=-1,[1038]=-1,[1039]=-1,[1040]=-1,[1041]=-1,[1042]=-1,[1043]=-1,[1044]=-1,[1045]=-1,[1046]=-1,[1047]=-1,[1048]=-1,[1049]=-1,[1050]=-1,[1051]=-1,[1052]=-1,[1053]=-1,[1054]=-1,[1055]=-1,[1056]=-1,[1057]=-1,[1058]=-1,[1059]=-1,[1060]=-1,[1061]=-1,[1062]=-1,[1063]=-1,[1064]=-1,[1065]=-1,[1066]=-1,[1067]=-1,[1068]=-1,[1069]=-1,[1070]=-1,[1071]=-1,[1072]=-1,[1073]=-1,[1074]=-1,[1075]=-1,[1076]=-1,[1077]=-1,[1078]=-1,[1079]= 0,[1080]=-1,[1081]=-1,[1082]=-1,[1083]=-1,[1084]=-1,[1085]=-1,[1086]= 0,[1087]= 0,[1088]= 0,[1089]= 0,[1090]=-1,[1091]= 0,[1092]= 0,[1093]= 0,[1094]=-1,[1095]=-1,[1096]=-1,[1097]=-1,[1098]= 0,[1099]=-1,[1100]=-1,[1101]=-1,[1102]=-1,[1103]=-1,[1104]=-1,[1105]=-1,[1106]=-1,[1107]=-1,[1108]=-1,[1109]=-1,[1110]=-1,[1111]=-1,[1112]=-1,[1113]=-1,[1114]=-1,[1115]=-1,[1116]=-1,[1117]= 0,[1118]=-1,[1119]=-1,[1120]=-1,[1121]= 0,[1122]=-1,[1123]=-1,[1124]=-1,[1125]=-1,[1126]=-1,[1127]=-1,[1128]=-1,[1129]=-1,[1130]=-1,[1131]=-1,[1132]=-1,[1133]=-1,[1134]=-1,[1135]=-1,[1136]=-1,[1137]=-1,[1138]=-1,[1139]=-1,[1140]=-1,[1141]=-1,[1142]=-1,[1143]=-1,[1144]=-1,[1145]=-1,[1146]=-1,[1147]=-1,[1148]=-1,[1149]=-1,[1150]=-1,[1151]=-1,[1152]=-1,[1153]=-1,[1154]=-1,[1155]=-1,[1156]=-1,[1157]=-1,[1158]=-1,[1159]=-1,[1160]=-1,[1161]=-1,[1162]=-1,[1163]=-1,[1164]=-1,[1165]=-1,[1166]=-1,[1167]=-1,[1168]=-1,[1169]=-1,[1170]=-1,[1171]=-1,[1172]=-1,[1173]=-1,[1174]=-1,[1175]=-1,[1176]=-1,[1177]=-1,[1178]=-1,[1179]=-1,[1180]=-1,[1181]=-1,[1182]=-1,[1183]=-1,[1184]=-1,[1185]=-1,[1186]=-1,[1187]=-1,[1188]=-1,[1189]=-1,[1190]=-1,[1191]=-1,[1192]=-1,[1193]=-1,[1194]=-1,[1195]=-1,[1196]=-1,[1197]=-1,[1198]=-1,[1199]=-1,[1200]=-1,[1201]=-1,[1202]=-1,[1203]= 0,[1204]=-1,[1205]= 0,[1206]= 0,[1207]= 0,[1208]= 0,[1209]= 0,[1210]=-1,[1211]=-1,[1212]=-1,[1213]=-1,[1214]=-1,[1215]=-1,[1216]=-1,[1217]=-1,[1218]=-1,[1219]=-1,[1220]= 0,[1221]= 0,[1222]= 0,[1223]= 0,[1224]=-1,[1225]=-1,[1226]=-1,[1227]=-1,[1228]=-1,[1229]=-1,[1230]=-1,[1231]=-1,[1232]=-1,[1233]=-1,[1234]=-1,[1235]=-1,[1236]=-1,[1237]=-1,[1238]=-1,[1239]=-1,[1240]=-1,[1241]=-1,[1242]=-1,[1243]=-1,[1244]=-1,[1245]=-1,[1246]=-1,[1247]=-1,[1248]=-1,[1249]=-1,[1250]=-1,[1251]=-1,[1252]=-1,[1253]=-1,[1254]=-1,[1255]=-1,[1256]=-1,[1257]=-1,[1258]=-1,[1259]=-1,[1260]=-1,[1261]=-1,[1262]=-1,[1263]=-1,[1264]=-1,[1265]=-1,[1266]=-1,[1267]=-1,[1268]=-1,[1269]= 0,[1270]=-1,[1271]=-1,[1272]=-1,[1273]=-1,[1274]=-1,[1275]=-1,[1276]=-1,[1277]=-1,[1278]=-1,[1279]=-1,[1280]=-1,[1281]=-1,[1282]=-1,[1283]=-1,[1284]=-1,[1285]=-1,[1286]=-1,[1287]=-1,[1288]=-1,[1289]=-1,[1290]=-1,[1291]=-1,[1292]=-1,[1293]=-1,[1294]=-1,[1295]=-1,[1296]=-1,[1297]=-1,[1298]=-1,[1299]= 0,[1300]=-1,[1301]=-1,[1302]=-1,[1303]=-1,[1304]=-1,[1305]= 0,[1306]= 0,[1307]= 0,[1308]=-1,[1309]=-1,[1310]=-1,[1311]=-1,[1312]=-1,[1313]=-1,[1314]= 0,[1315]=-1,[1316]=-1,[1317]= 0,[1318]= 0,[1319]= 0,[1320]= 0,[1321]= 0,[1322]= 0,[1323]= 0,[1324]= 0,[1325]= 0,[1326]=-1,[1327]=-1,[1328]=-1,[1329]=-1,[1330]=-1,[1331]=-1,[1332]=-1,[1333]=-1,[1334]=-1,[1335]=-1,[1336]=-1,[1337]=-1,[1338]=-1,[1339]=-1,[1340]=-1,[1341]=-1,[1342]=-1,[1343]=-1,[1344]=-1,[1345]=-1,[1346]=-1,[1347]=-1,[1348]=-1,[1349]=-1,[1350]=-1,[1351]=-1,[1352]=-1,[1353]=-1,[1354]=-1,[1355]=-1,[1356]=-1,[1357]=-1,[1358]=-1,[1359]=-1,[1360]=-1,[1361]=-1,[1362]=-1,[1363]=-1,[1364]= 0,[1365]=-1,[1366]=-1,[1367]=-1,[1368]=-1,[1369]=-1,[1370]=-1,[1371]= 0,[1372]=-1,[1373]=-1,[1374]=-1,[1375]=-1,[1376]=-1,[1377]=-1,[1378]=-1,[1379]=-1,[1380]=-1,[1381]=-1,[1382]=-1,[1383]=-1,[1384]=-1,[1385]=-1,[1386]=-1,[1387]=-1,[1388]=-1,[1389]=-1,[1390]=-1,[1391]=-1,[1392]=-1,[1393]=-1,[1394]=-1,[1395]=-1,[1396]=-1,[1397]=-1,[1398]=-1,[1399]=-1,[1400]=-1,[1401]= 0,[1402]=-1,[1403]=-1,[1404]=-1,[1405]=-1,[1406]=-1,[1407]=-1,[1408]=-1,[1409]=-1,[1410]= 0,[1411]= 0,[1412]= 0,[1413]=-1,[1414]= 0,[1415]=-1,[1416]=-1,[1417]=-1,[1418]=-1,[1419]= 0,[1420]= 0,[1421]= 0,[1422]= 0,[1423]=-1,[1424]= 0,[1425]= 0,[1426]= 0,[1427]= 0,[1428]=-1,[1429]=-1,[1430]=-1,[1431]=-1,[1432]=-1,[1433]=-1,[1434]=-1,[1435]=-1,[1436]=-1,[1437]=-1,[1438]=-1,[1439]=-1,[1440]=-1,[1441]=-1,[1442]=-1,[1443]=-1,[1444]=-1,[1445]=-1,[1446]=-1,[1447]=-1,[1448]=-1,[1449]=-1,[1450]=-1,[1451]=-1,[1452]=-1,[1453]=-1,[1454]=-1,[1455]=-1,[1456]=-1,[1457]=-1,[1458]=-1,[1459]=-1,[1460]=-1,[1461]=-1,[1462]=-1,[1463]=-1,[1464]=-1,[1465]=-1,[1466]= 0,[1467]=-1,[1468]=-1,[1469]=-1,[1470]=-1,[1471]=-1,[1472]=-1,[1473]= 0,[1474]=-1,[1475]=-1,[1476]=-1,[1477]=-1,[1478]=-1,[1479]=-1,[1480]=-1,[1481]=-1,[1482]=-1,[1483]=-1,[1484]=-1,[1485]=-1,[1486]=-1,[1487]=-1,[1488]=-1,[1489]=-1,[1490]=-1,[1491]=-1,[1492]=-1,[1493]=-1,[1494]=-1,[1495]=-1,[1496]=-1,[1497]=-1,[1498]=-1,[1499]=-1,[1500]=-1,[1501]=-1,[1502]=-1,[1503]= 0,[1504]=-1,[1505]=-1,[1506]=-1,[1507]=-1,[1508]=-1,[1509]= 0,[1510]= 0,[1511]=-1,[1512]= 0,[1513]= 0,[1514]= 0,[1515]= 0,[1516]=-1,[1517]=-1,[1518]=-1,[1519]=-1,[1520]= 0,[1521]= 0,[1522]= 0,[1523]= 0,[1524]=-1,[1525]= 0,[1526]= 0,[1527]= 0,[1528]= 0,[1529]= 0,[1530]=-1,[1531]=-1,[1532]=-1,[1533]=-1,[1534]=-1,[1535]=-1,[1536]=-1,[1537]=-1,[1538]=-1,[1539]=-1,[1540]=-1,[1541]=-1,[1542]=-1,[1543]=-1,[1544]=-1,[1545]=-1,[1546]=-1,[1547]=-1,[1548]=-1,[1549]=-1,[1550]=-1,[1551]=-1,[1552]=-1,[1553]=-1,[1554]=-1,[1555]=-1,[1556]=-1,[1557]=-1,[1558]=-1,[1559]=-1,[1560]=-1,[1561]=-1,[1562]=-1,[1563]=-1,[1564]=-1,[1565]=-1,[1566]=-1,[1567]=-1,[1568]= 0,[1569]=-1,[1570]=-1,[1571]=-1,[1572]=-1,[1573]=-1,[1574]=-1,[1575]= 0,[1576]=-1,[1577]=-1,[1578]=-1,[1579]=-1,[1580]=-1,[1581]=-1,[1582]=-1,[1583]=-1,[1584]=-1,[1585]=-1,[1586]=-1,[1587]=-1,[1588]=-1,[1589]=-1,[1590]=-1,[1591]=-1,[1592]=-1,[1593]=-1,[1594]=-1,[1595]=-1,[1596]=-1,[1597]=-1,[1598]=-1,[1599]=-1,[1600]=-1,[1601]=-1,[1602]=-1,[1603]=-1,[1604]=-1,[1605]= 0,[1606]=-1,[1607]=-1,[1608]=-1,[1609]=-1,[1610]=-1,[1611]= 0,[1612]= 0,[1613]= 0,[1614]= 0,[1615]= 0,[1616]= 0,[1617]= 0,[1618]=-1,[1619]=-1,[1620]= 0,[1621]=-1,[1622]= 0,[1623]= 0,[1624]=-1,[1625]= 0,[1626]= 0,[1627]=-1,[1628]= 0,[1629]= 0,[1630]= 0,[1631]= 0,[1632]=-1,[1633]=-1,[1634]=-1,[1635]=-1,[1636]=-1,[1637]=-1,[1638]=-1,[1639]=-1,[1640]=-1,[1641]=-1,[1642]=-1,[1643]=-1,[1644]=-1,[1645]=-1,[1646]=-1,[1647]=-1,[1648]=-1,[1649]=-1,[1650]=-1,[1651]=-1,[1652]=-1,[1653]=-1,[1654]=-1,[1655]=-1,[1656]=-1,[1657]=-1,[1658]=-1,[1659]=-1,[1660]=-1,[1661]=-1,[1662]=-1,[1663]=-1,[1664]=-1,[1665]=-1,[1666]=-1,[1667]=-1,[1668]=-1,[1669]=-1,[1670]= 0,[1671]=-1,[1672]=-1,[1673]=-1,[1674]=-1,[1675]=-1,[1676]=-1,[1677]= 0,[1678]=-1,[1679]=-1,[1680]=-1,[1681]=-1,[1682]=-1,[1683]=-1,[1684]=-1,[1685]=-1,[1686]=-1,[1687]=-1,[1688]=-1,[1689]=-1,[1690]=-1,[1691]=-1,[1692]=-1,[1693]=-1,[1694]=-1,[1695]=-1,[1696]=-1,[1697]=-1,[1698]=-1,[1699]=-1,[1700]=-1,[1701]=-1,[1702]=-1,[1703]=-1,[1704]=-1,[1705]=-1,[1706]=-1,[1707]= 0,[1708]=-1,[1709]=-1,[1710]=-1,[1711]=-1,[1712]=-1,[1713]= 0,[1714]= 0,[1715]= 0,[1716]=-1,[1717]= 0,[1718]=-1,[1719]= 0,[1720]= 0,[1721]=-1,[1722]=-1,[1723]=-1,[1724]=-1,[1725]=-1,[1726]= 0,[1727]=-1,[1728]=-1,[1729]=-1,[1730]=-1,[1731]= 0,[1732]= 0,[1733]= 0,[1734]=-1,[1735]=-1,[1736]=-1,[1737]=-1,[1738]=-1,[1739]=-1,[1740]=-1,[1741]=-1,[1742]=-1,[1743]=-1,[1744]=-1,[1745]=-1,[1746]=-1,[1747]=-1,[1748]=-1,[1749]=-1,[1750]=-1,[1751]=-1,[1752]=-1,[1753]=-1,[1754]=-1,[1755]=-1,[1756]=-1,[1757]=-1,[1758]=-1,[1759]=-1,[1760]=-1,[1761]=-1,[1762]=-1,[1763]=-1,[1764]=-1,[1765]=-1,[1766]=-1,[1767]=-1,[1768]=-1,[1769]=-1,[1770]=-1,[1771]=-1,[1772]= 0,[1773]=-1,[1774]=-1,[1775]=-1,[1776]=-1,[1777]=-1,[1778]=-1,[1779]= 0,[1780]=-1,[1781]=-1,[1782]=-1,[1783]=-1,[1784]=-1,[1785]=-1,[1786]=-1,[1787]=-1,[1788]=-1,[1789]=-1,[1790]=-1,[1791]=-1,[1792]=-1,[1793]=-1,[1794]=-1,[1795]=-1,[1796]=-1,[1797]=-1,[1798]=-1,[1799]=-1,[1800]=-1,[1801]=-1,[1802]=-1,[1803]=-1,[1804]=-1,[1805]=-1,[1806]=-1,[1807]=-1,[1808]=-1,[1809]= 0,[1810]=-1,[1811]=-1,[1812]=-1,[1813]=-1,[1814]=-1,[1815]= 0,[1816]= 0,[1817]=-1,[1818]=-1,[1819]= 0,[1820]=-1,[1821]=-1,[1822]=-1,[1823]=-1,[1824]=-1,[1825]=-1,[1826]=-1,[1827]= 0,[1828]= 0,[1829]= 0,[1830]=-1,[1831]=-1,[1832]=-1,[1833]= 0,[1834]= 0,[1835]= 0,[1836]=-1,[1837]=-1,[1838]=-1,[1839]=-1,[1840]=-1,[1841]=-1,[1842]=-1,[1843]=-1,[1844]=-1,[1845]=-1,[1846]=-1,[1847]=-1,[1848]=-1,[1849]=-1,[1850]=-1,[1851]=-1,[1852]=-1,[1853]=-1,[1854]=-1,[1855]=-1,[1856]=-1,[1857]=-1,[1858]=-1,[1859]=-1,[1860]=-1,[1861]=-1,[1862]=-1,[1863]=-1,[1864]=-1,[1865]=-1,[1866]=-1,[1867]=-1,[1868]=-1,[1869]=-1,[1870]=-1,[1871]=-1,[1872]=-1,[1873]=-1,[1874]= 0,[1875]=-1,[1876]=-1,[1877]=-1,[1878]=-1,[1879]=-1,[1880]=-1,[1881]= 0,[1882]=-1,[1883]=-1,[1884]=-1,[1885]=-1,[1886]=-1,[1887]=-1,[1888]=-1,[1889]=-1,[1890]=-1,[1891]=-1,[1892]=-1,[1893]=-1,[1894]=-1,[1895]=-1,[1896]=-1,[1897]=-1,[1898]=-1,[1899]=-1,[1900]=-1,[1901]=-1,[1902]=-1,[1903]=-1,[1904]=-1,[1905]=-1,[1906]=-1,[1907]=-1,[1908]=-1,[1909]=-1,[1910]=-1,[1911]= 0,[1912]=-1,[1913]=-1,[1914]=-1,[1915]=-1,[1916]=-1,[1917]=-1,[1918]= 0,[1919]= 0,[1920]= 0,[1921]= 0,[1922]=-1,[1923]=-1,[1924]=-1,[1925]=-1,[1926]=-1,[1927]= 0,[1928]=-1,[1929]= 0,[1930]= 0,[1931]=-1,[1932]=-1,[1933]=-1,[1934]= 0,[1935]= 0,[1936]= 0,[1937]= 0,[1938]=-1,[1939]=-1,[1940]=-1,[1941]=-1,[1942]=-1,[1943]=-1,[1944]=-1,[1945]=-1,[1946]=-1,[1947]=-1,[1948]=-1,[1949]=-1,[1950]=-1,[1951]=-1,[1952]=-1,[1953]=-1,[1954]=-1,[1955]=-1,[1956]=-1,[1957]=-1,[1958]=-1,[1959]=-1,[1960]=-1,[1961]=-1,[1962]=-1,[1963]=-1,[1964]=-1,[1965]=-1,[1966]=-1,[1967]=-1,[1968]=-1,[1969]=-1,[1970]=-1,[1971]=-1,[1972]=-1,[1973]=-1,[1974]=-1,[1975]=-1,[1976]= 0,[1977]=-1,[1978]=-1,[1979]=-1,[1980]=-1,[1981]=-1,[1982]=-1,[1983]= 0,[1984]=-1,[1985]=-1,[1986]=-1,[1987]=-1,[1988]=-1,[1989]=-1,[1990]=-1,[1991]=-1,[1992]=-1,[1993]=-1,[1994]=-1,[1995]=-1,[1996]=-1,[1997]=-1,[1998]=-1,[1999]=-1,[2000]=-1,[2001]=-1,[2002]=-1,[2003]=-1,[2004]=-1,[2005]=-1,[2006]=-1,[2007]=-1,[2008]=-1,[2009]=-1,[2010]=-1,[2011]=-1,[2012]=-1,[2013]= 0,[2014]=-1,[2015]=-1,[2016]=-1,[2017]=-1,[2018]=-1,[2019]= 0,[2020]= 0,[2021]=-1,[2022]= 0,[2023]= 0,[2024]= 0,[2025]=-1,[2026]=-1,[2027]=-1,[2028]=-1,[2029]=-1,[2030]=-1,[2031]= 0,[2032]= 0,[2033]=-1,[2034]=-1,[2035]=-1,[2036]= 0,[2037]= 0,[2038]= 0,[2039]= 0,[2040]=-1,[2041]=-1,[2042]=-1,[2043]=-1,[2044]=-1,[2045]=-1,[2046]=-1,[2047]=-1,[2048]=-1,[2049]=-1,[2050]=-1,[2051]=-1,[2052]=-1,[2053]=-1,[2054]=-1,[2055]=-1,[2056]=-1,[2057]=-1,[2058]=-1,[2059]=-1,[2060]=-1,[2061]=-1,[2062]=-1,[2063]=-1,[2064]=-1,[2065]=-1,[2066]=-1,[2067]=-1,[2068]=-1,[2069]=-1,[2070]=-1,[2071]=-1,[2072]=-1,[2073]=-1,[2074]=-1,[2075]=-1,[2076]=-1,[2077]=-1,[2078]= 0,[2079]=-1,[2080]=-1,[2081]=-1,[2082]=-1,[2083]=-1,[2084]=-1,[2085]= 0,[2086]=-1,[2087]=-1,[2088]=-1,[2089]=-1,[2090]=-1,[2091]=-1,[2092]=-1,[2093]=-1,[2094]=-1,[2095]=-1,[2096]=-1,[2097]=-1,[2098]=-1,[2099]=-1,[2100]=-1,[2101]=-1,[2102]=-1,[2103]=-1,[2104]=-1,[2105]=-1,[2106]=-1,[2107]=-1,[2108]=-1,[2109]=-1,[2110]=-1,[2111]=-1,[2112]=-1,[2113]=-1,[2114]=-1,[2115]= 0,[2116]=-1,[2117]=-1,[2118]=-1,[2119]=-1,[2120]=-1,[2121]= 0,[2122]=-1,[2123]=-1,[2124]= 0,[2125]= 0,[2126]= 0,[2127]=-1,[2128]=-1,[2129]=-1,[2130]=-1,[2131]=-1,[2132]=-1,[2133]=-1,[2134]= 0,[2135]= 0,[2136]=-1,[2137]=-1,[2138]= 0,[2139]= 0,[2140]= 0,[2141]= 0,[2142]=-1,[2143]= 0,[2144]= 0,[2145]=-1,[2146]=-1,[2147]=-1,[2148]=-1,[2149]=-1,[2150]=-1,[2151]= 0,[2152]=-1,[2153]= 0,[2154]= 0,[2155]=-1,[2156]=-1,[2157]=-1,[2158]=-1,[2159]=-1,[2160]=-1,[2161]= 0,[2162]= 0,[2163]= 0,[2164]= 0,[2165]=-1,[2166]=-1,[2167]=-1,[2168]=-1,[2169]=-1,[2170]=-1,[2171]= 0,[2172]= 0,[2173]= 0,[2174]= 0,[2175]=-1,[2176]=-1,[2177]=-1,[2178]=-1,[2179]=-1,[2180]=-1,[2181]= 0,[2182]= 0,[2183]= 0,[2184]= 0,[2185]=-1,[2186]=-1,[2187]=-1,[2188]=-1,[2189]=-1,[2190]=-1,[2191]= 0,[2192]= 0,[2193]= 0,[2194]= 0,[2195]=-1,[2196]=-1,[2197]=-1,[2198]=-1,[2199]=-1,[2200]=-1,[2201]= 0,[2202]= 0,[2203]= 0,[2204]= 0,[2205]=-1,[2206]=-1,[2207]=-1,[2208]=-1,[2209]=-1,[2210]=-1,[2211]= 0,[2212]= 0,[2213]= 0,[2214]= 0,[2215]=-1,[2216]=-1,[2217]=-1,[2218]=-1,[2219]=-1,[2220]=-1,[2221]= 0,[2222]= 0,[2223]= 0,[2224]= 0,[2225]=-1,[2226]=-1,[2227]=-1,[2228]=-1,[2229]=-1,[2230]=-1,[2231]= 0,[2232]= 0,[2233]= 0,[2234]= 0,[2235]=-1,[2236]=-1,[2237]=-1,[2238]=-1,[2239]=-1,[2240]=-1,}, [1]={[1]= 0,[2]=-1,[3]=-1,[4]= 0,[5]=-1,[6]=-1,[7]=-1,[8]= 0,[9]=-1,[10]=-1,[11]=-1,[12]=-1,[13]=-1,[14]= 0,[15]=-1,[16]=-1,[17]= 0,[18]= 0,[19]=-1,[20]=-1,[21]=-1,[22]= 0,[23]=-1,[24]=-1,[25]=-1,[26]=-1,[27]= 0,[28]= 0,[29]=-1,[30]=-1,[31]= 0,[32]= 0,[33]=-1,[34]= 0,[35]=-1,[36]=-1,[37]=-1,[38]= 0,[39]=-1,[40]=-1,[41]=-1,[42]= 0,[43]=-1,[44]=-1,[45]=-1,[46]= 0,[47]=-1,[48]=-1,[49]= 0,[50]=-1,[51]=-1,[52]=-1,[53]=-1,[54]=-1,[55]=-1,[56]= 0,[57]=-1,[58]=-1,[59]= 0,[60]=-1,[61]= 0,[62]=-1,[63]=-1,[64]=-1,[65]=-1,[66]=-1,[67]=-1,[68]=-1,[69]= 0,[70]= 0,[71]= 0,[72]=-1,[73]=-1,[74]=-1,[75]= 0,[76]=-1,[77]=-1,[78]=-1,[79]= 0,[80]= 0,[81]= 0,[82]=-1,[83]=-1,[84]=-1,[85]= 0,[86]=-1,[87]=-1,[88]=-1,[89]=-1,[90]=-1,[91]=-1,[92]=-1,[93]= 1,[94]=-1,[95]=-1,[96]=-1,[97]=-1,[98]=-1,[99]=-1,[100]=-1,[101]= 1,[102]=-1,[103]=-1,[104]=-1,[105]=-1,[106]=-1,[107]=-1,[108]=-1,[109]=-1,[110]=-1,[111]=-1,[112]=-1,[113]=-1,[114]=-1,[115]=-1,[116]=-1,[117]=-1,[118]=-1,[119]=-1,[120]=-1,[121]=-1,[122]=-1,[123]=-1,[124]=-1,[125]=-1,[126]=-1,[127]=-1,[128]=-1,[129]=-1,[130]=-1,[131]=-1,[132]=-1,[133]=-1,[134]=-1,[135]=-1,[136]=-1,[137]=-1,[138]=-1,[139]=-1,[140]=-1,[141]=-1,[142]=-1,[143]=-1,[144]=-1,[145]=-1,[146]=-1,[147]=-1,[148]=-1,[149]=-1,[150]=-1,[151]=-1,[152]=-1,[153]=-1,[154]=-1,[155]=-1,[156]=-1,[157]=-1,[158]=-1,[159]=-1,[160]=-1,[161]=-1,[162]=-1,[163]=-1,[164]=-1,[165]=-1,[166]=-1,[167]=-1,[168]=-1,[169]=-1,[170]=-1,[171]=-1,[172]= 0,[173]=-1,[174]= 0,[175]=-1,[176]=-1,[177]=-1,[178]=-1,[179]=-1,[180]= 0,[181]= 0,[182]=-1,[183]=-1,[184]= 0,[185]= 0,[186]= 0,[187]= 0,[188]=-1,[189]=-1,[190]=-1,[191]=-1,[192]=-1,[193]=-1,[194]=-1,[195]=-1,[196]=-1,[197]=-1,[198]=-1,[199]=-1,[200]=-1,[201]=-1,[202]=-1,[203]= 1,[204]=-1,[205]=-1,[206]=-1,[207]=-1,[208]=-1,[209]=-1,[210]=-1,[211]=-1,[212]=-1,[213]=-1,[214]=-1,[215]=-1,[216]=-1,[217]=-1,[218]=-1,[219]=-1,[220]=-1,[221]=-1,[222]=-1,[223]=-1,[224]=-1,[225]=-1,[226]=-1,[227]=-1,[228]=-1,[229]=-1,[230]=-1,[231]=-1,[232]=-1,[233]=-1,[234]=-1,[235]=-1,[236]=-1,[237]=-1,[238]=-1,[239]=-1,[240]=-1,[241]=-1,[242]=-1,[243]=-1,[244]=-1,[245]=-1,[246]=-1,[247]=-1,[248]=-1,[249]=-1,[250]=-1,[251]=-1,[252]=-1,[253]=-1,[254]=-1,[255]=-1,[256]=-1,[257]=-1,[258]=-1,[259]=-1,[260]=-1,[261]=-1,[262]=-1,[263]=-1,[264]=-1,[265]=-1,[266]=-1,[267]=-1,[268]=-1,[269]=-1,[270]=-1,[271]=-1,[272]=-1,[273]=-1,[274]=-1,[275]=-1,[276]=-1,[277]=-1,[278]=-1,[279]=-1,[280]=-1,[281]= 0,[282]=-1,[283]=-1,[284]= 0,[285]=-1,[286]=-1,[287]=-1,[288]=-1,[289]= 0,[290]= 0,[291]=-1,[292]= 0,[293]= 0,[294]= 0,[295]= 0,[296]=-1,[297]=-1,[298]=-1,[299]=-1,[300]=-1,[301]=-1,[302]=-1,[303]=-1,[304]=-1,[305]= 1,[306]=-1,[307]=-1,[308]=-1,[309]=-1,[310]=-1,[311]=-1,[312]=-1,[313]=-1,[314]=-1,[315]=-1,[316]=-1,[317]=-1,[318]=-1,[319]=-1,[320]=-1,[321]=-1,[322]=-1,[323]=-1,[324]=-1,[325]=-1,[326]=-1,[327]=-1,[328]=-1,[329]=-1,[330]=-1,[331]=-1,[332]=-1,[333]=-1,[334]=-1,[335]=-1,[336]=-1,[337]=-1,[338]=-1,[339]=-1,[340]=-1,[341]=-1,[342]=-1,[343]=-1,[344]=-1,[345]=-1,[346]=-1,[347]=-1,[348]=-1,[349]=-1,[350]=-1,[351]=-1,[352]=-1,[353]=-1,[354]=-1,[355]=-1,[356]=-1,[357]=-1,[358]=-1,[359]=-1,[360]=-1,[361]=-1,[362]=-1,[363]=-1,[364]=-1,[365]=-1,[366]=-1,[367]=-1,[368]=-1,[369]=-1,[370]=-1,[371]=-1,[372]=-1,[373]=-1,[374]=-1,[375]=-1,[376]=-1,[377]=-1,[378]=-1,[379]=-1,[380]=-1,[381]=-1,[382]=-1,[383]=-1,[384]=-1,[385]=-1,[386]=-1,[387]=-1,[388]=-1,[389]=-1,[390]=-1,[391]=-1,[392]=-1,[393]=-1,[394]= 0,[395]= 0,[396]= 0,[397]=-1,[398]=-1,[399]=-1,[400]=-1,[401]= 0,[402]=-1,[403]=-1,[404]=-1,[405]=-1,[406]=-1,[407]= 1,[408]=-1,[409]=-1,[410]=-1,[411]=-1,[412]=-1,[413]=-1,[414]=-1,[415]=-1,[416]=-1,[417]=-1,[418]=-1,[419]=-1,[420]=-1,[421]=-1,[422]=-1,[423]=-1,[424]=-1,[425]=-1,[426]=-1,[427]=-1,[428]=-1,[429]=-1,[430]=-1,[431]=-1,[432]=-1,[433]=-1,[434]=-1,[435]=-1,[436]=-1,[437]=-1,[438]=-1,[439]=-1,[440]=-1,[441]=-1,[442]=-1,[443]=-1,[444]=-1,[445]=-1,[446]=-1,[447]=-1,[448]=-1,[449]=-1,[450]=-1,[451]=-1,[452]=-1,[453]=-1,[454]=-1,[455]=-1,[456]=-1,[457]=-1,[458]=-1,[459]=-1,[460]=-1,[461]=-1,[462]=-1,[463]=-1,[464]=-1,[465]=-1,[466]=-1,[467]=-1,[468]=-1,[469]=-1,[470]=-1,[471]=-1,[472]=-1,[473]=-1,[474]=-1,[475]=-1,[476]=-1,[477]=-1,[478]=-1,[479]=-1,[480]=-1,[481]=-1,[482]=-1,[483]=-1,[484]=-1,[485]=-1,[486]=-1,[487]=-1,[488]=-1,[489]=-1,[490]=-1,[491]=-1,[492]=-1,[493]=-1,[494]=-1,[495]=-1,[496]= 0,[497]= 0,[498]= 0,[499]= 0,[500]= 0,[501]= 0,[502]= 0,[503]= 0,[504]= 0,[505]=-1,[506]=-1,[507]=-1,[508]=-1,[509]= 0,[510]=-1,[511]=-1,[512]=-1,[513]=-1,[514]=-1,[515]=-1,[516]=-1,[517]=-1,[518]=-1,[519]=-1,[520]=-1,[521]=-1,[522]=-1,[523]=-1,[524]=-1,[525]=-1,[526]=-1,[527]=-1,[528]=-1,[529]=-1,[530]=-1,[531]=-1,[532]=-1,[533]=-1,[534]=-1,[535]=-1,[536]=-1,[537]=-1,[538]=-1,[539]=-1,[540]=-1,[541]=-1,[542]=-1,[543]=-1,[544]=-1,[545]=-1,[546]=-1,[547]=-1,[548]=-1,[549]=-1,[550]=-1,[551]=-1,[552]=-1,[553]=-1,[554]=-1,[555]=-1,[556]=-1,[557]=-1,[558]=-1,[559]=-1,[560]=-1,[561]=-1,[562]=-1,[563]=-1,[564]=-1,[565]=-1,[566]=-1,[567]=-1,[568]=-1,[569]=-1,[570]=-1,[571]=-1,[572]=-1,[573]=-1,[574]=-1,[575]=-1,[576]=-1,[577]=-1,[578]=-1,[579]=-1,[580]=-1,[581]=-1,[582]=-1,[583]=-1,[584]=-1,[585]=-1,[586]=-1,[587]=-1,[588]=-1,[589]=-1,[590]=-1,[591]=-1,[592]=-1,[593]=-1,[594]=-1,[595]=-1,[596]=-1,[597]=-1,[598]=-1,[599]=-1,[600]=-1,[601]=-1,[602]=-1,[603]=-1,[604]=-1,[605]= 0,[606]= 0,[607]= 0,[608]= 0,[609]= 0,[610]=-1,[611]= 0,[612]=-1,[613]=-1,[614]=-1,[615]=-1,[616]=-1,[617]=-1,[618]=-1,[619]=-1,[620]=-1,[621]=-1,[622]=-1,[623]=-1,[624]=-1,[625]=-1,[626]=-1,[627]=-1,[628]=-1,[629]=-1,[630]=-1,[631]=-1,[632]=-1,[633]=-1,[634]=-1,[635]=-1,[636]=-1,[637]=-1,[638]=-1,[639]=-1,[640]=-1,[641]=-1,[642]=-1,[643]=-1,[644]=-1,[645]=-1,[646]=-1,[647]=-1,[648]=-1,[649]=-1,[650]=-1,[651]=-1,[652]=-1,[653]=-1,[654]=-1,[655]=-1,[656]=-1,[657]=-1,[658]=-1,[659]=-1,[660]=-1,[661]=-1,[662]=-1,[663]=-1,[664]=-1,[665]=-1,[666]=-1,[667]=-1,[668]=-1,[669]=-1,[670]=-1,[671]=-1,[672]=-1,[673]=-1,[674]=-1,[675]=-1,[676]=-1,[677]=-1,[678]=-1,[679]=-1,[680]=-1,[681]=-1,[682]=-1,[683]=-1,[684]=-1,[685]=-1,[686]=-1,[687]=-1,[688]=-1,[689]=-1,[690]=-1,[691]=-1,[692]=-1,[693]=-1,[694]=-1,[695]=-1,[696]=-1,[697]=-1,[698]=-1,[699]=-1,[700]=-1,[701]=-1,[702]=-1,[703]=-1,[704]=-1,[705]=-1,[706]=-1,[707]=-1,[708]= 0,[709]= 0,[710]= 0,[711]= 0,[712]=-1,[713]=-1,[714]=-1,[715]=-1,[716]=-1,[717]=-1,[718]=-1,[719]=-1,[720]=-1,[721]=-1,[722]=-1,[723]=-1,[724]=-1,[725]=-1,[726]=-1,[727]=-1,[728]=-1,[729]=-1,[730]=-1,[731]=-1,[732]=-1,[733]=-1,[734]=-1,[735]=-1,[736]=-1,[737]=-1,[738]=-1,[739]=-1,[740]=-1,[741]=-1,[742]=-1,[743]=-1,[744]=-1,[745]=-1,[746]=-1,[747]=-1,[748]=-1,[749]=-1,[750]=-1,[751]=-1,[752]=-1,[753]=-1,[754]=-1,[755]=-1,[756]=-1,[757]=-1,[758]=-1,[759]=-1,[760]=-1,[761]=-1,[762]=-1,[763]=-1,[764]=-1,[765]=-1,[766]=-1,[767]=-1,[768]=-1,[769]=-1,[770]=-1,[771]=-1,[772]=-1,[773]=-1,[774]=-1,[775]=-1,[776]=-1,[777]=-1,[778]=-1,[779]=-1,[780]=-1,[781]=-1,[782]=-1,[783]=-1,[784]=-1,[785]=-1,[786]=-1,[787]=-1,[788]=-1,[789]=-1,[790]=-1,[791]=-1,[792]=-1,[793]=-1,[794]=-1,[795]=-1,[796]=-1,[797]=-1,[798]=-1,[799]=-1,[800]=-1,[801]=-1,[802]=-1,[803]=-1,[804]=-1,[805]=-1,[806]=-1,[807]=-1,[808]=-1,[809]=-1,[810]= 0,[811]= 0,[812]= 0,[813]=-1,[814]=-1,[815]=-1,[816]=-1,[817]=-1,[818]=-1,[819]=-1,[820]=-1,[821]=-1,[822]=-1,[823]=-1,[824]=-1,[825]=-1,[826]=-1,[827]=-1,[828]=-1,[829]=-1,[830]=-1,[831]=-1,[832]=-1,[833]=-1,[834]=-1,[835]=-1,[836]=-1,[837]=-1,[838]=-1,[839]=-1,[840]=-1,[841]=-1,[842]=-1,[843]=-1,[844]=-1,[845]=-1,[846]=-1,[847]=-1,[848]=-1,[849]=-1,[850]=-1,[851]=-1,[852]=-1,[853]=-1,[854]=-1,[855]=-1,[856]=-1,[857]=-1,[858]=-1,[859]=-1,[860]=-1,[861]=-1,[862]=-1,[863]=-1,[864]=-1,[865]=-1,[866]=-1,[867]=-1,[868]=-1,[869]=-1,[870]=-1,[871]=-1,[872]=-1,[873]=-1,[874]=-1,[875]=-1,[876]=-1,[877]=-1,[878]=-1,[879]=-1,[880]=-1,[881]=-1,[882]=-1,[883]=-1,[884]=-1,[885]=-1,[886]=-1,[887]=-1,[888]=-1,[889]=-1,[890]=-1,[891]=-1,[892]=-1,[893]=-1,[894]=-1,[895]=-1,[896]=-1,[897]=-1,[898]=-1,[899]=-1,[900]=-1,[901]=-1,[902]=-1,[903]=-1,[904]=-1,[905]=-1,[906]=-1,[907]=-1,[908]=-1,[909]=-1,[910]= 0,[911]= 0,[912]= 0,[913]= 0,[914]= 0,[915]=-1,[916]=-1,[917]=-1,[918]=-1,[919]=-1,[920]=-1,[921]=-1,[922]=-1,[923]=-1,[924]=-1,[925]=-1,[926]=-1,[927]=-1,[928]=-1,[929]=-1,[930]=-1,[931]=-1,[932]=-1,[933]=-1,[934]=-1,[935]=-1,[936]=-1,[937]=-1,[938]=-1,[939]=-1,[940]=-1,[941]=-1,[942]=-1,[943]=-1,[944]=-1,[945]=-1,[946]=-1,[947]=-1,[948]=-1,[949]=-1,[950]=-1,[951]=-1,[952]=-1,[953]=-1,[954]=-1,[955]=-1,[956]=-1,[957]=-1,[958]=-1,[959]=-1,[960]=-1,[961]=-1,[962]=-1,[963]=-1,[964]=-1,[965]=-1,[966]=-1,[967]=-1,[968]=-1,[969]=-1,[970]=-1,[971]=-1,[972]=-1,[973]=-1,[974]=-1,[975]=-1,[976]=-1,[977]=-1,[978]=-1,[979]=-1,[980]=-1,[981]=-1,[982]=-1,[983]=-1,[984]=-1,[985]=-1,[986]=-1,[987]=-1,[988]=-1,[989]=-1,[990]=-1,[991]=-1,[992]=-1,[993]=-1,[994]=-1,[995]=-1,[996]=-1,[997]=-1,[998]=-1,[999]=-1,[1000]=-1,[1001]=-1,[1002]=-1,[1003]=-1,[1004]=-1,[1005]=-1,[1006]=-1,[1007]=-1,[1008]= 0,[1009]= 0,[1010]=-1,[1011]= 0,[1012]= 0,[1013]= 0,[1014]=-1,[1015]= 0,[1016]= 0,[1017]=-1,[1018]=-1,[1019]=-1,[1020]=-1,[1021]=-1,[1022]=-1,[1023]=-1,[1024]=-1,[1025]=-1,[1026]=-1,[1027]=-1,[1028]=-1,[1029]=-1,[1030]=-1,[1031]=-1,[1032]=-1,[1033]=-1,[1034]=-1,[1035]=-1,[1036]=-1,[1037]=-1,[1038]=-1,[1039]=-1,[1040]=-1,[1041]=-1,[1042]=-1,[1043]=-1,[1044]=-1,[1045]=-1,[1046]=-1,[1047]=-1,[1048]=-1,[1049]=-1,[1050]=-1,[1051]=-1,[1052]=-1,[1053]=-1,[1054]=-1,[1055]=-1,[1056]=-1,[1057]=-1,[1058]=-1,[1059]=-1,[1060]=-1,[1061]=-1,[1062]=-1,[1063]=-1,[1064]=-1,[1065]=-1,[1066]=-1,[1067]=-1,[1068]=-1,[1069]=-1,[1070]=-1,[1071]=-1,[1072]=-1,[1073]=-1,[1074]=-1,[1075]=-1,[1076]=-1,[1077]=-1,[1078]= 0,[1079]= 0,[1080]=-1,[1081]=-1,[1082]= 0,[1083]= 0,[1084]=-1,[1085]=-1,[1086]= 0,[1087]= 0,[1088]= 0,[1089]= 0,[1090]= 0,[1091]=-1,[1092]=-1,[1093]=-1,[1094]=-1,[1095]=-1,[1096]=-1,[1097]=-1,[1098]=-1,[1099]=-1,[1100]=-1,[1101]=-1,[1102]=-1,[1103]= 0,[1104]=-1,[1105]=-1,[1106]=-1,[1107]=-1,[1108]=-1,[1109]=-1,[1110]=-1,[1111]=-1,[1112]=-1,[1113]=-1,[1114]=-1,[1115]=-1,[1116]=-1,[1117]=-1,[1118]=-1,[1119]=-1,[1120]=-1,[1121]= 0,[1122]=-1,[1123]=-1,[1124]=-1,[1125]=-1,[1126]=-1,[1127]=-1,[1128]=-1,[1129]=-1,[1130]=-1,[1131]=-1,[1132]=-1,[1133]=-1,[1134]=-1,[1135]=-1,[1136]=-1,[1137]=-1,[1138]=-1,[1139]=-1,[1140]=-1,[1141]=-1,[1142]=-1,[1143]=-1,[1144]=-1,[1145]=-1,[1146]=-1,[1147]=-1,[1148]=-1,[1149]=-1,[1150]=-1,[1151]=-1,[1152]=-1,[1153]=-1,[1154]=-1,[1155]=-1,[1156]=-1,[1157]=-1,[1158]=-1,[1159]=-1,[1160]= 0,[1161]=-1,[1162]=-1,[1163]=-1,[1164]=-1,[1165]=-1,[1166]=-1,[1167]= 0,[1168]=-1,[1169]=-1,[1170]=-1,[1171]=-1,[1172]=-1,[1173]=-1,[1174]=-1,[1175]=-1,[1176]=-1,[1177]=-1,[1178]=-1,[1179]=-1,[1180]=-1,[1181]=-1,[1182]=-1,[1183]=-1,[1184]=-1,[1185]=-1,[1186]=-1,[1187]=-1,[1188]=-1,[1189]=-1,[1190]= 0,[1191]=-1,[1192]=-1,[1193]=-1,[1194]=-1,[1195]=-1,[1196]=-1,[1197]= 0,[1198]=-1,[1199]=-1,[1200]=-1,[1201]=-1,[1202]=-1,[1203]=-1,[1204]=-1,[1205]=-1,[1206]=-1,[1207]=-1,[1208]=-1,[1209]=-1,[1210]=-1,[1211]=-1,[1212]=-1,[1213]=-1,[1214]= 0,[1215]= 0,[1216]= 0,[1217]=-1,[1218]=-1,[1219]=-1,[1220]= 0,[1221]= 0,[1222]= 0,[1223]= 0,[1224]=-1,[1225]=-1,[1226]=-1,[1227]=-1,[1228]=-1,[1229]=-1,[1230]=-1,[1231]=-1,[1232]=-1,[1233]=-1,[1234]=-1,[1235]=-1,[1236]=-1,[1237]=-1,[1238]=-1,[1239]=-1,[1240]=-1,[1241]=-1,[1242]=-1,[1243]=-1,[1244]=-1,[1245]=-1,[1246]=-1,[1247]=-1,[1248]=-1,[1249]=-1,[1250]=-1,[1251]=-1,[1252]=-1,[1253]=-1,[1254]=-1,[1255]=-1,[1256]=-1,[1257]=-1,[1258]=-1,[1259]=-1,[1260]=-1,[1261]=-1,[1262]= 0,[1263]=-1,[1264]=-1,[1265]=-1,[1266]=-1,[1267]=-1,[1268]=-1,[1269]= 0,[1270]=-1,[1271]=-1,[1272]=-1,[1273]=-1,[1274]=-1,[1275]=-1,[1276]=-1,[1277]=-1,[1278]=-1,[1279]=-1,[1280]=-1,[1281]=-1,[1282]= 0,[1283]=-1,[1284]=-1,[1285]=-1,[1286]=-1,[1287]=-1,[1288]=-1,[1289]=-1,[1290]=-1,[1291]=-1,[1292]=-1,[1293]=-1,[1294]=-1,[1295]=-1,[1296]=-1,[1297]=-1,[1298]=-1,[1299]= 0,[1300]=-1,[1301]=-1,[1302]=-1,[1303]=-1,[1304]=-1,[1305]=-1,[1306]=-1,[1307]=-1,[1308]= 0,[1309]= 0,[1310]=-1,[1311]= 0,[1312]=-1,[1313]=-1,[1314]=-1,[1315]=-1,[1316]= 0,[1317]= 0,[1318]= 0,[1319]= 0,[1320]= 0,[1321]=-1,[1322]= 0,[1323]= 0,[1324]= 0,[1325]= 0,[1326]=-1,[1327]=-1,[1328]=-1,[1329]=-1,[1330]=-1,[1331]=-1,[1332]=-1,[1333]=-1,[1334]=-1,[1335]=-1,[1336]=-1,[1337]=-1,[1338]=-1,[1339]=-1,[1340]=-1,[1341]=-1,[1342]=-1,[1343]=-1,[1344]=-1,[1345]=-1,[1346]=-1,[1347]=-1,[1348]=-1,[1349]=-1,[1350]=-1,[1351]=-1,[1352]=-1,[1353]=-1,[1354]=-1,[1355]=-1,[1356]=-1,[1357]=-1,[1358]=-1,[1359]=-1,[1360]=-1,[1361]=-1,[1362]=-1,[1363]=-1,[1364]= 0,[1365]=-1,[1366]=-1,[1367]=-1,[1368]=-1,[1369]=-1,[1370]=-1,[1371]= 0,[1372]=-1,[1373]=-1,[1374]=-1,[1375]=-1,[1376]=-1,[1377]=-1,[1378]=-1,[1379]=-1,[1380]=-1,[1381]=-1,[1382]=-1,[1383]=-1,[1384]=-1,[1385]=-1,[1386]=-1,[1387]=-1,[1388]=-1,[1389]=-1,[1390]=-1,[1391]=-1,[1392]=-1,[1393]=-1,[1394]=-1,[1395]=-1,[1396]=-1,[1397]=-1,[1398]=-1,[1399]=-1,[1400]=-1,[1401]= 0,[1402]=-1,[1403]=-1,[1404]=-1,[1405]=-1,[1406]=-1,[1407]= 0,[1408]= 0,[1409]=-1,[1410]= 0,[1411]= 0,[1412]= 0,[1413]= 0,[1414]=-1,[1415]=-1,[1416]= 0,[1417]= 0,[1418]= 0,[1419]= 0,[1420]= 0,[1421]= 0,[1422]= 0,[1423]= 0,[1424]= 0,[1425]= 0,[1426]= 0,[1427]= 0,[1428]=-1,[1429]=-1,[1430]=-1,[1431]=-1,[1432]=-1,[1433]=-1,[1434]=-1,[1435]=-1,[1436]=-1,[1437]=-1,[1438]=-1,[1439]=-1,[1440]=-1,[1441]=-1,[1442]=-1,[1443]=-1,[1444]=-1,[1445]=-1,[1446]=-1,[1447]=-1,[1448]=-1,[1449]=-1,[1450]=-1,[1451]=-1,[1452]=-1,[1453]=-1,[1454]=-1,[1455]=-1,[1456]=-1,[1457]=-1,[1458]=-1,[1459]=-1,[1460]=-1,[1461]=-1,[1462]=-1,[1463]=-1,[1464]=-1,[1465]=-1,[1466]= 0,[1467]=-1,[1468]=-1,[1469]=-1,[1470]=-1,[1471]=-1,[1472]=-1,[1473]= 0,[1474]=-1,[1475]=-1,[1476]=-1,[1477]=-1,[1478]=-1,[1479]=-1,[1480]=-1,[1481]=-1,[1482]=-1,[1483]=-1,[1484]=-1,[1485]=-1,[1486]=-1,[1487]=-1,[1488]=-1,[1489]=-1,[1490]=-1,[1491]=-1,[1492]=-1,[1493]=-1,[1494]=-1,[1495]=-1,[1496]=-1,[1497]=-1,[1498]=-1,[1499]=-1,[1500]=-1,[1501]=-1,[1502]=-1,[1503]= 0,[1504]=-1,[1505]=-1,[1506]=-1,[1507]=-1,[1508]=-1,[1509]= 0,[1510]= 0,[1511]= 0,[1512]= 0,[1513]= 0,[1514]= 0,[1515]= 0,[1516]= 0,[1517]=-1,[1518]=-1,[1519]=-1,[1520]= 0,[1521]= 0,[1522]= 0,[1523]= 0,[1524]= 0,[1525]= 0,[1526]= 0,[1527]= 0,[1528]= 0,[1529]= 0,[1530]=-1,[1531]=-1,[1532]=-1,[1533]=-1,[1534]=-1,[1535]=-1,[1536]=-1,[1537]=-1,[1538]=-1,[1539]=-1,[1540]=-1,[1541]=-1,[1542]=-1,[1543]=-1,[1544]=-1,[1545]=-1,[1546]=-1,[1547]=-1,[1548]=-1,[1549]=-1,[1550]=-1,[1551]=-1,[1552]=-1,[1553]=-1,[1554]=-1,[1555]=-1,[1556]=-1,[1557]=-1,[1558]=-1,[1559]=-1,[1560]=-1,[1561]=-1,[1562]=-1,[1563]=-1,[1564]=-1,[1565]=-1,[1566]=-1,[1567]=-1,[1568]= 0,[1569]=-1,[1570]=-1,[1571]=-1,[1572]=-1,[1573]=-1,[1574]=-1,[1575]= 0,[1576]=-1,[1577]=-1,[1578]=-1,[1579]=-1,[1580]=-1,[1581]=-1,[1582]=-1,[1583]=-1,[1584]=-1,[1585]=-1,[1586]=-1,[1587]=-1,[1588]=-1,[1589]=-1,[1590]=-1,[1591]=-1,[1592]=-1,[1593]=-1,[1594]=-1,[1595]=-1,[1596]=-1,[1597]=-1,[1598]=-1,[1599]=-1,[1600]=-1,[1601]=-1,[1602]=-1,[1603]=-1,[1604]=-1,[1605]= 0,[1606]=-1,[1607]=-1,[1608]=-1,[1609]=-1,[1610]=-1,[1611]= 0,[1612]= 0,[1613]= 0,[1614]= 0,[1615]= 0,[1616]= 0,[1617]= 0,[1618]= 0,[1619]=-1,[1620]=-1,[1621]= 0,[1622]= 0,[1623]= 0,[1624]= 0,[1625]= 0,[1626]= 0,[1627]= 0,[1628]= 0,[1629]= 0,[1630]= 0,[1631]= 0,[1632]=-1,[1633]=-1,[1634]=-1,[1635]=-1,[1636]=-1,[1637]=-1,[1638]=-1,[1639]=-1,[1640]=-1,[1641]=-1,[1642]=-1,[1643]=-1,[1644]=-1,[1645]=-1,[1646]=-1,[1647]=-1,[1648]=-1,[1649]=-1,[1650]=-1,[1651]=-1,[1652]=-1,[1653]=-1,[1654]=-1,[1655]=-1,[1656]=-1,[1657]=-1,[1658]=-1,[1659]=-1,[1660]=-1,[1661]=-1,[1662]=-1,[1663]=-1,[1664]=-1,[1665]=-1,[1666]=-1,[1667]=-1,[1668]=-1,[1669]=-1,[1670]= 0,[1671]=-1,[1672]=-1,[1673]=-1,[1674]=-1,[1675]=-1,[1676]=-1,[1677]= 0,[1678]=-1,[1679]=-1,[1680]=-1,[1681]=-1,[1682]=-1,[1683]=-1,[1684]=-1,[1685]=-1,[1686]=-1,[1687]=-1,[1688]=-1,[1689]=-1,[1690]=-1,[1691]=-1,[1692]=-1,[1693]=-1,[1694]=-1,[1695]=-1,[1696]=-1,[1697]=-1,[1698]=-1,[1699]=-1,[1700]=-1,[1701]=-1,[1702]=-1,[1703]=-1,[1704]=-1,[1705]=-1,[1706]=-1,[1707]= 0,[1708]=-1,[1709]=-1,[1710]=-1,[1711]=-1,[1712]=-1,[1713]= 0,[1714]= 0,[1715]= 0,[1716]= 0,[1717]= 0,[1718]= 0,[1719]= 0,[1720]=-1,[1721]=-1,[1722]= 0,[1723]= 0,[1724]= 0,[1725]= 0,[1726]= 0,[1727]= 0,[1728]= 0,[1729]= 0,[1730]= 0,[1731]= 0,[1732]= 0,[1733]= 0,[1734]=-1,[1735]=-1,[1736]=-1,[1737]=-1,[1738]=-1,[1739]=-1,[1740]=-1,[1741]=-1,[1742]=-1,[1743]=-1,[1744]=-1,[1745]=-1,[1746]=-1,[1747]=-1,[1748]=-1,[1749]=-1,[1750]=-1,[1751]=-1,[1752]=-1,[1753]=-1,[1754]=-1,[1755]=-1,[1756]=-1,[1757]=-1,[1758]=-1,[1759]=-1,[1760]=-1,[1761]=-1,[1762]=-1,[1763]=-1,[1764]=-1,[1765]=-1,[1766]=-1,[1767]=-1,[1768]=-1,[1769]=-1,[1770]=-1,[1771]=-1,[1772]= 0,[1773]=-1,[1774]=-1,[1775]=-1,[1776]=-1,[1777]=-1,[1778]=-1,[1779]= 0,[1780]=-1,[1781]=-1,[1782]=-1,[1783]=-1,[1784]=-1,[1785]=-1,[1786]=-1,[1787]=-1,[1788]=-1,[1789]=-1,[1790]=-1,[1791]=-1,[1792]=-1,[1793]=-1,[1794]=-1,[1795]=-1,[1796]=-1,[1797]=-1,[1798]=-1,[1799]=-1,[1800]=-1,[1801]=-1,[1802]=-1,[1803]=-1,[1804]=-1,[1805]=-1,[1806]=-1,[1807]=-1,[1808]=-1,[1809]= 0,[1810]=-1,[1811]=-1,[1812]=-1,[1813]=-1,[1814]=-1,[1815]= 0,[1816]= 0,[1817]= 0,[1818]= 0,[1819]= 0,[1820]= 0,[1821]= 0,[1822]= 0,[1823]=-1,[1824]=-1,[1825]= 0,[1826]= 0,[1827]= 0,[1828]= 0,[1829]= 0,[1830]= 0,[1831]= 0,[1832]= 0,[1833]= 0,[1834]= 0,[1835]= 0,[1836]=-1,[1837]=-1,[1838]=-1,[1839]=-1,[1840]=-1,[1841]=-1,[1842]=-1,[1843]=-1,[1844]=-1,[1845]=-1,[1846]=-1,[1847]=-1,[1848]=-1,[1849]=-1,[1850]=-1,[1851]=-1,[1852]=-1,[1853]=-1,[1854]=-1,[1855]=-1,[1856]=-1,[1857]=-1,[1858]=-1,[1859]=-1,[1860]=-1,[1861]=-1,[1862]=-1,[1863]=-1,[1864]=-1,[1865]=-1,[1866]=-1,[1867]=-1,[1868]=-1,[1869]=-1,[1870]=-1,[1871]=-1,[1872]=-1,[1873]=-1,[1874]= 0,[1875]=-1,[1876]=-1,[1877]=-1,[1878]=-1,[1879]=-1,[1880]=-1,[1881]= 0,[1882]=-1,[1883]=-1,[1884]=-1,[1885]=-1,[1886]=-1,[1887]=-1,[1888]=-1,[1889]=-1,[1890]=-1,[1891]=-1,[1892]=-1,[1893]=-1,[1894]=-1,[1895]=-1,[1896]=-1,[1897]=-1,[1898]=-1,[1899]=-1,[1900]=-1,[1901]=-1,[1902]=-1,[1903]=-1,[1904]=-1,[1905]=-1,[1906]=-1,[1907]=-1,[1908]=-1,[1909]=-1,[1910]=-1,[1911]= 0,[1912]=-1,[1913]=-1,[1914]=-1,[1915]=-1,[1916]=-1,[1917]= 0,[1918]= 0,[1919]= 0,[1920]= 0,[1921]= 0,[1922]= 0,[1923]= 0,[1924]=-1,[1925]=-1,[1926]=-1,[1927]= 0,[1928]= 0,[1929]= 0,[1930]= 0,[1931]= 0,[1932]= 0,[1933]=-1,[1934]= 0,[1935]= 0,[1936]= 0,[1937]= 0,[1938]=-1,[1939]=-1,[1940]=-1,[1941]=-1,[1942]=-1,[1943]=-1,[1944]=-1,[1945]=-1,[1946]=-1,[1947]=-1,[1948]=-1,[1949]=-1,[1950]=-1,[1951]=-1,[1952]=-1,[1953]=-1,[1954]=-1,[1955]=-1,[1956]=-1,[1957]=-1,[1958]=-1,[1959]=-1,[1960]=-1,[1961]=-1,[1962]=-1,[1963]=-1,[1964]=-1,[1965]=-1,[1966]=-1,[1967]=-1,[1968]=-1,[1969]=-1,[1970]=-1,[1971]=-1,[1972]=-1,[1973]=-1,[1974]=-1,[1975]=-1,[1976]= 0,[1977]=-1,[1978]=-1,[1979]=-1,[1980]=-1,[1981]=-1,[1982]=-1,[1983]= 0,[1984]=-1,[1985]=-1,[1986]=-1,[1987]=-1,[1988]=-1,[1989]=-1,[1990]=-1,[1991]=-1,[1992]=-1,[1993]=-1,[1994]=-1,[1995]=-1,[1996]=-1,[1997]=-1,[1998]=-1,[1999]=-1,[2000]=-1,[2001]=-1,[2002]=-1,[2003]=-1,[2004]=-1,[2005]=-1,[2006]=-1,[2007]=-1,[2008]=-1,[2009]=-1,[2010]=-1,[2011]=-1,[2012]=-1,[2013]= 0,[2014]=-1,[2015]=-1,[2016]=-1,[2017]=-1,[2018]=-1,[2019]= 0,[2020]= 0,[2021]= 0,[2022]= 0,[2023]= 0,[2024]= 0,[2025]=-1,[2026]= 0,[2027]=-1,[2028]=-1,[2029]=-1,[2030]=-1,[2031]= 0,[2032]= 0,[2033]= 0,[2034]= 0,[2035]= 0,[2036]= 0,[2037]= 0,[2038]= 0,[2039]= 0,[2040]=-1,[2041]=-1,[2042]=-1,[2043]=-1,[2044]=-1,[2045]=-1,[2046]=-1,[2047]=-1,[2048]=-1,[2049]=-1,[2050]=-1,[2051]=-1,[2052]=-1,[2053]=-1,[2054]=-1,[2055]=-1,[2056]=-1,[2057]=-1,[2058]=-1,[2059]=-1,[2060]=-1,[2061]=-1,[2062]=-1,[2063]=-1,[2064]=-1,[2065]=-1,[2066]=-1,[2067]=-1,[2068]=-1,[2069]=-1,[2070]=-1,[2071]=-1,[2072]=-1,[2073]=-1,[2074]=-1,[2075]=-1,[2076]=-1,[2077]=-1,[2078]= 0,[2079]=-1,[2080]=-1,[2081]=-1,[2082]=-1,[2083]=-1,[2084]=-1,[2085]= 0,[2086]=-1,[2087]=-1,[2088]=-1,[2089]=-1,[2090]=-1,[2091]=-1,[2092]=-1,[2093]=-1,[2094]=-1,[2095]=-1,[2096]=-1,[2097]=-1,[2098]=-1,[2099]=-1,[2100]=-1,[2101]=-1,[2102]=-1,[2103]=-1,[2104]=-1,[2105]=-1,[2106]=-1,[2107]=-1,[2108]= 0,[2109]=-1,[2110]=-1,[2111]=-1,[2112]=-1,[2113]=-1,[2114]=-1,[2115]= 0,[2116]=-1,[2117]=-1,[2118]=-1,[2119]=-1,[2120]=-1,[2121]= 0,[2122]= 0,[2123]= 0,[2124]= 0,[2125]= 0,[2126]= 0,[2127]=-1,[2128]=-1,[2129]=-1,[2130]=-1,[2131]= 0,[2132]= 0,[2133]= 0,[2134]= 0,[2135]= 0,[2136]= 0,[2137]= 0,[2138]= 0,[2139]= 0,[2140]= 0,[2141]= 0,[2142]= 0,[2143]= 0,[2144]= 0,[2145]=-1,[2146]=-1,[2147]=-1,[2148]=-1,[2149]=-1,[2150]=-1,[2151]= 0,[2152]= 0,[2153]= 0,[2154]= 0,[2155]=-1,[2156]=-1,[2157]=-1,[2158]=-1,[2159]=-1,[2160]=-1,[2161]= 0,[2162]= 0,[2163]= 0,[2164]= 0,[2165]=-1,[2166]=-1,[2167]=-1,[2168]=-1,[2169]=-1,[2170]=-1,[2171]= 0,[2172]= 0,[2173]= 0,[2174]= 0,[2175]=-1,[2176]=-1,[2177]=-1,[2178]=-1,[2179]=-1,[2180]=-1,[2181]= 0,[2182]= 0,[2183]= 0,[2184]= 0,[2185]=-1,[2186]=-1,[2187]=-1,[2188]=-1,[2189]=-1,[2190]=-1,[2191]= 0,[2192]= 0,[2193]= 0,[2194]= 0,[2195]=-1,[2196]=-1,[2197]=-1,[2198]=-1,[2199]=-1,[2200]=-1,[2201]= 0,[2202]= 0,[2203]= 0,[2204]= 0,[2205]=-1,[2206]=-1,[2207]=-1,[2208]=-1,[2209]=-1,[2210]=-1,[2211]= 0,[2212]= 0,[2213]= 0,[2214]= 0,[2215]=-1,[2216]=-1,[2217]=-1,[2218]=-1,[2219]=-1,[2220]=-1,[2221]= 0,[2222]= 0,[2223]= 0,[2224]= 0,[2225]=-1,[2226]=-1,[2227]=-1,[2228]=-1,[2229]=-1,[2230]=-1,[2231]= 0,[2232]= 0,[2233]= 0,[2234]= 0,[2235]=-1,[2236]=-1,[2237]=-1,[2238]=-1,[2239]=-1,[2240]=-1,}, } -- wt_satlins {} -- local wt_purelin_4 = { } -- wt_purelin_4 {} -- local wt_purelin_5 = { [4]=1831, [2]=2022, [3]=1971, [1]=1913, } -- wt_purelin_5 {} -- ---------------------------------------------------- INSERT NEW SERIALIZED HEBBIAN LIBRARY BELOW ---------------------------------------------------- local g_Hebbianweight = { [1]={ [1]=0, }, } ---------------------------------------------------- INSERT NEW SERIALIZED HEBBIAN LIBRARY ABOVE ---------------------------------------------------- --[[-------OBJECT------------- Definitions: 1. g_GlobalKey - A global, auto-associative, hash-indexable, library which saves the entire state of the foldit system, at any one time, in the form of localized, 2,240-bit fields, termed PrimaryKeys. 2. PrimaryKey - A unique snapshot and/or instance of the foldit environment in which two (2) states are preserved: 1. the state of the environment before an optimal stabilization (See PrimaryKey bitmap), and 2. the optimal stabilization technique which followed (See bitmap field A). 3. QueryKey - The present-state of the foldit environment which the algorithm attempts to match to one previously known (A PrimaryKey), in order to KNOW what the algorithm should do next. Description: QueryKey, PrimaryKey bitmaps: PrimaryKey = B[10][10]* + C[10][10] + D[10][102] + E[10][102] + F[10][10] = +2,240 bits A = targetQSTAB B = mostPOS* C = mostNEG D = scorepartFRACTIONS E = subscoreHISTORY F = qstabHISTORY * - optional Given the above.. PrimaryKey = B + C + D + E + F, and g_GlobalKey [ B + C + D + E + F ] = A, thus g_GlobalKey [ PrimaryKey ] = A; and, when QueryKey == PrimaryKey g_GlobalKey [ QueryKey ] = A Permissions: PrimaryKey (Gen.Permissions: write-only; Training mode Permissions: read/write) QueryKey (Gen.Permissions: read-only; Training mode Permissions: read) PrimaryKey Legend 1: 1 0: 0 wildcard: - Training Duration: 1,000 iterations (10 hours) -------------------------]]-- local g_GlobalKey = { -- a global catalog of primaryKeys -- ["-00-000-00000-00--000-0000--00--0-000-000-000-00-000000-00-0-0000000---000-000---000-00000001000000010000000000000000000000000000000000000000000000000000000000000000000000-0-00000--00----000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000-00-0000--0----00000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000---0000-0000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000---------0000-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000-----0-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000----00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000---0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000-----000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000--0---0--0000000000000000000000000000000000000000000000000000000000000--00--00-----000000000000-00000000000000000-00000000000000000000000000000000000000-000000-0000000000000000000000-000000-0000000000000000---000----00000000000000000000000000000000000000-000000-000000000000-0000000000000000-00000000--0-0000-----0----00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000--0----00------------00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000--------000----------00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000--------00-----------00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000-------00------------00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000--------00-----------00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000-------000------0----00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000------0-0000---------00000000000000000000000000000000000000-000000-0000000000000000000000-000000-00000------0000--------------000000----000000----000000----000000----000000----000000----000000----000000----000000----000000"]="10000000000", ["-00-000-00--0000--000-0-00--00-00-00--000-0000-0-0000001000000000000--0000-0000--000-0000000100000001000000000000000000000000000000000000000000000000000000-0000000000000000000000-0-00---000000000000000010000000000000000000000000000000000000000000000000000000000000-0000000000000000-0000----0000-000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000-----00-0-00000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000------0-00-0-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000---0-0-0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000----00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000---000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000-0----00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000---0----0-0000000000000000000000000000000000000000000000000000000000000-000000----0---0000-000000000000000000-000-000000000000000000000000000000000000000000000000000000000000000000000000000000000-0-----0000000000----000000000000000000000000000000000000000000000-00000000000000000000000000000-00000---000000-00---------00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000000---0-0000----0----00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000--0----0000----0-----00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000-------00-0--0--0----00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000---0-0--00000-0000---00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000--00-0000000---000---00000000000000000000000000000000000000-000000-00000000000000000000000000000-000000----00000-0--000----00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000--0---000000--000----00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000-00---0000000--00----0--000000-0--000000----000000----000000----000000----000000----000000----000000----000000----000000"]="00100000000", ["-00-0000000-00000-00000000--00-00-0000000-0000-000000001000000000000100000000001000010000000100000001000000000000000000000000000000000000000000000000000000-0000000000000000000000000000--0000000000000000100000000000000000000000000000000000000000000000000000000-0000000000000000000000000000--00000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000--000000-000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000--00000-01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000--0-0-0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000--0-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000--00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000--0-0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000-000-00000000000000000000000000000000000000000000000000000000000000000000--00000000000000000000000000000-000-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000---0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000-000----000000000000000000000000000000000000000000000000000000000000000000000000000000000000-00000000---00----000000000000000000000000000000000000000000000000000000000000000000000000000000000-00---000000---00----000000000000000000000000000000000000000000000000000000000000000000000000000-00000-00--000000-----0----00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000------000000---------00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000------0000-----------00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000-------00------------00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000--------00------0----00000000000000000000000000000000000000-000000-00000000000000000000000000000-00000-------000----0-00------000000----000000----000000----000000----000000----000000----000000----000000----000000----000000"]="01000000000", ["-00-000-00--0-00--00--0-00--00--0-00--00--0-0-00-0-0000-00-0-0000000---000-0000--000-000-000100000001000000000000000000000000000000000000000000000000000000000000-00-000-0000000-0-0-0-----0000000000000001000000000000000000000000000000000000000000000000000000000000000000000000-0000----00----0--0-000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000------000-0000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000---------0000-0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000--------00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000-0----0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000----000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000------00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000----------000000000000000000000000000000000000000000000000000000000000--0----0---------000---00000-00-00-00000000-00000000000000000000000000000000000000-000000-000000000000-0000000000000000-00000--------0------------00000000000000000000000000000000000000-000000-0000000000000000000000-000000-00000--------00-----------00000000000000000000000000000000000000-000000-000000000000-000000000-000000-00000--------00-----------00000000000000000000000000000000000000-000000-000000000000-000000000-000000-00000--------0------------00000000000000000000000000000000000000-000000-000000000000-000000000-000000-00000--------00-----------00000000000000000000000000000000000000-000000-000000000000-000000000-000000-00000-------000-----------00000000000000000000000000000000000000-000000-000000000000-000000000-000000-00000--------0------------00000000000000000000000000000000000000-000000-000000000000-000000000-000000-00000--------00-----------00000000000000000000000000000000000000-000000-000000000000-000000000-000000-00000-------00------------00000000000000000000000000000000000000-000000-000000000000-0000000000000000-00000--------0---------------000000----000000----000000----000000----000000----000000----000000----000000----000000----000000"]="00010000000", } -- g_GlobalKey {} -- --[[-------OBJECT------------- Description: quick inline IF-statement 1. print ( qtest ( true,'Sucess!','Failed' ) ) -------------------------]]-- local function qtest ( ... ) local rval = { [true] = arg[2], [false] = arg[3], } -- rval {} -- return rval [ arg[1] ] end -- qtest -- --[[-------OBJECT------------- Description: timer object to generate, track, and relay elapsed time 1. local stopwatch = g_timer.New () stopwatch:Start () for i=1,1e5 do local i=1*1 end stopwatch:Stop () stopwatch:ShowElapsedTotal () 2. local stopwatch = g_timer.New () stopwatch:Start () for i=1,1e5 do local i=1*1 stopwatch:ShowElapsed () end stopwatch:Stop () stopwatch:ShowElapsedTotal () -------------------------]]-- local g_timer = { New = function () local obj = { s, result, status = true, Start = function ( ... ) local this = arg[1] this.status = false this.result = 0 this.s = os.clock () end, Stop = function ( ... ) local this = arg[1] this.status = true this.result = os.clock()-this.s end, IsStopped = function ( ... ) local this = arg[1] return this.status end, ShowElapsed = function ( ... ) local this = arg[1] print( string.format ( 'elapsed time: %.10f',os.clock()-this.s)) end, ShowElapsedTotal = function ( ... ) local this = arg[1] print( string.format ( 'Total elapsed time: %.10f sec',this.result)) end, } -- obj () -- return obj end, } -- g_timer {} -- --[[-------OBJECT------------- Description: convert binary string to decimal value 1. math.bin2dec = g_Bin2Dec.New () math.bin2dec:EnableSignedMagnitude (true) -- allow signed magnitude -- math.bin2dec:translate ( '1011','10111' ) math.bin2dec:show() 2. math.bin2dec = g_Bin2Dec.New () math.bin2dec:translate ( '1011','10111' ) result = math.bin2dec:getResult() 3. math.bin2dec = g_Bin2Dec.New () math.bin2dec:translate ( '1011','10111' ) result = math.bin2dec.result -------------------------]]-- local g_Bin2Dec = { New = function ( ... ) local obj = { result = {}, bSignedMagnitude = false, EnableSignedMagnitude = function ( ... ) local this = arg[1] this.bSignedMagnitude = arg[2] end, translate = function ( ... ) local function buildNUMBER ( ... ) local compile = { [true] = { [true] = { ['0'] = function ( ... ) local obj = arg[1] obj.result = obj.result + math.pow(2,obj.i) return obj end, ['1'] = function ( ... ) local obj = arg[1] return obj end, }, -- bFirst (true) -- [false] = { ['0'] = function ( ... ) local obj = arg[1] return obj end, ['1'] = function ( ... ) local obj = arg[1] obj.bFirst = true obj.result = obj.result + math.pow(2,obj.i) return obj end, }, -- bFirst (false) -- }, -- bSignedMagnitude (true) -- [false] = { [true] = { ['0'] = function ( ... ) local obj = arg[1] return obj end, ['1'] = function ( ... ) local obj = arg[1] obj.result = obj.result + math.pow(2,obj.i) return obj end, }, -- bFirst (true) -- [false] = { ['0'] = function ( ... ) local obj = arg[1] return obj end, ['1'] = function ( ... ) local obj = arg[1] obj.result = obj.result + math.pow(2,obj.i) return obj end, }, -- bFirst (false) -- }, -- bSignedMagnitude (false) -- } -- compile {} -- local function toBitStringArray ( ... ) local s = arg[1] local i = 0 local result = {} local N = #arg[1] -- strings are left-associative but bitfields have right-associative origins-- string.gsub( s,'[01]', function (n) result[N-i] = n i = i + 1 return n end ) -- gsub(s) -- return result end -- toBitStringArray () -- local function ALLPOSMAGNITUDE_BIT ( ... ) local that = arg[1] local s = arg[2] local obj = { result=0,bFirst=false,i=0 } local tmp = toBitStringArray(s) for i,j in ipairs(tmp) do obj.i = i-1 obj = compile[that.bSignedMagnitude][false][j](obj) end return obj.result end -- ALLPOSMAGNITUDE_BIT () -- local function SIGNEDMAGNITUDE_BIT ( ... ) local that = arg[1] local s = arg[2] local obj = { result=0,bFirst=false,i=0 } local tmp = toBitStringArray(s) for i,j in ipairs(tmp) do -- MSB holds sign bit (dont include in tally) -- obj.i = i-1 obj = compile[that.bSignedMagnitude][obj.bFirst][j](obj) -- print(obj.bFirst) end return qtest(that.bSignedMagnitude,-1,1)*obj.result end -- SIGNEDMAGNITUDE_BIT () -- local that = arg[1] local s = arg[2] local result = 0 string.gsub( s,'^[01]', -- match 0 or 1 at MSB -- function (n) result = qtest(n=='1',SIGNEDMAGNITUDE_BIT(that,s),ALLPOSMAGNITUDE_BIT(that,s)) return n end ) -- gsub(s) -- return result end -- buildNUMBER () -- local this = arg[1] local result = {} local N = #arg for i=2,N do -- dont include self -- result[i-1] = buildNUMBER(this,arg[i]) end -- loopf(i) -- this.result = result return result end, show = function ( ... ) local this = arg[1] print ( 'result = {' ) for i,j in ipairs(this.result) do print ( '['..i..']='..j..',' ) end -- loops(i,j) -- print ( '} result {} --' ) end, } -- obj {} -- return obj end, } -- g_Bin2Dec {} -- --[[-------OBJECT------------- Description: g_GlobalKey pruning utility 1. local keyLibrary = g_KeyPruner.New () keyLibrary.globalKey = g_GlobalKey keyLibrary:Prune () g_GlobalKey = keyLibrary.result 2. local keyLibrary = g_KeyPruner.New () keyLibrary.globalKey = g_GlobalKey keyLibrary.queryKey = tempKey keyLibrary:Prune () g_GlobalKey = keyLibrary.result 3. local keyLibrary = g_KeyPruner.New () keyLibrary.globalKey = g_GlobalKey keyLibrary.queryKey = tempKey keyLibrary:Prune () g_GlobalKey = keyLibrary:getResult () 4. local keyLibrary = g_KeyPruner.New () keyLibrary.globalKey = g_GlobalKey keyLibrary.queryKey = tempKey g_GlobalKey = keyLibrary:Prune () 5. local keyLibrary = g_KeyPruner.New () keyLibrary:Prune ( tempKey1,tempKey2,tempKey3 ) g_GlobalKey = keyLibrary.result 6. local keyLibrary = g_KeyPruner.New () keyLibrary:findIncidence ( tempKey1,tempKey2,tempKey3 ) g_GlobalKey = keyLibrary.globalKey incidenceResult = keyLibrary.result 7. local keyLibrary = g_KeyPruner.New () incidenceResult = keyLibrary:findIncidence ( tempKey1,tempKey2,tempKey3 ) g_GlobalKey = keyLibrary.globalKey 8. local keyLibrary = g_KeyPruner.New () keyLibrary:findIncidence ( tempKey1,tempKey2,tempKey3 ) g_GlobalKey = keyLibrary.globalKey incidenceResult = keyLibrary:getResult () 9. local keyLibrary = g_KeyPruner.New () keyLibrary.globalKey = g_GlobalKey keyLibrary:Prune () keyLibrary:serialize () -------------------------]]-- local g_KeyPruner = { New = function () local obj = { result = {}, queryKey = {}, globalKey = {}, Prune = function ( ... ) local function checkARGS ( ... ) local this = arg[1] if ( arg[2] and (this.globalKey == nil) ) then this.globalKey = arg[2] elseif ( arg[2] and this.globalKey ) then this.queryKey = arg[2] end return this end -- checkARGS () -- local function parseSUBCLASS ( ... ) -- compare subclass boundaries (minimize separation, ie variance) -- local this = arg[1] local tempSTR = arg[2] for str,cat in pairs (this.globalKey) do local idx = 1 string.gsub(str,'.',function (b) tempSTR[cat][idx] = qtest((b==tempSTR[cat][idx]),b,'-') idx = idx + 1 return b end) end return tempSTR end -- parseSUBCLASS () -- local function parseINTERCLASS ( ... ) -- compare class boundaries (maximize separation) -- local tempSTR = arg[1] for cat1,idx1 in pairs (tempSTR) do -- print ( 'cat1:'..cat1,'idx1:'..idx1[1] ) for cat2,idx2 in pairs (tempSTR) do -- print ( 'cat2:'..cat2,'idx2:'..idx2[1] ) if cat1 ~= cat2 then -- dont compare category with self (performance) -- for idx,str in ipairs (idx2) do tempSTR[cat1][idx] = qtest((tempSTR[cat1][idx]==tempSTR[cat2][idx]),'-',tempSTR[cat1][idx]) end else break -- performance -- end -- test(cat1,cat2) -- end -- loopf(cat1,cat2) -- end -- loopf(cat1,cat2) -- return tempSTR end -- parseINTERCLASS () -- local function generateCLASSLIBRARY ( ... ) local result = {} local tempSTR = arg[1] for cat,obj in pairs (tempSTR) do -- build a new, leaner globalKey -- local s = '' for idx,str in ipairs(obj) do s = s .. str end result[s] = cat end return result end -- generateCLASSLIBRARY () -- local this = checkARGS( arg[1],arg[2] ) local tempKEY = {} local tempSTR = {} tempSTR = this:generateTempSTR () tempSTR = parseSUBCLASS (this,tempSTR) --tempSTR = parseINTERCLASS (tempSTR) this.result = generateCLASSLIBRARY (tempSTR) this.globalKey = this.result return this.result end, findIncidence = function ( ... ) local function toStringArray ( ... ) local s = arg[1] local tempSTR = {} string.gsub( s,'.', function(b) tempSTR[#tempSTR+1] = b return b end ) -- Str(s) -- return tempSTR end -- toStringArray () -- local this = arg[1] local result = {} local N = #arg for k=2,N do -- loop through arg (dont include self) -- local tempSTR = toStringArray(arg[k]) result[k-1]={} for i,j in pairs (this.globalKey) do local idx = 1 local base = 0 local rval = 0 string.gsub( i,'.', -- search for all characters -- function (b) -- print('t:'..b,'q:'..tempSTR[idx]) rval = rval + qtest((b==tempSTR[idx]),1,0) base = base + qtest((b=='-'),0,1) idx = idx + 1 return b end ) -- Str(i) -- result[k-1][j] = rval / base end -- loop(i,j) -- end -- loop(arg) -- this.result = result return result end, generateTempSTR = function ( ... ) local this = arg[1] local tempSTR = {} for i,j in pairs (this.globalKey) do -- initialize tempSTR -- if (tempSTR[j] == nil) then -- commit 1st entry -- tempSTR[j] = {} string.gsub( i,'.', function(b) tempSTR[j][#tempSTR[j]+1] = b return b end ) -- Str(i) -- end -- test(tempSTR) -- end -- loop (i,j) -- return tempSTR end, getResult = function ( ... ) local this = arg[1] return this.result end, serialize = function ( ... ) local this = arg[1] local GK = this.globalKey local rval = this.result function toString ( ... ) local x = arg[1] local str='' if (type(x) == 'table') then str='{\n' for i,j in pairs(x) do -- print ( 'i:'..i,'j:'..j ) if ( type(i) == 'string') then i = '"'..tostring(i)..'"' end if(type(j) == 'number') then str = str..'['..i..']='..j..',\n' else str = str..'['..i..']='..toString(j)..',\n' end end -- loop (i,j) -- str=str..'}' return str elseif ( type(x) == 'string' ) then return '"'..tostring(x)..'"' end -- test (x) -- end -- toString () -- print ( 'g_KeyPruner.globalKey = {' ) for i,j in pairs(GK) do print ( '["'..tostring(i)..'"]="'..tostring(j)..'",' ) end print ( '} -- g_KeyPruner.globalKey {} --' ) print ( 'g_KeyPruner.result = {' ) for i,j in pairs(rval) do print ( '["'..tostring(i)..'"]='..toString(j)..',' ) end print ( '} -- g_KeyPruner.result {} --' ) end, -- serialize () -- } -- obj {} -- return obj end, -- New () -- } -- g_KeyPruner {} -- --[[-------OBJECT------------- Description: Lua-equivalent SELECT-statement 1. local code = { -- codebody -- [2] = 'First value!', [10] = function ( ... ) print ( 'Success!' ) return 1 -- must return a value! -- end, ['default'] = function ( ... ) -- *** required! *** -- return 0 end, } -- code -- local data = 10 local Statement = g_Select.New() Statement:Select (data,code) print(Statement.result) -------------------------]]-- local g_Select = { New = function () local obj = { result = '', Select = function ( ... ) local this = arg[1] local case = arg[2] local select = arg[3] local status = nil if(type(select[case]) == 'function' ) then local params = {} local N = #arg for i=4,N do -- pass params on to function; dont include self -- params [i-3] = arg[i] end status = select[case](params) else status = select[case] end if ( status ) then this.result = status else if(type(select['default']) == 'function') then this.result = select['default'] () else this.result = select['default'] end end return this.result end, -- Select () -- } -- obj {} -- return obj end, -- New () -- } -- g_Select {} -- --[[-------OBJECT------------- Description: Serialize an object 1. file = g_Serialize.New () file:serialize (obj) 2. file = g_Serialize.New () data = file:serialize (obj) 3. file = g_Serialize.New () file:serialize (obj) data = file:getResult () 4. file = g_Serialize.New () file:serialize ( obj,obj2,obj3 ) datum = file:getResult () -------------------------]]-- local g_Serialize = { New = function ( ... ) local obj = { result = {}, getResult = function ( ... ) local this = arg[1] return this.result end, serialize = function ( ... ) local this = arg[1] local datum = arg[2] local args = #arg local rhs = {} function toString ( ... ) local x = arg[1] local str='' if (type(x) == 'table') then str='{\n' for i,j in pairs(x) do if ( type(i) == 'string') then i = '"'..tostring(i)..'"' end if(type(j) == 'number') then str = str..'['..i..']='..j..',\n' else str = str..'['..i..']='..toString(j)..',\n' end end -- loop (i,j) -- str=str..'}' return str elseif ( type(x) == 'string' ) then return '"'..tostring(x)..'"' end -- test (x) -- end -- toString () -- for i=2,args do local j = i-1 rhs[j] = 'obj'..j..' = '..toString(arg[i]) print (rhs[j]) end this.result = rhs end, } -- obj {} -- return obj end -- } -- g_Serialize {} -- --[[-------OBJECT------------- Description: convert integer to unary string 1. math.unary = g_ToUnary.New () math.unary:toUnary ( int,int2,-int3 ) math.unary:showUnaryString () 2. math.unary = g_ToUnary.New () UnaryDigit_array = math.unary:toUnary ( int,int2,-int3 ) 3. math.unary = g_ToUnary.New () math.unary:toUnary ( int,int2,-int3 ) UnaryDigit_array = math.unary:getUnaryString () 4. math.unary = g_ToUnary.New () math.unary:toUnary ( int,int2,-int3 ) UnaryDigit_array = math.unary.result 5. math.unary = g_ToUnary.New () math.unary:setResolution ( 100 ) -- Set range between 1-100 math.unary:setZeroBit ( true ) -- w/Zerobit: (1-100) +1 math.unary:setSignBit ( true ) -- w/Zerobit+sign: (1-100) +1 +1 math.unary:toUnary ( int,int2,-int3 ) UnaryDigit_array = math.unary:getUnaryString () -------------------------]]-- local g_ToUnary = { New = function ( ... ) local obj = { result = {}, bUseSignBit = false, bUseZeroBit = false, unaryStringResolution = 7, toUnary = function ( ... ) local function buildUNARYSTRING ( ... ) local that = arg[1] local s = '' local j = math.abs(arg[2]) -- absval only! -- -- include 0 place-value for stability for i=qtest(that.bUseZeroBit,0,1),that.unaryStringResolution do s = qtest(i==j,'1','0') .. s end -- loopf(i) -- return s end local b_NEG = { [true] = { [true] = '1', -- indicate negative value -- [false] = '', }, [false] = { [true] = '0', -- indicate positive value -- [false] = '', }, } -- b_NEG {} -- local this = arg[1] for i=2,#arg do this.result[(i-1)] = b_NEG[(arg[i]<0)][this.bUseSignBit] .. buildUNARYSTRING ( this,arg[i] ) end -- loop(i) -- return this.result end, getUnaryString = function ( ... ) local this = arg[1] return this.result end, setZeroBit = function ( ... ) local this = arg[1] this.bUseZeroBit = arg[2] end, setSignBit = function ( ... ) local this = arg[1] this.bUseSignBit = arg[2] end, setResolution = function ( ... ) local this = arg[1] this.unaryStringResolution = arg[2] end, getResolution = function ( ... ) local this = arg[1] return this.unaryStringResolution end, showUnaryString = function ( ... ) local this = arg[1] local util = g_Serialize.New () util:serialize (this.result) end, } -- obj {} -- return obj end, } -- g_ToUnary {} -- --[[-------OBJECT------------- Description: convert integer to binary string 1. math.binary = g_ToBinary.New () math.binary:toBinary ( int,int2,-int3 ) math.binary:showBitString () 2. math.binary = g_ToBinary.New () binDigit_array = math.binary:toBinary ( int,int2,-int3 ) 3. math.binary = g_ToBinary.New () math.binary:toBinary ( int,int2,-int3 ) binDigit_array = math.binary:getBitString () 4. math.binary = g_ToBinary.New () math.binary:toBinary ( int,int2,-int3 ) binDigit_array = math.binary.bitstringResult 5. math.binary = g_ToBinary.New () math.binary:setResolution ( 32 ) -- cant be larger than 64 (bits), or user's largest supported system-wide configuration math.binary:toBinary ( int,int2,-int3 ) binDigit_array = math.binary:getBitString () -------------------------]]-- local g_ToBinary = { New = function ( ... ) local obj = { bitstringResult = {}, bitStringResolution = 32, toBinary = function ( ... ) local this = arg[1] local args = #arg local x64res = this.bitStringResolution local function padZero ( ... ) local n = arg [ 1 ] local neg = arg [ 2 ] local padnum = 32 - #arg [ 1 ] if x64res then padnum = x64res-#arg[1] elseif system.x86_64 then padnum = padnum + 32 -- 64bit platform (when available) -- end local padstr = '0' if neg then padstr = '1' end for i=1,padnum do n = padstr..n end return n end -- padZero () -- local function buildBITSTRING ( ... ) local str = '' -- iff value is positive, there should be a zero ('0') in the MSB local num = 0 local num_n = tonumber( arg [ 1 ] ) local bFirstFind = false local neg = false if num_n < 0 then neg = true end num = math.abs ( num_n ) while ( num >= 1 ) do local r = num if neg and bFirstFind then -- confirmed 2's complement -- if ( r%2 == 0 ) then str = '1'..str else str = '0'..str end else -- positive number (so far) -- if ( r%2 == 0 ) then str = '0'..str else str = '1'..str bFirstFind = true -- marked for 2's complement -- end end -- loopf -- local temp = r / 2 num = temp - temp%1 end -- loopf -- return padZero ( str,neg ) end -- buildBITSTRING () -- for i=2,args do this.bitstringResult[(i-1)] = buildBITSTRING ( arg[i] ) end -- loop(i) -- return this.bitstringResult end, -- math.toBinary () -- getBitString = function ( ... ) local this = arg[1] return this.bitstringResult end, setResolution = function ( ... ) local this = arg[1] local res = arg[2] if (system.x86_64 == false) and (res > 32) then print ( '*** Warning *** : max system supported bitstring resolution exceeded! : 32' ) print ( 'Reverting to max setting. ('..res..') - input parameter ignored.' ) this.bitStringResolution = 32 elseif (system.x86_64 == true) and (res > 64) then print ( '*** Warning *** : max system supported bitstring resolution exceeded! : 64' ) print ( 'Reverting to max setting. ('..res..') - input parameter ignored.' ) this.bitStringResolution = 64 else this.bitStringResolution = res end -- test(res) -- end, getResolution = function ( ... ) local this = arg[1] return this.bitStringResolution end, showBitString = function ( ... ) local this = arg[1] local util = g_Serialize.New () util:serialize (this.bitstringResult) end, } -- obj {} -- return obj end, } -- g_ToBinary {} -- local winningQSTAB = { ['sh'] = 1, -- shake -- ['ws'] = 2, -- wiggle sidechains -- ['wb'] = 3, -- wiggle backbone -- ['wa'] = 4, -- wiggle all -- ['ie'] = 5, -- idealize -- ['rb'] = 6, -- rebuild -- ['lw'] = 7, -- local wiggle all -- ['ls'] = 8, -- local wiggle sidechains -- ['lb'] = 9, -- local wiggle backbone -- ['np'] = 10, -- no operation (pass this iter to recipe) -- ['st'] = 11, -- current stage as next input parameter -- } -- winningQSTAB {} -- local g_winningQSTAB_len = 0 for i,j in pairs(winningQSTAB) do g_winningQSTAB_len = g_winningQSTAB_len + 1 -- keep a running length of winnningQSTAB object -- end -- loopf (i2) -- local winningQSTAB_by_name = {} for i,j in pairs(winningQSTAB) do winningQSTAB_by_name[j] = i -- populate with QSTAB names -- end local g_scoreParts = { New = function ( ... ) local obj = { g = "score" , c = "clashing" , p = "packing" , h = "hiding" , b = "bonding" , k = "backbone" , s = "sidechain", e = "ideality" , f = "reference", o = "other" , } return obj end, } local g_sp = { New = function ( ... ) local obj = g_scoreParts.New () local obj2 = g_scoreParts.New () for i,j in pairs (obj2) do -- add score placeholder for each scorepart -- obj[j] = 0 end -- loopf (obj2) -- return obj end, } -- g_sp {} -- local g_cf = { -- catalog of (available) boolean algebra characteristic functions -- [1] = 0, -- k-junta -- [2] = 0, -- Unanimous vote -- [3] = 0, -- voting tribe -- [4] = 0, -- n-dictators -- [5] = 0, -- n-negated-dictators -- [6] = 0, -- 2-constant -- [7] = 0, -- n-parity -- [8] = 0, -- weighted majority -- [9] = 0, -- linear threshold -- [10] = 0, -- d-depth majority of n -- [11] = 0, -- monotone -- [12] = 0, -- odd -- [13] = 0, -- n-symetric -- [14] = 0, -- unbiased -- [15] = 0, -- transitive symmetric -- [16] = 0, -- impartial-culture (independant + random + uniform dist.)-- [17] = 0, [18] = 0, [19] = 0, [20] = 0, } -- g_cf {} -- local g_scoreParts_index = { New = function ( ... ) local obj = { ["score"] = 1, ["clashing"] = 2, ["packing"] = 3, ["hiding"] = 4, ["bonding"] = 5, ["backbone"] = 6, ["sidechain"] = 7, ["ideality"] = 8, ["reference"] = 9, ["other"] = 10, } return obj end, } local g_scoreParts_name = { New = function ( ... ) local scoreParts_index = g_scoreParts_index.New () local obj = {} for i,j in pairs(scoreParts_index) do obj[j] = i end return obj end, } --[[-------OBJECT------------- Description: merge 2+ array of Numbers 1. wt = g_mergeARRAYS.New () wt:merge ( a1,a2,a3,a4 ) result = wt.rval 2. wt = g_mergeARRAYS.New () result = wt:merge ( a1,a2,a3,a4 ) 3. wt = g_mergeARRAYS.New () wt:merge ( a1,a2,a3,a4 ) result = wt:getResult () 4. wt = g_mergeARRAYS.New () wt:merge ( a1,a2,a3,a4 ) wt:show () -------------------------]]-- local g_mergeARRAYS = { New = function ( ... ) local obj = { rval = {}, merge = function ( ... ) local this = arg[1] local count = #arg local obj = arg[2] for i=3,count do local len = #obj local obj2 = arg[i] for j,k in ipairs (obj2) do obj[len+j] = k end end -- loopf (count) -- this.rval = obj return obj end, getResult = function ( ... ) local this = arg[1] return this.rval end, show = function ( ... ) local this = arg[1] local obj = this.rval for i,j in pairs (obj) do print(i,j) end -- loopf (obj) -- end, } -- obj {} -- return obj end, } --[[-------OBJECT------------- Description: add 2+ array of Numbers 1. wt = g_addARRAYS.New () wt:add ( a1,a2,a3,a4 ) result = wt.rval 2. wt = g_addARRAYS.New () result = wt:add ( a1,a2,a3,a4 ) 3. wt = g_addARRAYS.New () wt:add ( a1,a2,a3,a4 ) result = wt:getResult () 4. wt = g_addARRAYS.New () wt:add ( a1,a2,a3,a4 ) wt:show () -------------------------]]-- local g_addARRAYS = { New = function ( ... ) local obj = { rval = {}, add = function ( ... ) local this = arg[1] local x1 = arg[2] local args = #arg local sum = { ['number'] = { ['number'] = function ( ... ) local x1 = arg[1] local x2 = arg[2] return x1 + x2 end, ['table'] = function ( ... ) local x1 = arg[2] return x1 end, ['nil'] = function ( ... ) local x1 = arg[1] return x1 end, }, ['table'] = { ['number'] = function ( ... ) local x1 = arg[1] return x1 end, ['table'] = function ( ... ) local x1 = arg[1] local x2 = arg[2] local this = arg[3] local j2 = qtest((#x1>#x2),#x1,#x2) for j=1,j2 do x1[j] = this:add( x1[j],x2[j] ) end -- loop (j2) -- return x1 end, ['nil'] = function ( ... ) local x1 = arg[1] return x1 end, }, ['nil'] = { ['number'] = function ( ... ) local x1 = arg[2] return x1 end, ['table'] = function ( ... ) local x1 = arg[2] return x1 end, ['nil'] = function ( ... ) local x1 = arg[2] return x1 end, }, } -- status {} -- for i=3,args do local x2 = arg[i] local tx1 = type(x1) local tx2 = type(x2) x1 = sum [tx1][tx2]( x1,x2,this ) end -- loop (i) -- this.rval = x1 return x1 end, getResult = function ( ... ) local this = arg[1] return this.rval end, show = function ( ... ) local this = arg[1] function toString ( ... ) local _x = arg[1] local str='' if(_x) then str='{\n' for i,j in ipairs(_x) do if(type(j) == 'number') then str = str..'['..i..']='..j..',\n' else str = str..'['..i..']='..toString(j)..',\n' end end -- loop (i,j) -- str=str..'}' return str end -- test (_x) -- end -- toString () -- print ( toString(this.rval) ) end, } -- obj {} -- return obj end, } -- g_addARRAYS {} -- --[[-------OBJECT------------- Description: converts Number or Number string to array of digits (indexable) 1. local n=1020000054645629384729834729834792384793434 wt = g_weight.New () wt:quantize (n) -- Issues warning to user -- wt:show () 2. local n='1020000054645629384729834729834792384793434' wt = g_weight.New () wt:quantize (n) -- no warning issued -- wt:show () 3. local n='1020000054645629384729834729834792384793434' wt = g_weight.New () wt:quantize (n) result = wt.weight -------------------------]]-- local g_weight = { New = function ( ... ) local obj = { weight = {}, quantize = function ( ... ) local this = arg[1] local weight = {} local idx=1 local s = tostring(arg[2]) string.gsub(s,'%d',function(n) weight[idx]=tonumber(n) idx=idx+1 end ) if (idx>16 and (type(arg[2]) == 'number')) then print ( '*** Warning *** - object: g_weight - Maximum (16-digits) precision\nhas been exceeded; some round-off error will occur.' ) end -- test max_resolution -- this.weight = weight end, -- quantize () -- show = function ( ... ) local this = arg[1] for i,j in ipairs(this.weight) do print ( i,j ) end -- loopf (j) -- end, -- show () -- } -- obj {} -- return obj end, } -- g_weight {} -- local g_keyparts_archive = {} --[[-------OBJECT------------- Description: Calculate subscore fractions for subscore components 1. calc = g_SubscoreFraction.New () calc:calcSubscoreFraction (SubscoreArrayObj) calc:show () 2. calc = g_SubscoreFraction.New () scorepart_fractions = calc:calcSubscoreFractions (SubscoreArrayObj) 3. calc = g_SubscoreFraction.New () calc:calcSubscoreFractions (SubscoreArrayObj) scorepart_fractions = calc:getResult () 4. calc = g_SubscoreFraction.New () calc.result = SubscoreArrayObj calc:calcSubscoreFractions () scorepart_fractions = calc:getResult () 5. calc = g_SubscoreFraction.New () calc.result = SubscoreArrayObj calc:calcSubscoreFractions () scorepart_fractions = calc.result -------------------------]]-- local g_SubscoreFraction = { New = function ( ... ) local obj = { result = {}, calcSubscoreFractions = function ( ... ) local function validateARGS ( ... ) local this = arg[1] local rhs = {} if (arg[2] ~= nil) then rhs = arg[2] elseif (this.result ~= nil) then rhs = this.result else print ( 'error in g_SubscoreFraction.calcSubscoreFraction() object method: invalid or null input parameter.' ) print ( 'Unable to calculate subscore fractions. ' ) end -- test (arg[2]) -- return rhs end -- validateARGS () -- local function buildBASE ( ... ) local scoreparts = arg[1] local base = 0 if scoreparts[1] then -- are scoreparts indexed using integers ?? -- local k = #scoreparts for j=1,k do -- print (j,k) base = base + math.abs(math.ceil(scoreparts[j])) end -- loop (j,k) -- else -- or strings ?? -- local obj = g_scoreParts.New () for j,k in pairs (obj) do -- print (k,scoreparts[k]) base = base + math.abs(math.ceil(scoreparts[k])) end -- loop (j,k) -- end return base end -- buildBASE () -- local function buildFRACTIONS ( ... ) local base = arg[1] local scoreparts = arg[2] local scorepartFracs = {} if (scoreparts[1]) then -- are scoreparts indexed using integers ?? -- local k = #scoreparts for j=1,k do -- print (j,scoreparts[j],base) scorepartFracs[j] = math.ceil( (scoreparts[j]/base)*100 ) end -- loop (j,k) -- else -- or strings ?? -- local obj = g_scoreParts.New () for j,k in pairs (obj) do -- print (k,obj[k],base) scorepartFracs[k] = math.ceil( (scoreparts[k]/base)*100 ) end -- loop (j,k) -- end return scorepartFracs end -- buildFRACTIONS () -- local this = arg[1] local data = validateARGS ( arg[1],arg[2]) local scorepart_base = buildBASE ( data ) local result = buildFRACTIONS ( scorepart_base,data ) this.result = result return result end, getResult = function ( ... ) local this = arg[1] return this.result end, show = function ( ... ) local this = arg[1] local util = g_Serialize.New () util:serialize (this.result) end, } -- obj {} -- return obj end, } -- g_SubscoreFraction {} -- local g_parseGlobalExtremum = { New = function ( ... ) local obj = { parse = function ( ... ) local this = arg[1] -- points to _in[i] => obj -- local N = this:getMaxExtremumDEPTH () local temp = this.sps -- score-part (scores) (unsorted) -- local j =#this.sps -- amount of score-parts -- local name = this.spn -- score-part (names) -- local scoreParts_idx = g_scoreParts_index.New () table.sort ( temp ) -- sort( least(LSB)...greatest(MSB) ) -- for i=1,N do -- populate tables -- this.mostNEG [ i ] = scoreParts_idx [ name [ temp [ i ] ] ]-- name of Nth most NEG score-part -- this.mostPOS [ i ] = scoreParts_idx [ name [ temp [ j-i+1 ] ] ]-- name of Nth most POS score-part -- end -- loopf (N) -- end,-- parse () -- } -- obj {} -- return obj end, } -- g_parseGlobalExtremum {} -- local g_stackHistory = { New = function ( ... ) local obj = { addToQSTABStack = function( ... ) local this = arg[1] local rval = arg[2] if this.qstabHISTORY and #this.qstabHISTORY > 0 then this.qstabHISTORY [ #this.qstabHISTORY+1 ] = rval else this.targetQSTAB = rval this.qstabHISTORY [ 1 ] = rval end -- test (qstabHISTORY) -- end, pushToQSTABStack = function ( ... ) local this = arg[1] local rval = arg[2] local len = #this.qstabHISTORY local temp = { [1]=rval } local N = qtest ( (len+1<g_nOutputs),len+1,g_nOutputs ) for i=2, N do temp [ i ] = this.qstabHISTORY [ i-1 ] end -- loopf (N) -- this.qstabHISTORY = temp end, addToSubscoreStack = function( ... ) local this = arg[1] local rval = arg[2] if this.subscoreHISTORY and #this.subscoreHISTORY > 0 then this.subscoreHISTORY [ #this.subscoreHISTORY+1 ] = rval else this.subscoreHISTORY [ 1 ] = rval end -- test (subscoreHISTORY) -- end, pushToSubscoreStack = function ( ... ) local this = arg[1] local rval = arg[2] local len = #this.subscoreHISTORY local temp = { [1]=rval } local N = qtest ( (len+1<g_nOutputs),len+1,g_nOutputs ) for i=2, N do temp [ i ] = this.subscoreHISTORY [ i-1 ] end -- loopf (N) -- this.subscoreHISTORY = temp end, } -- obj {} -- return obj end, } -- g_stackHistory {} -- local g_buildKey = { New = function ( ... ) local obj = { subscoreFRACTION_bitRESOLUTION = 100, -- 100 (bits) can represent unary integer range [1,100] -- percentSUBSCOREGAIN_bitRESOLUTION = 100, -- 100 (bits) can represent unary integer range [1,100] -- buildKey_QSTAB = function ( ... ) local this = arg[1] local i2 = g_winningQSTAB_len local w = '' for i=1,i2 do w = w .. qtest ( (i==this.targetQSTAB),'1','0' ) end -- loopf (i) -- return w end, buildKey_mostPOS = function ( ... ) local this = arg[1] local i2 = #this.mostPOS local j2 = #this.sps local w = '' for i=1,i2 do for j=1,j2 do w = w .. qtest ( (j==this.mostPOS[i]),'1','0' ) end -- loop (j) -- end -- loopf (i) -- return w end, buildKey_mostNEG = function ( ... ) local this = arg[1] local i2 = #this.mostNEG local j2 = #this.sps local w = '' for i=1,i2 do for j=1,j2 do w = w .. qtest ( (j==this.mostNEG[i]),'1','0' ) end -- loop (j) -- end -- loopf (i) -- return w end, buildKey_qstabHISTORY = function ( ... ) local this = arg[1] local i2 = #this.qstabHISTORY local i3 = g_nOutputs local j2 = #this.sps local w = '' for i=1,i3 do local k = this.qstabHISTORY[i] for j=1,j2 do if (i<=i2) then w = w .. qtest ( (j==k),'1','0' ) else w = w .. '0' -- zero-fill -- end end -- loop (j) -- end -- loopf (i) -- return w end, buildKey_subscoreFRACTION = function ( ... ) local this = arg[1] local that = arg[2] local w = '' local result = {} local sps = that.sps local subscoreFRACTION = g_SubscoreFraction.New () result = subscoreFRACTION:calcSubscoreFractions ( sps ) math.unary = g_ToUnary.New () math.unary:setZeroBit ( true ) math.unary:setSignBit ( true ) math.unary:setResolution ( this.subscoreFRACTION_bitRESOLUTION ) local N = #result for i=1,N do w = w .. math.unary:toUnary ( result[i] ) [1] -- 1st index only; we dont need the entire object -- end -- loop (N) -- return w end, buildKey_percentSubscoreGAIN_HISTORY = function ( ... ) local this = arg[1] local that = arg[2] math.unary = g_ToUnary.New () math.unary:setZeroBit ( true ) math.unary:setSignBit ( true ) math.unary:setResolution ( this.percentSUBSCOREGAIN_bitRESOLUTION ) local null_unarystring = math.unary:toUnary ( 0 ) [1] local i2 = #that.subscoreHISTORY local i3 = g_nOutputs local w = '' for i=1,i3 do w = w .. qtest( (i<=i2), math.unary:toUnary ( that.subscoreHISTORY[i] ) [1], -- 1st index only; we dont need the entire object -- null_unarystring -- Zero-fill -- ) end -- loop (N) -- return w end, } -- obj {} -- return obj end, } -- g_buildKey {} -- local g_obj = { New = function ( ... ) local obj = { mostNEG = {}, mostPOS = {}, sps = {}, -- score-part (scores) -- spn = {}, -- score-part (names) -- ref = -1, -- table instance handle -- value = 0, -- 0 or 1 (incidence table value) -- weight = 0, -- percent (%) weight -- wt = 0, -- decimal (N) weight -- cf = 0, -- characteristic function from g_cf catalog (decimal index) -- groupID = 0, -- Tot. elements (cumulative, rep. as 2 ^ N decimal) -- element = {}, -- individual elements (rep. as sorted array) -- PrimaryKey = '', -- Use a 2,240-bit primaryKey for fast searches -- targetQSTAB = 0, qstabHISTORY = {}, -- most recent quick-stabilizers -- subscoreHISTORY = {}, -- most recent subscore gains (percent) -- maxExtremumDEPTH = g_maxExtremumDEPTH, -- set from global var -- generateQueryKey = function ( ... ) local this = arg[1] local key = g_buildKey.New () return { rval=key.buildKey_QSTAB ( this ), lval=key.buildKey_mostNEG ( this ) .. key:buildKey_subscoreFRACTION ( this ) .. key:buildKey_percentSubscoreGAIN_HISTORY ( this ) .. key.buildKey_qstabHISTORY ( this ), } end, generatePrimaryKey = function ( ... ) local this = arg[1] local result = this:generateQueryKey () this:updateGlobalKey ( result.rval, result.lval ) end, updateGlobalKey = function ( ... ) local this = arg[1] local rval = arg[2] local lval = arg[3] --g_GlobalKey [ this.PrimaryKey ] = nil -- erase current entry -- --g_GlobalKey [ this.PrimaryKey ] = rval -- add new entry (if not added already)-- this.PrimaryKey = lval local status = { ['string'] = { [true] = function ( ... ) print ( '*** Warning *** : PrimaryKey already exists!' ) print ( 'PrimaryKey:'..this.PrimaryKey ) print ( 'rval:'..rval ) print ( 'Ignoring..' ) end, [false] = function ( ... ) print ( '*** Fatal Warning *** : Possible PrimaryKey collision!' ) print ( 'PrimaryKey:'..this.PrimaryKey ) print ( 'New:'..rval..'; Existing:'..g_GlobalKey [ this.PrimaryKey ] ) print ( 'Developer may need to increase resolution' ) error ( 'No further information available.',2 ) end, }, ['nil'] = { [true] = function ( ... ) g_GlobalKey [ this.PrimaryKey ] = rval end, [false] = function ( ... ) g_GlobalKey [ this.PrimaryKey ] = rval end, }, } local key = type(g_GlobalKey [ this.PrimaryKey ]) local key2 = (g_GlobalKey [ this.PrimaryKey ] == rval) status[(key)][(key2)] () local keyLibrary = g_KeyPruner.New () keyLibrary.globalKey = g_GlobalKey g_GlobalKey = keyLibrary:Prune () end, getPrimaryKey = function ( ... ) local this = arg[1] return this.PrimaryKey end, setPrimaryKey = function ( ... ) local this = arg[1] this.PrimaryKey = arg[2] end, updateHebbianWeight = function ( ... ) local this = arg[1] local pattern = this:getPrimaryKey () local target = g_GlobalKey [ this:getPrimaryKey () ] local hw = { [1]={ [1]=0, }, } local i2 = 0 local j2 = 0 -- parse primary key -- string.gsub ( target,'[10]', function (m) i2 = i2 + 1 -- next row -- j2 = 1 -- reset column idx -- string.gsub ( pattern,'[10]', -- Search string for 0's or 1's -- function (n) m = tonumber(m) -- convert to integer -- n = tonumber(n) -- convert to integer -- hw[i2] = qtest (hw[i2]~=nil,hw[i2],{}) hw[i2][j2] = qtest (hw[i2][j2]~=nil,hw[i2][j2],-1) hw[i2][j2] = qtest (m>0,1,-1) * qtest (n>0,1,-1) -- calculate weights -- j2 = j2 + 1 -- next column -- return n end -- func (n) -- ) -- parse string (pattern) -- return m end -- func (m) -- ) -- parse string (target) -- j2 = qtest ( j2-1>0,j2-1,1 ) -- add hw to Hebbian weight -- local _weights = g_addARRAYS.New () g_Hebbianweight = _weights:add ( g_Hebbianweight,hw ) end, session_open = function ( ... ) local this = arg[1] end, session_close = function ( ... ) -- close Hebbian training session -- local this = arg[1] local that = arg[2] this:updateGlobalKey ( that.QueryKey.rval,that.QueryKey.lval ) -- update PrimaryKeys -- this:pushToQSTABStackHistory ( this.targetQSTAB ) -- preserve for the next session -- this:pushToSubscoreStackHISTORY ( this:getScorePartScores().sps ) -- preserve for the next session -- --this:updateHebbianWeight () -- update weights -- end, pushToQSTABStackHistory = function ( ... ) local this = arg[1] local len = #this.qstabHISTORY local stackHistory = g_stackHistory.New () if len > 0 then -- push to stack -- stackHistory.pushToQSTABStack ( arg[1],arg[2] ) else -- add to stack -- stackHistory.addToQSTABStack ( arg[1],arg[2] ) end -- test (len) -- end, pushToSubscoreStackHISTORY = function ( ... ) local function buildBASE ( ... ) local scoreparts = arg[1] local base = 0 if scoreparts[1] then -- are scoreparts indexed using integers ?? -- local k = #scoreparts for j=1,k do -- print (j,k) base = base + math.abs(math.ceil(scoreparts[j])) end -- loop (j,k) -- else -- or strings ?? -- local obj = g_scoreParts.New () for j,k in pairs (obj) do -- print (k,scoreparts[k]) base = base + math.abs(math.ceil(scoreparts[k])) end -- loop (j,k) -- end return base end -- buildBASE () -- local updateSTACK = { [true] = function ( ... ) -- push to stack -- local this = arg[1] local sfg = arg[2] local stackHistory = g_stackHistory.New () stackHistory.pushToSubscoreStack ( this,sfg ) end, [false] = function ( ... ) -- add to stack -- local this = arg[1] local sfg = arg[2] local stackHistory = g_stackHistory.New () stackHistory.addToSubscoreStack ( this,sfg ) end, } -- updateSTACK {} -- local this = arg[1] local old = buildBASE ( this.sps ) -- starting scorepart score -- local new = buildBASE ( arg[2] ) -- improved scorepart score -- local sfg = math.ceil( ( (new-old) / old ) * 100 ) -- scorepart fractional gain -- local len = #this.subscoreHISTORY updateSTACK[(len > 0)] ( this,sfg ) end, getMaxExtremumDEPTH = function ( ... ) local this = arg[1] return this.maxExtremumDEPTH end, setMaxExtremumDEPTH = function ( ... ) local this = arg[1] this.maxExtremumDEPTH = arg[2] end, updateScorePartScores = function ( ... ) -- sort score-part scores (and names) -- local this = arg[1] local result = this:getScorePartScores ( this ) local globalExtremum = g_parseGlobalExtremum.New () this.sps = result.sps this.spn = result.spn globalExtremum.parse (this) end, getScorePartScores = function ( ... ) -- sort score-part scores (and names) -- local this = arg[1] local n = this.ref local sp = g_sp.New () local _cs = current.GetSegmentEnergyScore local _gs = current.GetSegmentEnergySubscore local b_verbose = false local result = {} local k = structure.GetCount () for n = 1, k do sp [ sp.g ] = sp [ sp.g ] + _cs ( n ) sp [ sp.c ] = sp [ sp.c ] + _gs ( n,sp.c ) sp [ sp.p ] = sp [ sp.p ] + _gs ( n,sp.p ) sp [ sp.h ] = sp [ sp.h ] + _gs ( n,sp.h ) sp [ sp.b ] = sp [ sp.b ] + _gs ( n,sp.b ) sp [ sp.k ] = sp [ sp.k ] + _gs ( n,sp.k ) sp [ sp.s ] = sp [ sp.s ] + _gs ( n,sp.s ) sp [ sp.e ] = sp [ sp.e ] + _gs ( n,sp.e ) sp [ sp.o ] = sp [ sp.o ] + _gs ( n,sp.o ) sp [ sp.f ] = sp [ sp.f ] + _gs ( n,sp.f ) end -- loopf k -- if ( b_verbose == true ) then print ( n..' {' ) print ( " Score: " ..sp [ sp.g ]..',' ) print ( " Clashing: " ..sp [ sp.c ]..',' ) print ( " Packing: " ..sp [ sp.p ]..',' ) print ( " Hiding: " ..sp [ sp.h ]..',' ) print ( " Bonding: " ..sp [ sp.b ]..',' ) print ( " Backbone: " ..sp [ sp.k ]..',' ) print ( " Sidechain: "..sp [ sp.s ]..',' ) print ( " Ideality: " ..sp [ sp.e ]..',' ) print ( " Reference: "..sp [ sp.f ]..',' ) print ( " Other: " ..sp [ sp.o ]..',' ) print ( '} -- '..n..'--' ) end -- test (verbose) -- result.sps = { -- score_parts (scores) -- [1] = sp [ sp.g ], [2] = sp [ sp.c ], [3] = sp [ sp.p ], [4] = sp [ sp.h ], [5] = sp [ sp.b ], [6] = sp [ sp.k ], [7] = sp [ sp.s ], [8] = sp [ sp.e ], [9] = sp [ sp.o ], [10] = sp [ sp.f ], } result.spn = { -- score_parts (names)(inverse hash) -- [ sp [ sp.g ] ] = sp.g, [ sp [ sp.c ] ] = sp.c, [ sp [ sp.p ] ] = sp.p, [ sp [ sp.h ] ] = sp.h, [ sp [ sp.b ] ] = sp.b, [ sp [ sp.k ] ] = sp.k, [ sp [ sp.s ] ] = sp.s, [ sp [ sp.e ] ] = sp.e, [ sp [ sp.o ] ] = sp.o, [ sp [ sp.f ] ] = sp.f, } return result end, serialize = function ( ... ) local this = arg[1] --print ( this.ref..' {' ) print ( ' ref = '..this.ref..',' ) print ( ' value = '..this.value..',' ) print ( ' weight = '..this.weight..',' ) print ( ' wt = '..this.wt..',' ) print ( ' cf = '..this.cf..',' ) print ( ' groupID = '..this.groupID..',' ) print ( ' targetQSTAB = '..this.targetQSTAB..',' ) print ( ' PrimaryKey = '..this.PrimaryKey..',' ) print ( ' mostNEG = {' ) for i=1, #this.mostNEG do print ( ' ['..i..'] = '..this.mostNEG[i]..',' ) end -- loopf (mostNEG) -- print ( ' }, -- mostNEG_'..this.ref..' {} --' ) print ( ' mostPOS = {' ) for i=1, #this.mostPOS do print ( ' ['..i..'] = '..this.mostPOS[i]..',' ) end -- loopf (mostPOS) -- print ( ' }, -- mostPOS_'..this.ref..' {} --' ) print ( ' qstabHISTORY = {' ) for i=1, #this.qstabHISTORY do print ( ' ['..i..'] = '..this.qstabHISTORY[i]..',' ) end -- loopf (qstabHISTORY) -- print ( ' }, -- qstabHISTORY_'..this.ref..' {} --' ) print ( ' sps = {' ) for i=1, #this.sps do print ( ' ['..i..'] = '..this.sps[i]..',' ) end -- loopf (sps) -- print ( ' }, -- sps_'..this.ref..' {} --' ) print ( ' spn = {' ) for i,j in pairs(this.spn) do print ( ' ['..i..'] = "'..j..'",' ) end -- loopf (spn) -- print ( ' }, -- spn_'..this.ref..' {} --' ) print ( ' element = {' ) for i,j in pairs(this.element) do print ( ' ['..i..'] = '..j..',' ) end -- loopf (element) -- print ( ' }, -- element_'..this.ref..' {} --' ) --print ( '}, -- '..this.ref..' -- ' ) end, -- serialize () -- } -- obj {} -- return obj end, } -- g_obj {} -- local input = { instance = 0, res = 1, SetResolution = function ( ... ) local this = arg[1] this.res = arg[2] end, GetResolution = function ( ... ) local this = arg[1] return this.res end, New = function ( ... ) local this = arg[1] local N = arg[1].res local obj = {} this.instance = this.instance + 1 for i=1,N do obj[i] = g_obj.New () obj[i].ref = i -- instance handle and/or residue idx -- end return obj end, } -- input {} -- --[[-------OBJECT------------- Description: Pattern match tool -- initialize pattern object and inputs -- 1. input:SetResolution (g_nResolution) iPattern:SetResolution (g_nResolution) iPattern:SetCount (g_nOutputs) iPattern:initialize () 2a. iPattern._in [1].value = 1 iPattern._out[1] = 1, iPattern:locateIncidence () iPattern:Serialize () -- export weights -- 2b. iPattern:session_open () -- begin Hebbian learning session; load predicted weights -- -- [after work we determine we like shake..] -- iPattern:session_close ( winningQSTAB ['sh'] ) -- close Hebbian learning session; update class boundaries -- iPattern:Serialize () -- export weights -- -------------------------]]-- local iPattern = { _in = {}, _out = {}, weight = 0, count = 0, res = 1, QueryKey = 0x0, -- global key to perform searches -- qstabHISTORY = {}, initialize = function ( ... ) local this = arg[1] local M = this:GetCount () this._in = input:New () for i=1,M do this._out[i] = 0 end -- loopf M -- end, session_open = function ( ... ) -- open a training session -- local this = arg[1] local _in = this._in [1] _in:session_open () _in:updateScorePartScores () this.QueryKey = _in:generateQueryKey () local locatePrimaryKey = { ['string'] = { [true] = function ( ... ) local this = arg[1] print ( 'PrimaryKey found! Resolving..' ) print ( 'Guaranteed optimal stabilization: '..this.QueryKey.rval ) end, [false] = function ( ... ) -- print ('rval:'..this.QueryKey.lval,'lval:'..this.QueryKey.rval) print ( 'PrimaryKey found! Multiple possible optimal stabilizations found. Attempting to Resolve..' ) print ( 'Predicted optimal stabilization: '..this.QueryKey.rval ) --print ( 'Guaranteed optimal stabilization: '..g_GlobalKey[this.QueryKey.lval] ) end, }, ['nil'] = { [true] = function ( ... ) --[[ local this = arg[1] local rval = this.QueryKey.rval print ( 'No PrimaryKey found for existing target pattern:'..rval ) print ( 'Attempting to Resolve..' ) ]]-- end, [false] = function ( ... ) --[[ print ( 'No PrimaryKey found! No optimal stabilization found. Attempting to Resolve..' ) ]]-- end, }, } --local xtype = type(g_GlobalKey[this.QueryKey.lval]) --local xtype2 = (g_GlobalKey[this.QueryKey.lval] == this.QueryKey.rval) local keyLibrary = g_KeyPruner.New () keyLibrary.globalKey = g_GlobalKey local result = keyLibrary:findIncidence (this.QueryKey.lval) local idx local N = 0 local nval = { ['10000000000'] = ' -- "sh"', ['01000000000'] = ' -- "ws"', ['00100000000'] = ' -- "wb"', ['00010000000'] = ' -- "wa"', ['default'] = function () return ' -- "?"' end, } -- nval[] -- local Statement = g_Select.New () for i,j in pairs (result[1]) do print(i,j..Statement:Select(i,nval)) -- update status to screen -- if (j > N) then N = j idx = i elseif (j==N) then print( '*** Warning *** : possible primaryKey collision detected:'..i..' '..idx ) end -- test(j,N) -- end -- loopf(result) -- local xtype = (type(idx)) -- return status -- local xtype2 = true -- matching return value -- this.QueryKey.rval = idx locatePrimaryKey [(xtype)][(xtype2)] (this) end, session_close = function ( ... ) -- close the training session -- local this = arg[1] local key = g_buildKey.New () local _in = this._in [1] _in.targetQSTAB = arg[2] this.QueryKey.rval = key.buildKey_QSTAB (_in) local verifyPrimaryKey = { ['string'] = { [true] = function ( ... ) print ( 'PrimaryKey located for target pattern.' ) print ( 'No further processing required.' ) end, [false] = function ( ... ) local this = arg[1] local _key_ = this.QueryKey.lval local val = this.QueryKey.rval local _val_ = g_GlobalKey [ this.QueryKey.lval ] print ( '*** Fatal Warning *** : Possible PrimaryKey collision!' ) print ( 'PrimaryKey:'.._key_ ) print ( 'New:'..val..'; Existing:'.._val_ ) print ( 'Developer may need to increase resolution' ) --error ( 'No further information available.',2 ) end, }, ['nil'] = { [true] = function ( ... ) local this = arg[1] local _in = this._in [1] local lval = this.QueryKey.lval local rval = this.QueryKey.rval print ( 'PrimaryKey not found for existing target pattern: '..rval) print ( 'Creating new entry..' ) _in:session_close (this) end, [false] = function ( ... ) local this = arg[1] local _in = this._in [1] local lval = this.QueryKey.lval local rval = this.QueryKey.rval print ( 'PrimaryKey not found for target pattern: '..rval) print ( 'Creating new entry..' ) _in:session_close (this) end, }, } -- verifyPrimaryKey {} -- local xtype = type(g_GlobalKey[this.QueryKey.lval]) local xtype2 = (g_GlobalKey[this.QueryKey.lval] == this.QueryKey.rval) verifyPrimaryKey[(xtype)][(xtype2)] (this) end, generateQueryKey = function ( ... ) local this = arg[1] local _in = this._in [1] this.QueryKey = _in:generateQueryKey () -- Generate a QueryKey to judge against g_GlobalKey library PrimaryKeys -- end, getPrimaryKeyIndex = function ( ... ) local this = arg[1] local rval = arg[2] return g_GlobalKey [ rval ] end, hasKey = function ( ... ) local this = arg[1] local key = arg[2] local status = false if ( g_GlobalKey [ key ] ) then status = true end -- test (key) -- return status end, resetValues = function ( ... ) local this = arg[1] local _in = this._in local len = #arg - 1 -- dont include self -- if len > 0 then for i=2,len do _in[ arg[i] ].value = 0 end -- loopf (len) -- else -- Zero all -- local N = this:GetResolution () for i=1,N do _in[i].value = 0 end -- loopf N -- end -- test (len) -- end, hasIncidence = function ( ... ) local this = arg[1] local i = arg[2] local j = arg[3] local rval = false if this._in[i].value == 1 then rval = true end -- test ( i,j ) -- return rval end, rebase = function ( ... ) local this = arg[1] this.weight = this.weight + 1 end, incrWeight = function ( ... ) local this = arg[1] local _in = this._in [arg[2]] _in.wt = _in.wt + 1 -- rebase _in[i] -- _in.weight = _in.wt / this.weight -- weight can never grow greater than its present value -- end, decrWeight = function ( ... ) local this = arg[1] local _in = this._in [arg[2]] --_in.wt = _in.wt + 1 -- do not rebase _in[i], in order to reduce the impact of its value -- _in.weight = _in.wt / this.weight end, SetCount = function ( ... ) local this = arg[1] local cnt = arg[2] this.count = cnt end, GetCount = function ( ... ) local this = arg[1] if ( this.count < #this._out ) then -- Did we initialize the output history but not the count ?? -- this.count = #this._out end return this.count end, SetResolution = function ( ... ) local this = arg[1] local res = arg[2] this.res = res end, GetResolution = function ( ... ) local this = arg[1] return this.res end, locateIncidence = function ( ... ) -- for general training scenarios -- local this = arg[1] local j = arg[2] local N = this:GetResolution () this:rebase () -- increment the overall number of visits -- for i=1,N do if this:hasIncidence ( i ) then this:incrWeight ( i ) -- reward those whom have been visited -- else this:decrWeight ( i ) -- punish those whom have not been visited -- end -- test ( i,j ) -- end -- loopf (N) -- end, resetWeights = function ( ... ) local this = arg[1] local j = arg[2] local len = #arg - 1 -- dont include self -- local _in = this._in if len > 0 then for i=2,len do _in[ arg[i] ].weight = 0 end -- loopf (len) -- else -- Zero all -- local N = this:GetResolution () for i=1,N do _in[i].weight = 0 end -- loopf (N) -- end -- test (len) -- end, Serialize = function ( ... ) local this = arg[1] local N = this:GetResolution () local _in = this._in print ( 'local g_Hebbianweight = { [1]={ [1]=0, }, }' ) for i,obj in ipairs(g_Hebbianweight) do print ( ' g_Hebbianweight['..i..']= {}' ) for j,k in ipairs(obj) do print ( ' g_Hebbianweight['..i..']['..j..']='..k ) end -- loopf (obj) -- end -- loopf (g_Hebbianweight) -- print ( 'local g_GlobalKey = {' ) for i,j in pairs(g_GlobalKey) do print ( '["'..i..'"]="'..tostring(j)..'",' ) end print ( '} -- g_GlobalKey {} --' ) for j=1,N do print ( 'iPattern._in ['..j..'] = {' ) local _n = _in[j] _n.ref = j _n:serialize () print ( '} -- iPattern ['..j..'] --' ) end -- loopf j -- print ( '' ) print ( 'Contents successfully saved to "scriptlog.'..ui.GetTrackName ()..'.xml"' ) print ( 'To prevent permanent data-loss, please rename this file\nbefore re-running recipe.' ) end, } -- iPattern -- --[[-------OBJECT------------- Description: Adaptive Cellular Neural Network (deprecated) 1. local stage_1 = ACNN:New () stage_1.lhs:deserialize ( file ) stage_1.rhs:deserialize ( file ) stage_1:invalidate () print ( stage_1.rhs.length ) print ( stage_1.lhs.length ) stage_1.lhs:serialize () stage_1.rhs:serialize () 2. local stage_1 = ACNN:New () stage_1:deserialize ( file ) stage_1:invalidate () print ( stage_1.rhs.length ) print ( stage_1.lhs.length ) stage_1:serialize () -------------------------]]-- local ACNN = { -- Adaptive Cellular Neural Network (deprecated) -- ref = 1, New = function ( ... ) local this = arg [ 1 ] local obj = { ref = this.ref, lhs = { length = 0, serialize = function ( ... ) local this = arg [ 1 ] local length = arg [ 1 ].length local str = 'lhs = {' for i = 1,length do str = str .. '['..i..']='..this[i]..',' end str = str .. '}, -- lhs -- ' print ( str ) end, deserialize = function ( ... ) local this = arg [ 1 ] local file = arg [ 2 ] local function parseLHS ( ... ) local function parseWEIGHTS ( ... ) local this = arg [ 1 ] local file = arg [ 2 ] string.gsub ( file, '%[%s*(%d+)%s*%]%s*=([^,={}]+)', -- search file, using ipairs-like format -- function ( ... ) local x = arg[1] local y = arg[2] this[tonumber(x)] = tonumber(y) return x,y end ) -- func -- return this end -- parseWEIGHTS -- local this = arg [ 1 ] local file = arg [ 2 ] local tmp = nil string.gsub (file, 'lhs%s*=%s*%b{}',function (v) tmp = v return v end) -- parse through file objects, using ipairs-like format. if tmp then this = parseWEIGHTS ( this,tmp ) end return this end -- parseLHS -- this = parseLHS ( this,file ) return true end, }, -- lhs {} -- rhs = { length = 0, serialize = function ( ... ) local this = arg [ 1 ] local length = arg [ 1 ].length local str = 'rhs = {' for i = 1,length do str = str.. '['..i..']='..this[i]..',' end str = str .. '}, -- rhs -- ' print ( str ) return true end, deserialize = function ( ... ) local this = arg [ 1 ] local file = arg [ 2 ] local function parseRHS ( ... ) local function parseWEIGHTS ( ... ) local this = arg [ 1 ] local file = arg [ 2 ] string.gsub ( file, '%[%s*(%d+)%s*%]%s*=([^,={}]+)', -- parse file, using ipairs-like format -- function ( ... ) local x = arg[1] local y = arg[2] this[tonumber(x)] = tonumber(y) return x,y end ) -- func -- return this end -- parseWEIGHTS -- local this = arg [ 1 ] local file = arg [ 2 ] local tmp = nil string.gsub (file, 'rhs%s*=%s*%b{}',function (v) tmp = v return v end) -- parse through file objects, using ipairs-like format -- if tmp then this = parseWEIGHTS ( this,tmp ) end return this end -- parseRHS -- this = parseRHS ( this,file ) return true end, }, -- rhs {} -- invalidate = function ( ... ) local this = arg [ 1 ] this.rhs.length = #this.lhs-2 -- dont include self (array indices only) -- this.lhs.length = #this.rhs-2 -- dont include self (array indices only) -- end, serialize = function ( ... ) local this = arg [ 1 ] print ( '\n'..this.ref..' {' ) this.rhs:serialize () this.lhs:serialize () print ( '} -- '..this.ref..' -- ' ) return true end, deserialize = function ( ... ) local this = arg [ 1 ] local refn = arg [ 1 ].ref local file = arg [ 2 ] local rval = false local function parseOBJ ( ... ) local rval = false local refn = arg [ 1 ] local file = arg [ 2 ] local tmp = nil string.gsub (file, refn..'%s*%b{}',function (v) tmp = v return v end) if tmp then rval = tmp end -- test (tmp) -- return rval end -- func -- file = parseOBJ ( refn,file ) if ( file ) then this.rhs:deserialize ( file ) this.lhs:deserialize ( file ) this:invalidate () -- invalidate previous,update to current -- rval = true end -- test (file) -- return rval end, } -- obj {} -- this.ref = this.ref+1 return obj end, } -- DRAMCN (Dynamic Random Adaptive Cellular Network) -- -- Score threshold used by quickshake() (Make value READ-ONLY) local function threshold () return g_thresh end -- threshold () -- -- Shake only if current score is within threshold of best score local function quickshake ( r,score ) band.DisableAll () if score > r.score*r.within_range then structure.ShakeSidechainsAll ( 1 ) end -- test (score) -- if ( r.bands_enabled == true ) then band.EnableAll () end -- test (band) -- end -- quickshake () -- local function QuickShake ( iters ) local _gses = current.GetSegmentEnergySubscore local QSThresh = 1 selection.DeselectAll () repeat for i=g_idx,g_idx2 do local ci = _gses ( i,'clashing' ) if ci < _gses ( i,'hiding' ) and ci < _gses ( i,'packing' ) and ci < _gses ( i,'ideality' ) and ci < _gses ( i,'sidechain') and ci < _gses ( i,'bonding' ) and ci < _gses ( i,'other' ) and ci < _gses ( i,'reference') then selection.Select ( i ) end -- test ci -- end -- loop -- local css = current.GetScore () if selection.GetCount () then structure.ShakeSidechainsSelected ( iters ) selection.DeselectAll () end -- test -- until current.GetScore () - css < QSThresh -- loopf -- end structure.QuickShake = QuickShake --[[ INSERT YOUR RECIPE CODE BELOW ]]-- local function call_YourRecipe ( ... ) local iters = arg[1] local r = arg[2] recentbest.Restore () return 0 -- return 1 (or true) to continue MVANN -- end -- call_YourRecipe () -- --[[ INSERT YOUR RECIPE CODE ABOVE ]]-- local stabilizers = { New = function () local obj = { [1] = function ( ... ) -- shake -- local iters = arg [ 1 ] local ShakeSidechains = structure.ShakeSidechainsAll repeat local cs = current.GetScore () ShakeSidechains ( iters ) until current.GetScore () - cs < g_minPPI structure.ShakeSidechainsAll = ShakeSidechains end, [2] = function ( ... ) -- wiggle sidechains -- local iters = arg [ 1 ] local WiggleSidechains = structure.WiggleAll WiggleSidechains ( iters,false,true ) structure.WiggleAll = WiggleSidechains end, [3] = function ( ... ) -- wiggle backbone -- local iters = arg [ 1 ] local WiggleBackbone = structure.WiggleAll repeat local cs = current.GetScore () WiggleBackbone ( iters * g_wiggle_mult,true,false ) until current.GetScore () - cs < g_minPPI structure.WiggleAll = WiggleBackbone end, [4] = function ( ... ) -- wiggle all -- local iters = arg [ 1 ] local WiggleAll = structure.WiggleAll repeat local cs = current.GetScore () WiggleAll ( iters * g_wiggle_mult ) until current.GetScore () - cs < g_minPPI structure.WiggleAll = WiggleAll end, [5] = function ( ... ) -- idealize -- local iters = arg [ 1 ] local IdealizeSelected = structure.IdealizeSelected IdealizeSelected () structure.IdealizeSelected = IdealizeSelected end, [6] = function ( ... ) -- rebuild -- local iters = arg [ 1 ] local RebuildSelected = structure.RebuildSelected RebuildSelected ( iters ) structure.RebuildSelected = RebuildSelected end, [7] = function ( ... ) -- local wiggle all -- local iters = arg [ 1 ] local LocalWiggleAll = structure.LocalWiggleAll LocalWiggleAll ( iters ) structure.LocalWiggleAll = LocalWiggleAll end, [8] = function ( ... ) -- local wiggle sidechains -- local iters = arg [ 1 ] local LocalWiggleSidechains = structure.LocalWiggleSelected LocalWiggleSidechains ( iters,false,true ) structure.LocalWiggleSelected = LocalWiggleSidechains end, [9] = function ( ... ) -- local wiggle backbone -- local iters = arg [ 1 ] local LocalWiggleBackbone = structure.LocalWiggleSelected LocalWiggleBackbone ( iters,true,false ) structure.LocalWiggleSelected = LocalWiggleBackbone end, [10] = function ( ... ) -- no operation (pass this round to recipe) -- local iters = arg [ 1 ] local r = arg [ 2 ] -- access to r object -- --[[ INSERT RECIPE FUNCTION CALL BELOW ]]-- local rval = call_YourRecipe ( iters,r ) --[[ INSERT RECIPE FUNCTION CALL ABOVE ]]-- return rval end, [11] = function ( ... ) -- current stage as next stage input parameter -- local iters = arg [ 1 ] end, } -- obj -- return obj end, } -- stabilizers {} -- -- try / save best stabilization ops -- local g_try_stage = { New = function ( ... ) local obj = function ( ... ) local this = arg[1] local stage = arg[2] local lval = arg[3] local b local gn = '' local mode = '' local temp = this.r.temp local a = this.r.score local idx = this.r.idx local idx2 = this.r.idx2 local iter = this.r.iter local bands_enabled = this.r.bands_enabled local within_range = this.r.score * this.r.within_range local qstab = stabilizers.New () save.Quickload ( this.r.temp ) mode = stage local rval = qstab [ stage ] ( 1,lval ) b = current.GetScore () if b > a then -- Save QS1 (Template) -- save best scoring attributes this.r.gain = b - a this.r.mode = mode this.r.score = b -- save best template -- save.Quicksave ( this.r.qslot ) gn = "+" end -- test (a) -- print ( "Score: "..b.." | mode: "..winningQSTAB_by_name[mode].." | QS"..temp..gn ) return rval end -- obj () -- return obj end, -- New () -- } -- g_try_stage {} -- local g_stabilize = { New = function ( ... ) local obj = { r = {}, try_stage = g_try_stage.New (), try_stage_sh = function ( ... ) local this = arg[1] this:try_stage ( winningQSTAB ['sh'] ) end, try_stage_ws = function ( ... ) local this = arg[1] this:try_stage ( winningQSTAB ['ws'] ) end, try_stage_wb = function ( ... ) local this = arg[1] this:try_stage ( winningQSTAB ['wb'] ) end, try_stage_wa = function ( ... ) local this = arg[1] this:try_stage ( winningQSTAB ['wa'] ) end, try_stage_ie = function ( ... ) local this = arg[1] this:try_stage ( winningQSTAB ['ie'] ) end, try_stage_rb = function ( ... ) local this = arg[1] this:try_stage ( winningQSTAB ['rb'] ) end, try_stage_lw = function ( ... ) local this = arg[1] this:try_stage ( winningQSTAB ['lw'] ) end, try_stage_ls = function ( ... ) local this = arg[1] this:try_stage ( winningQSTAB ['ls'] ) end, try_stage_lb = function ( ... ) local this = arg[1] this:try_stage ( winningQSTAB ['lb'] ) end, try_stage_np = function ( ... ) local this = arg[1] local rval = this:try_stage ( winningQSTAB ['np'],arg[2] ) return rval end, try_stage_st = function ( ... ) local this = arg[1] this:try_stage ( winningQSTAB ['st'] ) end, } -- obj {} -- return obj end, } -- g_stabilize {} -- local function compile_score_parts ( seg_score,b_verbose ) local sp = g_sp.New () if ( seg_score == nil ) then seg_score = g_sp.New () end -- test (seg_score) -- local _cs = current.GetSegmentEnergyScore local _gs = current.GetSegmentEnergySubscore local k = structure.GetCount () for n = 1, k do sp [ sp.g ] = sp [ sp.g ] + _cs ( n ) sp [ sp.c ] = sp [ sp.c ] + _gs ( n,sp.c ) sp [ sp.p ] = sp [ sp.p ] + _gs ( n,sp.p ) sp [ sp.h ] = sp [ sp.h ] + _gs ( n,sp.h ) sp [ sp.b ] = sp [ sp.b ] + _gs ( n,sp.b ) sp [ sp.k ] = sp [ sp.k ] + _gs ( n,sp.k ) sp [ sp.s ] = sp [ sp.s ] + _gs ( n,sp.s ) sp [ sp.e ] = sp [ sp.e ] + _gs ( n,sp.e ) sp [ sp.o ] = sp [ sp.o ] + _gs ( n,sp.o ) sp [ sp.f ] = sp [ sp.f ] + _gs ( n,sp.f ) end -- loopf k -- if ( b_verbose == true ) then print ( '{' ) print ( " Score: " ..seg_score [ seg_score.g ] ) print ( " Clashing: " ..seg_score [ seg_score.c ] ) print ( " Packing: " ..seg_score [ seg_score.p ] ) print ( " Hiding: " ..seg_score [ seg_score.h ] ) print ( " Bonding: " ..seg_score [ seg_score.b ] ) print ( " Backbone: " ..seg_score [ seg_score.k ] ) print ( " Sidechain: "..seg_score [ seg_score.s ] ) print ( " Ideality: " ..seg_score [ seg_score.e ] ) print ( " Other: " ..seg_score [ seg_score.o ] ) print ( " Reference: "..seg_score [ seg_score.f ] ) print ( '}' ) end -- test (verbose) -- return sp end -- compile_core_parts -- local function saveBest (r) save.Quicksave ( r.temp ) save.Quicksave ( r.qslot ) --recentbest.Save () end -- saveBest () -- local function restoreBest (r) --save.Quickload ( r.temp ) recentbest.Restore () end -- restoreBest () -- -- initialize ipattern + inputs -- input:SetResolution (g_nResolution) iPattern:SetResolution (g_nResolution) iPattern:SetCount (g_nOutputs) iPattern:initialize () local function MVANN_Stabilize ( ... ) -- Majority Vote, Adaptive Neural Network (stabilizer module) local s local s1 local s2 local s3 local gain local sash local score local seg_score = compile_score_parts () -- build score parts -- local template = current.GetScore () local saveslot = g_saveslot local verbose = g_verbose local temp = g_tempslot local idx = g_idx local idx2 = g_idx2 local stabilize = g_stabilize.New () -- import stabilize library -- selection.SelectAll () save.Quicksave ( saveslot ) -- current best -- save.Quicksave ( temp ) -- working saveslot -- --recentbest.Save () s = current.GetScore () print ( "MVANN Quick-Stabilize recipe "..g_version ) print ( 'Author: Seagat2011 2015 ( http://fold.it/port/user/1992490 )' ) print ( 'Group: Anthropic Dreams - ref: '..puzzle.GetPuzzleID ()..puzzle.GetExpirationTime () ) local r = { sp = g_sp, -- score_part temp = temp, -- Start at QS2 iter = 1, -- s/ws for [iter] iterations score = s, -- current high score qslot = saveslot, -- qslot of high score idx = idx, -- start index idx2 = idx2, -- end index gain = gain, -- gain ( score - base_score ) sash = sash, -- score after shake ( equals template, when in stage 3 ) base_score = s, -- base score ( invariant ) bands_enabled = false, -- iff (bands_enabled == true ) then band_disable before shake () template = template, -- starting score in QSlot within_range = threshold(),-- perform shake iff [within_range] percent of high score mode = 0, -- No default } -- end table r{} -- local nval = { ['10000000000'] = 1, -- 'sh' ['01000000000'] = 2, -- 'ws' ['00100000000'] = 3, -- 'wb' ['00010000000'] = 4, -- 'wa' ['default'] = 0, } -- nval[] -- local Statement = g_Select.New () while(1) do print ( 'Starting score = '..r.score ) s = r.score r.gain = 0 r.base_score = r.score saveBest (r) --[[ do -- define local scope -- local rval = stabilize:try_stage_np (r) -- NO OP; default to User-specified recipe -- if ((rval == 0) or (rval==nil) or (rval==false)) then break end end ]]-- iPattern:session_open () -- begin learning session; load predicted weights -- stabilize.r = r stabilize:try_stage( nval[ iPattern.QueryKey.rval ] ) r = stabilize.r if ( r.score-s > g_minNPGAIN ) then print ( 'Further improvement found..' ) print ( "Score: "..r.score.." | mode: "..winningQSTAB_by_name[r.mode].." | QS"..r.temp ) print ( "Gain: "..r.score.." +"..r.score - s ) nval.default = r.mode if (r.mode~=Statement:Select (iPattern.QueryKey.rval,nval)) then --iPattern:session_close ( r.mode ) -- close learning session; update class boundaries -- end else -- default to user -- local rval = stabilize:try_stage_np (r) -- NO OP; default to User-specified recipe -- if ((rval == 0) or (rval==nil) or (rval==false)) then break end end -- test s -- end -- loop forever -- end -- MVANN_Stabilize () -- local function cleanup () recentbest.Restore () print ( 'Done.' ) end xpcall ( MVANN_Stabilize,cleanup )

Comments


Seagat2011 Lv 1


Above is an idealized architecture of the MVANN.
It may not appear obvious, but each characteristic function (B-F) is incorporated into a stabilizer ( wa,ws,sh etc. ),
and so doesn't really need to be shown. But they are shown explicitly for clarity and to demonstrate
that they in fact determine the 'character' of a stabilizer. A stabilizer's character is what remains when its largest possible modularity, or mod N
is found and (set-wise logically) subtracted from it. The residue that remains is called its prime, it is mod N irreducible, and thus becomes the character of the stabilizer.
Each scorepart above is mapped into a characteristic function which attempts to modularly describe it, and capture this attribute into a set, or class:

The issue then becomes which characteristic functions accurately describe and maps to a class. This can be accomplished without trial-and-err.
(See my proof of P=NP using Merlin/Arthur Ontology matching)

QueryKey = B* + C + D + E + F

PrimaryKey = F3 = A (qstabTARGET) = hardlim(a2) ((recurrent: feedback)

length(PrimaryKey) = length(QueryKey) = length(B* + C + D + E + F) = 2,240 bits

  • = optional

NEURON OUTPUTS
F1 = purelin(a1)
F2 = hardlim(a2)
F3 = satlins(a3)
F4 = purelin(a4)
F5 = purelin(a5)
F6 = compet(a6)

NEURON WEIGHTS
F1:Wt = Unit Matrix (I)
F2:Wt = PrimaryKey = F3 = satlins(a3) (recurrent: feedback)
F3:Wt = F2 = hardlim(a2)
F4:Wt = PrimaryKey = F3 = satlins(a3) (recurrent: feedforward)
F5:Wt = PrimaryKey = F3 = satlins(a3) (recurrent: feedforward)
F6:Wt = F5 = purelin(a5)

NEURON INPUTS
R1 = QueryKey
R2 = QueryKey
R3 = QueryKey
R4 = QueryKey
R5 = PrimaryKey = F3 = satlins(a3) (recurrent: feedforward)
R6 = F4 = purelin(a4)

Each combinatoric stabilizer is informally described using a 2240-2-1-1 neural network, shown above. (see transfer functions F1-F6)
The characteristic functions (A-F) are not shown, but they in fact feed into the inputs of F1, F2, F3, and F4 (as R1, R2, R3, and R4, respectively).

Neuron F1 performs a basic load-register operation and is essentially a standby neuron. It is not used.

F2 is a masking neuron. It takes as input a QueryKey and then masks it's weight F2:Wt against it, surpressing to zero (0) any non matching bit fields.
This is done by our choice of F2's hardlim transfer function, which sends any non matching (-1 valued) fields to 0.
The resultant weight is then fed forward into F3:Wt. (as a PrimaryKey)
A unique attribute of F2 is it receives its returning operational weight vector from F3, in the form of a returning PrimaryKey, via recurrent feedback.

F3 is most critical as a masking neuron; it masks (or suppresses to 0) any
non-matching bits between the weight and the input pattern, in essence generating a wildcard of
dont-cares between the two fields, while multiplying back in any incidental bit patterns.

Neuron F4 calculates a compact QueryKey value (or dot product) by summing itself against its known PrimaryKey, distilled in F4:Wt.

F5 behaves a little differently: it calculates an ideal compact PrimaryKey (as if its a QueryKey), by summing each column vector with itself, generating the Unit Matrix (I).

So why do this? The idea is to gather a ratio of correctness. By later dividing the actual key by the ideal key, it
makes for easier managing and evaulation of the output because the output is guaranteed not to be larger than 1 (ie 1.00 = 100% = match).
Hence the choice of F4,F5 purelin transfer functions – because we want the outputs to be completely linear (untouched).
I emlpoy this method rather than analysis of magnitudes: because although more entries means potentially more matches,
and a greater number of hits, it may not be a true indicator of correctness. (See my pruning algorithm used for PrimaryKeys in recipe)
Also, dividing the actual key by the ideal
also puts the forward layer output (F6) into saturation, which makes for easier managing and evaluation of the output because the result
is guaranteed not to be larger than 1 (1.00 = 100%).
All outputs then sum to an external final competitive neurode (F6) which, among all available stabilizers, chooses a winner. (choosing the stabilizer whose output is closest to 1.00)
In the event of a tie, the first matching input wins.
The winner is then fed back into the combinatoric model into one of the mapping functions (characteristic function F:qstabHISTORY; which is fed into R1,R2,R3 and R4, remember)
So what is the combined purpose of F1,F2,F3 neurons?
F1,F2,F3, are training-neurons used to generate (and train the stabilizer to recognize) PrimaryKeys. Their recurrent layers are re-activated many times during the process.
Whereas neurons F4,F5,F6 are evaluation neurons
which score a global QueryKey against a particluar stabilizer's PrimaryKey. During initial training, F3 is initialized as an empty register (its Wt is set to all 1's),
and it quickly proceeds to perform masking upon receiving varying non matching inputs during its later training and evaluation stages.

This is the essence and operation of MVANN.

The next generation MVANN will be modeled internally as the following,

.. as a cascade of 2,240, 1-bit neural networks. Which I've termed the ST12-DARPA-68 model.
Named after the 1969 Bell Labs Networks, which used inverting amplifiers to implement switchable Neural Networks.[Hag95]
Training and evaluation will be performed within a completely parallel architecture, for complete modularity and scalability.
Inputs will be fed forward at all stages, for complete quantum reversability.
The governing equation (F) for each neuron will be a lookup table or truth table, as opposed to a standard transfer function – which,
when not continually differentiable, can not easily be derived by a machine.
Only Z and ~Z need be assigned within the truth table for it to map correctly, but all elements of the truth table will be machine-reassignable.
Any neuron weights can be pre-loaded by observing a Z-parameter.
The dot product, when needed, is calculated outside of the network, allowing for further off-loading and optimization.
if a weight bias is needed, one may only need modify the neuron's truth table.

Here are my current areas of research

What is directed entropy ?
How is directed-entropy effected by black holes ?
What is the worst-case lower-bound on the amount time required to evaluate any addition operation ?
What is the worst-case lower-bound on the amount time required to evaluate any DNF boolean operation ?
Are these lower bounds correlatable ?
How are proteins comparable to neural networks ?
How are black holes comparable to neural networks ? (are event-horizons == NeuralNet-summing nodes?)
How are neural networks comparable to ALUs ? (Are Wts == registers ?)
How are ALUs like function-generators ?
Are there parallel approximations available for all linear combinations of neural networks ?

Seagat2011

REFERENCES

[Hag95] Martin T. Hagan, Howard B. Demuth, Mark Beale, "Neural Network Design", pp 18.2-18.3, 1995

Many of the breakthroughs in the area of Neural Networks came about after the 1960's as a result of Dr. Hopfield, The Hopfield Model, and his networks.
John Hopfield was a Cal. Tech. Physicist whom addressed the implementation issues involved
with VLSI chip design for content-addressable memories, as well as optical implementations.

Bruno Kestemont Lv 1

I tried and it finished very soon without results. Are you sure the script has no bug?
it seems powerfull and i would like to be sure the script is ok.

Seagat2011 Lv 1

Recipe is a tool hopefully for hand-folders, to be used repeatedly as you fold. With this recipe you cannot just run it and walk away.