// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Large {
    import Std.Intrinsic.*;
    import Std.Measurement.*;

    operation ThousandQubitsParityX(qs : Qubit[]) : Result {
        mutable res = Zero;
        within {
            H(qs[0]);
            H(qs[1]);
            H(qs[2]);
            H(qs[3]);
            H(qs[4]);
            H(qs[5]);
            H(qs[6]);
            H(qs[7]);
            H(qs[8]);
            H(qs[9]);
            H(qs[10]);
            H(qs[11]);
            H(qs[12]);
            H(qs[13]);
            H(qs[14]);
            H(qs[15]);
            H(qs[16]);
            H(qs[17]);
            H(qs[18]);
            H(qs[19]);
            H(qs[20]);
            H(qs[21]);
            H(qs[22]);
            H(qs[23]);
            H(qs[24]);
            H(qs[25]);
            H(qs[26]);
            H(qs[27]);
            H(qs[28]);
            H(qs[29]);
            H(qs[30]);
            H(qs[31]);
            H(qs[32]);
            H(qs[33]);
            H(qs[34]);
            H(qs[35]);
            H(qs[36]);
            H(qs[37]);
            H(qs[38]);
            H(qs[39]);
            H(qs[40]);
            H(qs[41]);
            H(qs[42]);
            H(qs[43]);
            H(qs[44]);
            H(qs[45]);
            H(qs[46]);
            H(qs[47]);
            H(qs[48]);
            H(qs[49]);
            H(qs[50]);
            H(qs[51]);
            H(qs[52]);
            H(qs[53]);
            H(qs[54]);
            H(qs[55]);
            H(qs[56]);
            H(qs[57]);
            H(qs[58]);
            H(qs[59]);
            H(qs[60]);
            H(qs[61]);
            H(qs[62]);
            H(qs[63]);
            H(qs[64]);
            H(qs[65]);
            H(qs[66]);
            H(qs[67]);
            H(qs[68]);
            H(qs[69]);
            H(qs[70]);
            H(qs[71]);
            H(qs[72]);
            H(qs[73]);
            H(qs[74]);
            H(qs[75]);
            H(qs[76]);
            H(qs[77]);
            H(qs[78]);
            H(qs[79]);
            H(qs[80]);
            H(qs[81]);
            H(qs[82]);
            H(qs[83]);
            H(qs[84]);
            H(qs[85]);
            H(qs[86]);
            H(qs[87]);
            H(qs[88]);
            H(qs[89]);
            H(qs[90]);
            H(qs[91]);
            H(qs[92]);
            H(qs[93]);
            H(qs[94]);
            H(qs[95]);
            H(qs[96]);
            H(qs[97]);
            H(qs[98]);
            H(qs[99]);
            H(qs[100]);
            H(qs[101]);
            H(qs[102]);
            H(qs[103]);
            H(qs[104]);
            H(qs[105]);
            H(qs[106]);
            H(qs[107]);
            H(qs[108]);
            H(qs[109]);
            H(qs[110]);
            H(qs[111]);
            H(qs[112]);
            H(qs[113]);
            H(qs[114]);
            H(qs[115]);
            H(qs[116]);
            H(qs[117]);
            H(qs[118]);
            H(qs[119]);
            H(qs[120]);
            H(qs[121]);
            H(qs[122]);
            H(qs[123]);
            H(qs[124]);
            H(qs[125]);
            H(qs[126]);
            H(qs[127]);
            H(qs[128]);
            H(qs[129]);
            H(qs[130]);
            H(qs[131]);
            H(qs[132]);
            H(qs[133]);
            H(qs[134]);
            H(qs[135]);
            H(qs[136]);
            H(qs[137]);
            H(qs[138]);
            H(qs[139]);
            H(qs[140]);
            H(qs[141]);
            H(qs[142]);
            H(qs[143]);
            H(qs[144]);
            H(qs[145]);
            H(qs[146]);
            H(qs[147]);
            H(qs[148]);
            H(qs[149]);
            H(qs[150]);
            H(qs[151]);
            H(qs[152]);
            H(qs[153]);
            H(qs[154]);
            H(qs[155]);
            H(qs[156]);
            H(qs[157]);
            H(qs[158]);
            H(qs[159]);
            H(qs[160]);
            H(qs[161]);
            H(qs[162]);
            H(qs[163]);
            H(qs[164]);
            H(qs[165]);
            H(qs[166]);
            H(qs[167]);
            H(qs[168]);
            H(qs[169]);
            H(qs[170]);
            H(qs[171]);
            H(qs[172]);
            H(qs[173]);
            H(qs[174]);
            H(qs[175]);
            H(qs[176]);
            H(qs[177]);
            H(qs[178]);
            H(qs[179]);
            H(qs[180]);
            H(qs[181]);
            H(qs[182]);
            H(qs[183]);
            H(qs[184]);
            H(qs[185]);
            H(qs[186]);
            H(qs[187]);
            H(qs[188]);
            H(qs[189]);
            H(qs[190]);
            H(qs[191]);
            H(qs[192]);
            H(qs[193]);
            H(qs[194]);
            H(qs[195]);
            H(qs[196]);
            H(qs[197]);
            H(qs[198]);
            H(qs[199]);
            H(qs[200]);
            H(qs[201]);
            H(qs[202]);
            H(qs[203]);
            H(qs[204]);
            H(qs[205]);
            H(qs[206]);
            H(qs[207]);
            H(qs[208]);
            H(qs[209]);
            H(qs[210]);
            H(qs[211]);
            H(qs[212]);
            H(qs[213]);
            H(qs[214]);
            H(qs[215]);
            H(qs[216]);
            H(qs[217]);
            H(qs[218]);
            H(qs[219]);
            H(qs[220]);
            H(qs[221]);
            H(qs[222]);
            H(qs[223]);
            H(qs[224]);
            H(qs[225]);
            H(qs[226]);
            H(qs[227]);
            H(qs[228]);
            H(qs[229]);
            H(qs[230]);
            H(qs[231]);
            H(qs[232]);
            H(qs[233]);
            H(qs[234]);
            H(qs[235]);
            H(qs[236]);
            H(qs[237]);
            H(qs[238]);
            H(qs[239]);
            H(qs[240]);
            H(qs[241]);
            H(qs[242]);
            H(qs[243]);
            H(qs[244]);
            H(qs[245]);
            H(qs[246]);
            H(qs[247]);
            H(qs[248]);
            H(qs[249]);
            H(qs[250]);
            H(qs[251]);
            H(qs[252]);
            H(qs[253]);
            H(qs[254]);
            H(qs[255]);
            H(qs[256]);
            H(qs[257]);
            H(qs[258]);
            H(qs[259]);
            H(qs[260]);
            H(qs[261]);
            H(qs[262]);
            H(qs[263]);
            H(qs[264]);
            H(qs[265]);
            H(qs[266]);
            H(qs[267]);
            H(qs[268]);
            H(qs[269]);
            H(qs[270]);
            H(qs[271]);
            H(qs[272]);
            H(qs[273]);
            H(qs[274]);
            H(qs[275]);
            H(qs[276]);
            H(qs[277]);
            H(qs[278]);
            H(qs[279]);
            H(qs[280]);
            H(qs[281]);
            H(qs[282]);
            H(qs[283]);
            H(qs[284]);
            H(qs[285]);
            H(qs[286]);
            H(qs[287]);
            H(qs[288]);
            H(qs[289]);
            H(qs[290]);
            H(qs[291]);
            H(qs[292]);
            H(qs[293]);
            H(qs[294]);
            H(qs[295]);
            H(qs[296]);
            H(qs[297]);
            H(qs[298]);
            H(qs[299]);
            H(qs[300]);
            H(qs[301]);
            H(qs[302]);
            H(qs[303]);
            H(qs[304]);
            H(qs[305]);
            H(qs[306]);
            H(qs[307]);
            H(qs[308]);
            H(qs[309]);
            H(qs[310]);
            H(qs[311]);
            H(qs[312]);
            H(qs[313]);
            H(qs[314]);
            H(qs[315]);
            H(qs[316]);
            H(qs[317]);
            H(qs[318]);
            H(qs[319]);
            H(qs[320]);
            H(qs[321]);
            H(qs[322]);
            H(qs[323]);
            H(qs[324]);
            H(qs[325]);
            H(qs[326]);
            H(qs[327]);
            H(qs[328]);
            H(qs[329]);
            H(qs[330]);
            H(qs[331]);
            H(qs[332]);
            H(qs[333]);
            H(qs[334]);
            H(qs[335]);
            H(qs[336]);
            H(qs[337]);
            H(qs[338]);
            H(qs[339]);
            H(qs[340]);
            H(qs[341]);
            H(qs[342]);
            H(qs[343]);
            H(qs[344]);
            H(qs[345]);
            H(qs[346]);
            H(qs[347]);
            H(qs[348]);
            H(qs[349]);
            H(qs[350]);
            H(qs[351]);
            H(qs[352]);
            H(qs[353]);
            H(qs[354]);
            H(qs[355]);
            H(qs[356]);
            H(qs[357]);
            H(qs[358]);
            H(qs[359]);
            H(qs[360]);
            H(qs[361]);
            H(qs[362]);
            H(qs[363]);
            H(qs[364]);
            H(qs[365]);
            H(qs[366]);
            H(qs[367]);
            H(qs[368]);
            H(qs[369]);
            H(qs[370]);
            H(qs[371]);
            H(qs[372]);
            H(qs[373]);
            H(qs[374]);
            H(qs[375]);
            H(qs[376]);
            H(qs[377]);
            H(qs[378]);
            H(qs[379]);
            H(qs[380]);
            H(qs[381]);
            H(qs[382]);
            H(qs[383]);
            H(qs[384]);
            H(qs[385]);
            H(qs[386]);
            H(qs[387]);
            H(qs[388]);
            H(qs[389]);
            H(qs[390]);
            H(qs[391]);
            H(qs[392]);
            H(qs[393]);
            H(qs[394]);
            H(qs[395]);
            H(qs[396]);
            H(qs[397]);
            H(qs[398]);
            H(qs[399]);
            H(qs[400]);
            H(qs[401]);
            H(qs[402]);
            H(qs[403]);
            H(qs[404]);
            H(qs[405]);
            H(qs[406]);
            H(qs[407]);
            H(qs[408]);
            H(qs[409]);
            H(qs[410]);
            H(qs[411]);
            H(qs[412]);
            H(qs[413]);
            H(qs[414]);
            H(qs[415]);
            H(qs[416]);
            H(qs[417]);
            H(qs[418]);
            H(qs[419]);
            H(qs[420]);
            H(qs[421]);
            H(qs[422]);
            H(qs[423]);
            H(qs[424]);
            H(qs[425]);
            H(qs[426]);
            H(qs[427]);
            H(qs[428]);
            H(qs[429]);
            H(qs[430]);
            H(qs[431]);
            H(qs[432]);
            H(qs[433]);
            H(qs[434]);
            H(qs[435]);
            H(qs[436]);
            H(qs[437]);
            H(qs[438]);
            H(qs[439]);
            H(qs[440]);
            H(qs[441]);
            H(qs[442]);
            H(qs[443]);
            H(qs[444]);
            H(qs[445]);
            H(qs[446]);
            H(qs[447]);
            H(qs[448]);
            H(qs[449]);
            H(qs[450]);
            H(qs[451]);
            H(qs[452]);
            H(qs[453]);
            H(qs[454]);
            H(qs[455]);
            H(qs[456]);
            H(qs[457]);
            H(qs[458]);
            H(qs[459]);
            H(qs[460]);
            H(qs[461]);
            H(qs[462]);
            H(qs[463]);
            H(qs[464]);
            H(qs[465]);
            H(qs[466]);
            H(qs[467]);
            H(qs[468]);
            H(qs[469]);
            H(qs[470]);
            H(qs[471]);
            H(qs[472]);
            H(qs[473]);
            H(qs[474]);
            H(qs[475]);
            H(qs[476]);
            H(qs[477]);
            H(qs[478]);
            H(qs[479]);
            H(qs[480]);
            H(qs[481]);
            H(qs[482]);
            H(qs[483]);
            H(qs[484]);
            H(qs[485]);
            H(qs[486]);
            H(qs[487]);
            H(qs[488]);
            H(qs[489]);
            H(qs[490]);
            H(qs[491]);
            H(qs[492]);
            H(qs[493]);
            H(qs[494]);
            H(qs[495]);
            H(qs[496]);
            H(qs[497]);
            H(qs[498]);
            H(qs[499]);
            H(qs[500]);
            H(qs[501]);
            H(qs[502]);
            H(qs[503]);
            H(qs[504]);
            H(qs[505]);
            H(qs[506]);
            H(qs[507]);
            H(qs[508]);
            H(qs[509]);
            H(qs[510]);
            H(qs[511]);
            H(qs[512]);
            H(qs[513]);
            H(qs[514]);
            H(qs[515]);
            H(qs[516]);
            H(qs[517]);
            H(qs[518]);
            H(qs[519]);
            H(qs[520]);
            H(qs[521]);
            H(qs[522]);
            H(qs[523]);
            H(qs[524]);
            H(qs[525]);
            H(qs[526]);
            H(qs[527]);
            H(qs[528]);
            H(qs[529]);
            H(qs[530]);
            H(qs[531]);
            H(qs[532]);
            H(qs[533]);
            H(qs[534]);
            H(qs[535]);
            H(qs[536]);
            H(qs[537]);
            H(qs[538]);
            H(qs[539]);
            H(qs[540]);
            H(qs[541]);
            H(qs[542]);
            H(qs[543]);
            H(qs[544]);
            H(qs[545]);
            H(qs[546]);
            H(qs[547]);
            H(qs[548]);
            H(qs[549]);
            H(qs[550]);
            H(qs[551]);
            H(qs[552]);
            H(qs[553]);
            H(qs[554]);
            H(qs[555]);
            H(qs[556]);
            H(qs[557]);
            H(qs[558]);
            H(qs[559]);
            H(qs[560]);
            H(qs[561]);
            H(qs[562]);
            H(qs[563]);
            H(qs[564]);
            H(qs[565]);
            H(qs[566]);
            H(qs[567]);
            H(qs[568]);
            H(qs[569]);
            H(qs[570]);
            H(qs[571]);
            H(qs[572]);
            H(qs[573]);
            H(qs[574]);
            H(qs[575]);
            H(qs[576]);
            H(qs[577]);
            H(qs[578]);
            H(qs[579]);
            H(qs[580]);
            H(qs[581]);
            H(qs[582]);
            H(qs[583]);
            H(qs[584]);
            H(qs[585]);
            H(qs[586]);
            H(qs[587]);
            H(qs[588]);
            H(qs[589]);
            H(qs[590]);
            H(qs[591]);
            H(qs[592]);
            H(qs[593]);
            H(qs[594]);
            H(qs[595]);
            H(qs[596]);
            H(qs[597]);
            H(qs[598]);
            H(qs[599]);
            H(qs[600]);
            H(qs[601]);
            H(qs[602]);
            H(qs[603]);
            H(qs[604]);
            H(qs[605]);
            H(qs[606]);
            H(qs[607]);
            H(qs[608]);
            H(qs[609]);
            H(qs[610]);
            H(qs[611]);
            H(qs[612]);
            H(qs[613]);
            H(qs[614]);
            H(qs[615]);
            H(qs[616]);
            H(qs[617]);
            H(qs[618]);
            H(qs[619]);
            H(qs[620]);
            H(qs[621]);
            H(qs[622]);
            H(qs[623]);
            H(qs[624]);
            H(qs[625]);
            H(qs[626]);
            H(qs[627]);
            H(qs[628]);
            H(qs[629]);
            H(qs[630]);
            H(qs[631]);
            H(qs[632]);
            H(qs[633]);
            H(qs[634]);
            H(qs[635]);
            H(qs[636]);
            H(qs[637]);
            H(qs[638]);
            H(qs[639]);
            H(qs[640]);
            H(qs[641]);
            H(qs[642]);
            H(qs[643]);
            H(qs[644]);
            H(qs[645]);
            H(qs[646]);
            H(qs[647]);
            H(qs[648]);
            H(qs[649]);
            H(qs[650]);
            H(qs[651]);
            H(qs[652]);
            H(qs[653]);
            H(qs[654]);
            H(qs[655]);
            H(qs[656]);
            H(qs[657]);
            H(qs[658]);
            H(qs[659]);
            H(qs[660]);
            H(qs[661]);
            H(qs[662]);
            H(qs[663]);
            H(qs[664]);
            H(qs[665]);
            H(qs[666]);
            H(qs[667]);
            H(qs[668]);
            H(qs[669]);
            H(qs[670]);
            H(qs[671]);
            H(qs[672]);
            H(qs[673]);
            H(qs[674]);
            H(qs[675]);
            H(qs[676]);
            H(qs[677]);
            H(qs[678]);
            H(qs[679]);
            H(qs[680]);
            H(qs[681]);
            H(qs[682]);
            H(qs[683]);
            H(qs[684]);
            H(qs[685]);
            H(qs[686]);
            H(qs[687]);
            H(qs[688]);
            H(qs[689]);
            H(qs[690]);
            H(qs[691]);
            H(qs[692]);
            H(qs[693]);
            H(qs[694]);
            H(qs[695]);
            H(qs[696]);
            H(qs[697]);
            H(qs[698]);
            H(qs[699]);
            H(qs[700]);
            H(qs[701]);
            H(qs[702]);
            H(qs[703]);
            H(qs[704]);
            H(qs[705]);
            H(qs[706]);
            H(qs[707]);
            H(qs[708]);
            H(qs[709]);
            H(qs[710]);
            H(qs[711]);
            H(qs[712]);
            H(qs[713]);
            H(qs[714]);
            H(qs[715]);
            H(qs[716]);
            H(qs[717]);
            H(qs[718]);
            H(qs[719]);
            H(qs[720]);
            H(qs[721]);
            H(qs[722]);
            H(qs[723]);
            H(qs[724]);
            H(qs[725]);
            H(qs[726]);
            H(qs[727]);
            H(qs[728]);
            H(qs[729]);
            H(qs[730]);
            H(qs[731]);
            H(qs[732]);
            H(qs[733]);
            H(qs[734]);
            H(qs[735]);
            H(qs[736]);
            H(qs[737]);
            H(qs[738]);
            H(qs[739]);
            H(qs[740]);
            H(qs[741]);
            H(qs[742]);
            H(qs[743]);
            H(qs[744]);
            H(qs[745]);
            H(qs[746]);
            H(qs[747]);
            H(qs[748]);
            H(qs[749]);
            H(qs[750]);
            H(qs[751]);
            H(qs[752]);
            H(qs[753]);
            H(qs[754]);
            H(qs[755]);
            H(qs[756]);
            H(qs[757]);
            H(qs[758]);
            H(qs[759]);
            H(qs[760]);
            H(qs[761]);
            H(qs[762]);
            H(qs[763]);
            H(qs[764]);
            H(qs[765]);
            H(qs[766]);
            H(qs[767]);
            H(qs[768]);
            H(qs[769]);
            H(qs[770]);
            H(qs[771]);
            H(qs[772]);
            H(qs[773]);
            H(qs[774]);
            H(qs[775]);
            H(qs[776]);
            H(qs[777]);
            H(qs[778]);
            H(qs[779]);
            H(qs[780]);
            H(qs[781]);
            H(qs[782]);
            H(qs[783]);
            H(qs[784]);
            H(qs[785]);
            H(qs[786]);
            H(qs[787]);
            H(qs[788]);
            H(qs[789]);
            H(qs[790]);
            H(qs[791]);
            H(qs[792]);
            H(qs[793]);
            H(qs[794]);
            H(qs[795]);
            H(qs[796]);
            H(qs[797]);
            H(qs[798]);
            H(qs[799]);
            H(qs[800]);
            H(qs[801]);
            H(qs[802]);
            H(qs[803]);
            H(qs[804]);
            H(qs[805]);
            H(qs[806]);
            H(qs[807]);
            H(qs[808]);
            H(qs[809]);
            H(qs[810]);
            H(qs[811]);
            H(qs[812]);
            H(qs[813]);
            H(qs[814]);
            H(qs[815]);
            H(qs[816]);
            H(qs[817]);
            H(qs[818]);
            H(qs[819]);
            H(qs[820]);
            H(qs[821]);
            H(qs[822]);
            H(qs[823]);
            H(qs[824]);
            H(qs[825]);
            H(qs[826]);
            H(qs[827]);
            H(qs[828]);
            H(qs[829]);
            H(qs[830]);
            H(qs[831]);
            H(qs[832]);
            H(qs[833]);
            H(qs[834]);
            H(qs[835]);
            H(qs[836]);
            H(qs[837]);
            H(qs[838]);
            H(qs[839]);
            H(qs[840]);
            H(qs[841]);
            H(qs[842]);
            H(qs[843]);
            H(qs[844]);
            H(qs[845]);
            H(qs[846]);
            H(qs[847]);
            H(qs[848]);
            H(qs[849]);
            H(qs[850]);
            H(qs[851]);
            H(qs[852]);
            H(qs[853]);
            H(qs[854]);
            H(qs[855]);
            H(qs[856]);
            H(qs[857]);
            H(qs[858]);
            H(qs[859]);
            H(qs[860]);
            H(qs[861]);
            H(qs[862]);
            H(qs[863]);
            H(qs[864]);
            H(qs[865]);
            H(qs[866]);
            H(qs[867]);
            H(qs[868]);
            H(qs[869]);
            H(qs[870]);
            H(qs[871]);
            H(qs[872]);
            H(qs[873]);
            H(qs[874]);
            H(qs[875]);
            H(qs[876]);
            H(qs[877]);
            H(qs[878]);
            H(qs[879]);
            H(qs[880]);
            H(qs[881]);
            H(qs[882]);
            H(qs[883]);
            H(qs[884]);
            H(qs[885]);
            H(qs[886]);
            H(qs[887]);
            H(qs[888]);
            H(qs[889]);
            H(qs[890]);
            H(qs[891]);
            H(qs[892]);
            H(qs[893]);
            H(qs[894]);
            H(qs[895]);
            H(qs[896]);
            H(qs[897]);
            H(qs[898]);
            H(qs[899]);
            H(qs[900]);
            H(qs[901]);
            H(qs[902]);
            H(qs[903]);
            H(qs[904]);
            H(qs[905]);
            H(qs[906]);
            H(qs[907]);
            H(qs[908]);
            H(qs[909]);
            H(qs[910]);
            H(qs[911]);
            H(qs[912]);
            H(qs[913]);
            H(qs[914]);
            H(qs[915]);
            H(qs[916]);
            H(qs[917]);
            H(qs[918]);
            H(qs[919]);
            H(qs[920]);
            H(qs[921]);
            H(qs[922]);
            H(qs[923]);
            H(qs[924]);
            H(qs[925]);
            H(qs[926]);
            H(qs[927]);
            H(qs[928]);
            H(qs[929]);
            H(qs[930]);
            H(qs[931]);
            H(qs[932]);
            H(qs[933]);
            H(qs[934]);
            H(qs[935]);
            H(qs[936]);
            H(qs[937]);
            H(qs[938]);
            H(qs[939]);
            H(qs[940]);
            H(qs[941]);
            H(qs[942]);
            H(qs[943]);
            H(qs[944]);
            H(qs[945]);
            H(qs[946]);
            H(qs[947]);
            H(qs[948]);
            H(qs[949]);
            H(qs[950]);
            H(qs[951]);
            H(qs[952]);
            H(qs[953]);
            H(qs[954]);
            H(qs[955]);
            H(qs[956]);
            H(qs[957]);
            H(qs[958]);
            H(qs[959]);
            H(qs[960]);
            H(qs[961]);
            H(qs[962]);
            H(qs[963]);
            H(qs[964]);
            H(qs[965]);
            H(qs[966]);
            H(qs[967]);
            H(qs[968]);
            H(qs[969]);
            H(qs[970]);
            H(qs[971]);
            H(qs[972]);
            H(qs[973]);
            H(qs[974]);
            H(qs[975]);
            H(qs[976]);
            H(qs[977]);
            H(qs[978]);
            H(qs[979]);
            H(qs[980]);
            H(qs[981]);
            H(qs[982]);
            H(qs[983]);
            H(qs[984]);
            H(qs[985]);
            H(qs[986]);
            H(qs[987]);
            H(qs[988]);
            H(qs[989]);
            H(qs[990]);
            H(qs[991]);
            H(qs[992]);
            H(qs[993]);
            H(qs[994]);
            H(qs[995]);
            H(qs[996]);
            H(qs[997]);
            H(qs[998]);
            H(qs[999]);
        }
        apply {
            use aux = Qubit[1];
            within {
                H(aux[0]);
            }
            apply {
                Controlled X(aux, qs[0]);
                Controlled X(aux, qs[1]);
                Controlled X(aux, qs[2]);
                Controlled X(aux, qs[3]);
                Controlled X(aux, qs[4]);
                Controlled X(aux, qs[5]);
                Controlled X(aux, qs[6]);
                Controlled X(aux, qs[7]);
                Controlled X(aux, qs[8]);
                Controlled X(aux, qs[9]);
                Controlled X(aux, qs[10]);
                Controlled X(aux, qs[11]);
                Controlled X(aux, qs[12]);
                Controlled X(aux, qs[13]);
                Controlled X(aux, qs[14]);
                Controlled X(aux, qs[15]);
                Controlled X(aux, qs[16]);
                Controlled X(aux, qs[17]);
                Controlled X(aux, qs[18]);
                Controlled X(aux, qs[19]);
                Controlled X(aux, qs[20]);
                Controlled X(aux, qs[21]);
                Controlled X(aux, qs[22]);
                Controlled X(aux, qs[23]);
                Controlled X(aux, qs[24]);
                Controlled X(aux, qs[25]);
                Controlled X(aux, qs[26]);
                Controlled X(aux, qs[27]);
                Controlled X(aux, qs[28]);
                Controlled X(aux, qs[29]);
                Controlled X(aux, qs[30]);
                Controlled X(aux, qs[31]);
                Controlled X(aux, qs[32]);
                Controlled X(aux, qs[33]);
                Controlled X(aux, qs[34]);
                Controlled X(aux, qs[35]);
                Controlled X(aux, qs[36]);
                Controlled X(aux, qs[37]);
                Controlled X(aux, qs[38]);
                Controlled X(aux, qs[39]);
                Controlled X(aux, qs[40]);
                Controlled X(aux, qs[41]);
                Controlled X(aux, qs[42]);
                Controlled X(aux, qs[43]);
                Controlled X(aux, qs[44]);
                Controlled X(aux, qs[45]);
                Controlled X(aux, qs[46]);
                Controlled X(aux, qs[47]);
                Controlled X(aux, qs[48]);
                Controlled X(aux, qs[49]);
                Controlled X(aux, qs[50]);
                Controlled X(aux, qs[51]);
                Controlled X(aux, qs[52]);
                Controlled X(aux, qs[53]);
                Controlled X(aux, qs[54]);
                Controlled X(aux, qs[55]);
                Controlled X(aux, qs[56]);
                Controlled X(aux, qs[57]);
                Controlled X(aux, qs[58]);
                Controlled X(aux, qs[59]);
                Controlled X(aux, qs[60]);
                Controlled X(aux, qs[61]);
                Controlled X(aux, qs[62]);
                Controlled X(aux, qs[63]);
                Controlled X(aux, qs[64]);
                Controlled X(aux, qs[65]);
                Controlled X(aux, qs[66]);
                Controlled X(aux, qs[67]);
                Controlled X(aux, qs[68]);
                Controlled X(aux, qs[69]);
                Controlled X(aux, qs[70]);
                Controlled X(aux, qs[71]);
                Controlled X(aux, qs[72]);
                Controlled X(aux, qs[73]);
                Controlled X(aux, qs[74]);
                Controlled X(aux, qs[75]);
                Controlled X(aux, qs[76]);
                Controlled X(aux, qs[77]);
                Controlled X(aux, qs[78]);
                Controlled X(aux, qs[79]);
                Controlled X(aux, qs[80]);
                Controlled X(aux, qs[81]);
                Controlled X(aux, qs[82]);
                Controlled X(aux, qs[83]);
                Controlled X(aux, qs[84]);
                Controlled X(aux, qs[85]);
                Controlled X(aux, qs[86]);
                Controlled X(aux, qs[87]);
                Controlled X(aux, qs[88]);
                Controlled X(aux, qs[89]);
                Controlled X(aux, qs[90]);
                Controlled X(aux, qs[91]);
                Controlled X(aux, qs[92]);
                Controlled X(aux, qs[93]);
                Controlled X(aux, qs[94]);
                Controlled X(aux, qs[95]);
                Controlled X(aux, qs[96]);
                Controlled X(aux, qs[97]);
                Controlled X(aux, qs[98]);
                Controlled X(aux, qs[99]);
                Controlled X(aux, qs[100]);
                Controlled X(aux, qs[101]);
                Controlled X(aux, qs[102]);
                Controlled X(aux, qs[103]);
                Controlled X(aux, qs[104]);
                Controlled X(aux, qs[105]);
                Controlled X(aux, qs[106]);
                Controlled X(aux, qs[107]);
                Controlled X(aux, qs[108]);
                Controlled X(aux, qs[109]);
                Controlled X(aux, qs[110]);
                Controlled X(aux, qs[111]);
                Controlled X(aux, qs[112]);
                Controlled X(aux, qs[113]);
                Controlled X(aux, qs[114]);
                Controlled X(aux, qs[115]);
                Controlled X(aux, qs[116]);
                Controlled X(aux, qs[117]);
                Controlled X(aux, qs[118]);
                Controlled X(aux, qs[119]);
                Controlled X(aux, qs[120]);
                Controlled X(aux, qs[121]);
                Controlled X(aux, qs[122]);
                Controlled X(aux, qs[123]);
                Controlled X(aux, qs[124]);
                Controlled X(aux, qs[125]);
                Controlled X(aux, qs[126]);
                Controlled X(aux, qs[127]);
                Controlled X(aux, qs[128]);
                Controlled X(aux, qs[129]);
                Controlled X(aux, qs[130]);
                Controlled X(aux, qs[131]);
                Controlled X(aux, qs[132]);
                Controlled X(aux, qs[133]);
                Controlled X(aux, qs[134]);
                Controlled X(aux, qs[135]);
                Controlled X(aux, qs[136]);
                Controlled X(aux, qs[137]);
                Controlled X(aux, qs[138]);
                Controlled X(aux, qs[139]);
                Controlled X(aux, qs[140]);
                Controlled X(aux, qs[141]);
                Controlled X(aux, qs[142]);
                Controlled X(aux, qs[143]);
                Controlled X(aux, qs[144]);
                Controlled X(aux, qs[145]);
                Controlled X(aux, qs[146]);
                Controlled X(aux, qs[147]);
                Controlled X(aux, qs[148]);
                Controlled X(aux, qs[149]);
                Controlled X(aux, qs[150]);
                Controlled X(aux, qs[151]);
                Controlled X(aux, qs[152]);
                Controlled X(aux, qs[153]);
                Controlled X(aux, qs[154]);
                Controlled X(aux, qs[155]);
                Controlled X(aux, qs[156]);
                Controlled X(aux, qs[157]);
                Controlled X(aux, qs[158]);
                Controlled X(aux, qs[159]);
                Controlled X(aux, qs[160]);
                Controlled X(aux, qs[161]);
                Controlled X(aux, qs[162]);
                Controlled X(aux, qs[163]);
                Controlled X(aux, qs[164]);
                Controlled X(aux, qs[165]);
                Controlled X(aux, qs[166]);
                Controlled X(aux, qs[167]);
                Controlled X(aux, qs[168]);
                Controlled X(aux, qs[169]);
                Controlled X(aux, qs[170]);
                Controlled X(aux, qs[171]);
                Controlled X(aux, qs[172]);
                Controlled X(aux, qs[173]);
                Controlled X(aux, qs[174]);
                Controlled X(aux, qs[175]);
                Controlled X(aux, qs[176]);
                Controlled X(aux, qs[177]);
                Controlled X(aux, qs[178]);
                Controlled X(aux, qs[179]);
                Controlled X(aux, qs[180]);
                Controlled X(aux, qs[181]);
                Controlled X(aux, qs[182]);
                Controlled X(aux, qs[183]);
                Controlled X(aux, qs[184]);
                Controlled X(aux, qs[185]);
                Controlled X(aux, qs[186]);
                Controlled X(aux, qs[187]);
                Controlled X(aux, qs[188]);
                Controlled X(aux, qs[189]);
                Controlled X(aux, qs[190]);
                Controlled X(aux, qs[191]);
                Controlled X(aux, qs[192]);
                Controlled X(aux, qs[193]);
                Controlled X(aux, qs[194]);
                Controlled X(aux, qs[195]);
                Controlled X(aux, qs[196]);
                Controlled X(aux, qs[197]);
                Controlled X(aux, qs[198]);
                Controlled X(aux, qs[199]);
                Controlled X(aux, qs[200]);
                Controlled X(aux, qs[201]);
                Controlled X(aux, qs[202]);
                Controlled X(aux, qs[203]);
                Controlled X(aux, qs[204]);
                Controlled X(aux, qs[205]);
                Controlled X(aux, qs[206]);
                Controlled X(aux, qs[207]);
                Controlled X(aux, qs[208]);
                Controlled X(aux, qs[209]);
                Controlled X(aux, qs[210]);
                Controlled X(aux, qs[211]);
                Controlled X(aux, qs[212]);
                Controlled X(aux, qs[213]);
                Controlled X(aux, qs[214]);
                Controlled X(aux, qs[215]);
                Controlled X(aux, qs[216]);
                Controlled X(aux, qs[217]);
                Controlled X(aux, qs[218]);
                Controlled X(aux, qs[219]);
                Controlled X(aux, qs[220]);
                Controlled X(aux, qs[221]);
                Controlled X(aux, qs[222]);
                Controlled X(aux, qs[223]);
                Controlled X(aux, qs[224]);
                Controlled X(aux, qs[225]);
                Controlled X(aux, qs[226]);
                Controlled X(aux, qs[227]);
                Controlled X(aux, qs[228]);
                Controlled X(aux, qs[229]);
                Controlled X(aux, qs[230]);
                Controlled X(aux, qs[231]);
                Controlled X(aux, qs[232]);
                Controlled X(aux, qs[233]);
                Controlled X(aux, qs[234]);
                Controlled X(aux, qs[235]);
                Controlled X(aux, qs[236]);
                Controlled X(aux, qs[237]);
                Controlled X(aux, qs[238]);
                Controlled X(aux, qs[239]);
                Controlled X(aux, qs[240]);
                Controlled X(aux, qs[241]);
                Controlled X(aux, qs[242]);
                Controlled X(aux, qs[243]);
                Controlled X(aux, qs[244]);
                Controlled X(aux, qs[245]);
                Controlled X(aux, qs[246]);
                Controlled X(aux, qs[247]);
                Controlled X(aux, qs[248]);
                Controlled X(aux, qs[249]);
                Controlled X(aux, qs[250]);
                Controlled X(aux, qs[251]);
                Controlled X(aux, qs[252]);
                Controlled X(aux, qs[253]);
                Controlled X(aux, qs[254]);
                Controlled X(aux, qs[255]);
                Controlled X(aux, qs[256]);
                Controlled X(aux, qs[257]);
                Controlled X(aux, qs[258]);
                Controlled X(aux, qs[259]);
                Controlled X(aux, qs[260]);
                Controlled X(aux, qs[261]);
                Controlled X(aux, qs[262]);
                Controlled X(aux, qs[263]);
                Controlled X(aux, qs[264]);
                Controlled X(aux, qs[265]);
                Controlled X(aux, qs[266]);
                Controlled X(aux, qs[267]);
                Controlled X(aux, qs[268]);
                Controlled X(aux, qs[269]);
                Controlled X(aux, qs[270]);
                Controlled X(aux, qs[271]);
                Controlled X(aux, qs[272]);
                Controlled X(aux, qs[273]);
                Controlled X(aux, qs[274]);
                Controlled X(aux, qs[275]);
                Controlled X(aux, qs[276]);
                Controlled X(aux, qs[277]);
                Controlled X(aux, qs[278]);
                Controlled X(aux, qs[279]);
                Controlled X(aux, qs[280]);
                Controlled X(aux, qs[281]);
                Controlled X(aux, qs[282]);
                Controlled X(aux, qs[283]);
                Controlled X(aux, qs[284]);
                Controlled X(aux, qs[285]);
                Controlled X(aux, qs[286]);
                Controlled X(aux, qs[287]);
                Controlled X(aux, qs[288]);
                Controlled X(aux, qs[289]);
                Controlled X(aux, qs[290]);
                Controlled X(aux, qs[291]);
                Controlled X(aux, qs[292]);
                Controlled X(aux, qs[293]);
                Controlled X(aux, qs[294]);
                Controlled X(aux, qs[295]);
                Controlled X(aux, qs[296]);
                Controlled X(aux, qs[297]);
                Controlled X(aux, qs[298]);
                Controlled X(aux, qs[299]);
                Controlled X(aux, qs[300]);
                Controlled X(aux, qs[301]);
                Controlled X(aux, qs[302]);
                Controlled X(aux, qs[303]);
                Controlled X(aux, qs[304]);
                Controlled X(aux, qs[305]);
                Controlled X(aux, qs[306]);
                Controlled X(aux, qs[307]);
                Controlled X(aux, qs[308]);
                Controlled X(aux, qs[309]);
                Controlled X(aux, qs[310]);
                Controlled X(aux, qs[311]);
                Controlled X(aux, qs[312]);
                Controlled X(aux, qs[313]);
                Controlled X(aux, qs[314]);
                Controlled X(aux, qs[315]);
                Controlled X(aux, qs[316]);
                Controlled X(aux, qs[317]);
                Controlled X(aux, qs[318]);
                Controlled X(aux, qs[319]);
                Controlled X(aux, qs[320]);
                Controlled X(aux, qs[321]);
                Controlled X(aux, qs[322]);
                Controlled X(aux, qs[323]);
                Controlled X(aux, qs[324]);
                Controlled X(aux, qs[325]);
                Controlled X(aux, qs[326]);
                Controlled X(aux, qs[327]);
                Controlled X(aux, qs[328]);
                Controlled X(aux, qs[329]);
                Controlled X(aux, qs[330]);
                Controlled X(aux, qs[331]);
                Controlled X(aux, qs[332]);
                Controlled X(aux, qs[333]);
                Controlled X(aux, qs[334]);
                Controlled X(aux, qs[335]);
                Controlled X(aux, qs[336]);
                Controlled X(aux, qs[337]);
                Controlled X(aux, qs[338]);
                Controlled X(aux, qs[339]);
                Controlled X(aux, qs[340]);
                Controlled X(aux, qs[341]);
                Controlled X(aux, qs[342]);
                Controlled X(aux, qs[343]);
                Controlled X(aux, qs[344]);
                Controlled X(aux, qs[345]);
                Controlled X(aux, qs[346]);
                Controlled X(aux, qs[347]);
                Controlled X(aux, qs[348]);
                Controlled X(aux, qs[349]);
                Controlled X(aux, qs[350]);
                Controlled X(aux, qs[351]);
                Controlled X(aux, qs[352]);
                Controlled X(aux, qs[353]);
                Controlled X(aux, qs[354]);
                Controlled X(aux, qs[355]);
                Controlled X(aux, qs[356]);
                Controlled X(aux, qs[357]);
                Controlled X(aux, qs[358]);
                Controlled X(aux, qs[359]);
                Controlled X(aux, qs[360]);
                Controlled X(aux, qs[361]);
                Controlled X(aux, qs[362]);
                Controlled X(aux, qs[363]);
                Controlled X(aux, qs[364]);
                Controlled X(aux, qs[365]);
                Controlled X(aux, qs[366]);
                Controlled X(aux, qs[367]);
                Controlled X(aux, qs[368]);
                Controlled X(aux, qs[369]);
                Controlled X(aux, qs[370]);
                Controlled X(aux, qs[371]);
                Controlled X(aux, qs[372]);
                Controlled X(aux, qs[373]);
                Controlled X(aux, qs[374]);
                Controlled X(aux, qs[375]);
                Controlled X(aux, qs[376]);
                Controlled X(aux, qs[377]);
                Controlled X(aux, qs[378]);
                Controlled X(aux, qs[379]);
                Controlled X(aux, qs[380]);
                Controlled X(aux, qs[381]);
                Controlled X(aux, qs[382]);
                Controlled X(aux, qs[383]);
                Controlled X(aux, qs[384]);
                Controlled X(aux, qs[385]);
                Controlled X(aux, qs[386]);
                Controlled X(aux, qs[387]);
                Controlled X(aux, qs[388]);
                Controlled X(aux, qs[389]);
                Controlled X(aux, qs[390]);
                Controlled X(aux, qs[391]);
                Controlled X(aux, qs[392]);
                Controlled X(aux, qs[393]);
                Controlled X(aux, qs[394]);
                Controlled X(aux, qs[395]);
                Controlled X(aux, qs[396]);
                Controlled X(aux, qs[397]);
                Controlled X(aux, qs[398]);
                Controlled X(aux, qs[399]);
                Controlled X(aux, qs[400]);
                Controlled X(aux, qs[401]);
                Controlled X(aux, qs[402]);
                Controlled X(aux, qs[403]);
                Controlled X(aux, qs[404]);
                Controlled X(aux, qs[405]);
                Controlled X(aux, qs[406]);
                Controlled X(aux, qs[407]);
                Controlled X(aux, qs[408]);
                Controlled X(aux, qs[409]);
                Controlled X(aux, qs[410]);
                Controlled X(aux, qs[411]);
                Controlled X(aux, qs[412]);
                Controlled X(aux, qs[413]);
                Controlled X(aux, qs[414]);
                Controlled X(aux, qs[415]);
                Controlled X(aux, qs[416]);
                Controlled X(aux, qs[417]);
                Controlled X(aux, qs[418]);
                Controlled X(aux, qs[419]);
                Controlled X(aux, qs[420]);
                Controlled X(aux, qs[421]);
                Controlled X(aux, qs[422]);
                Controlled X(aux, qs[423]);
                Controlled X(aux, qs[424]);
                Controlled X(aux, qs[425]);
                Controlled X(aux, qs[426]);
                Controlled X(aux, qs[427]);
                Controlled X(aux, qs[428]);
                Controlled X(aux, qs[429]);
                Controlled X(aux, qs[430]);
                Controlled X(aux, qs[431]);
                Controlled X(aux, qs[432]);
                Controlled X(aux, qs[433]);
                Controlled X(aux, qs[434]);
                Controlled X(aux, qs[435]);
                Controlled X(aux, qs[436]);
                Controlled X(aux, qs[437]);
                Controlled X(aux, qs[438]);
                Controlled X(aux, qs[439]);
                Controlled X(aux, qs[440]);
                Controlled X(aux, qs[441]);
                Controlled X(aux, qs[442]);
                Controlled X(aux, qs[443]);
                Controlled X(aux, qs[444]);
                Controlled X(aux, qs[445]);
                Controlled X(aux, qs[446]);
                Controlled X(aux, qs[447]);
                Controlled X(aux, qs[448]);
                Controlled X(aux, qs[449]);
                Controlled X(aux, qs[450]);
                Controlled X(aux, qs[451]);
                Controlled X(aux, qs[452]);
                Controlled X(aux, qs[453]);
                Controlled X(aux, qs[454]);
                Controlled X(aux, qs[455]);
                Controlled X(aux, qs[456]);
                Controlled X(aux, qs[457]);
                Controlled X(aux, qs[458]);
                Controlled X(aux, qs[459]);
                Controlled X(aux, qs[460]);
                Controlled X(aux, qs[461]);
                Controlled X(aux, qs[462]);
                Controlled X(aux, qs[463]);
                Controlled X(aux, qs[464]);
                Controlled X(aux, qs[465]);
                Controlled X(aux, qs[466]);
                Controlled X(aux, qs[467]);
                Controlled X(aux, qs[468]);
                Controlled X(aux, qs[469]);
                Controlled X(aux, qs[470]);
                Controlled X(aux, qs[471]);
                Controlled X(aux, qs[472]);
                Controlled X(aux, qs[473]);
                Controlled X(aux, qs[474]);
                Controlled X(aux, qs[475]);
                Controlled X(aux, qs[476]);
                Controlled X(aux, qs[477]);
                Controlled X(aux, qs[478]);
                Controlled X(aux, qs[479]);
                Controlled X(aux, qs[480]);
                Controlled X(aux, qs[481]);
                Controlled X(aux, qs[482]);
                Controlled X(aux, qs[483]);
                Controlled X(aux, qs[484]);
                Controlled X(aux, qs[485]);
                Controlled X(aux, qs[486]);
                Controlled X(aux, qs[487]);
                Controlled X(aux, qs[488]);
                Controlled X(aux, qs[489]);
                Controlled X(aux, qs[490]);
                Controlled X(aux, qs[491]);
                Controlled X(aux, qs[492]);
                Controlled X(aux, qs[493]);
                Controlled X(aux, qs[494]);
                Controlled X(aux, qs[495]);
                Controlled X(aux, qs[496]);
                Controlled X(aux, qs[497]);
                Controlled X(aux, qs[498]);
                Controlled X(aux, qs[499]);
                Controlled X(aux, qs[500]);
                Controlled X(aux, qs[501]);
                Controlled X(aux, qs[502]);
                Controlled X(aux, qs[503]);
                Controlled X(aux, qs[504]);
                Controlled X(aux, qs[505]);
                Controlled X(aux, qs[506]);
                Controlled X(aux, qs[507]);
                Controlled X(aux, qs[508]);
                Controlled X(aux, qs[509]);
                Controlled X(aux, qs[510]);
                Controlled X(aux, qs[511]);
                Controlled X(aux, qs[512]);
                Controlled X(aux, qs[513]);
                Controlled X(aux, qs[514]);
                Controlled X(aux, qs[515]);
                Controlled X(aux, qs[516]);
                Controlled X(aux, qs[517]);
                Controlled X(aux, qs[518]);
                Controlled X(aux, qs[519]);
                Controlled X(aux, qs[520]);
                Controlled X(aux, qs[521]);
                Controlled X(aux, qs[522]);
                Controlled X(aux, qs[523]);
                Controlled X(aux, qs[524]);
                Controlled X(aux, qs[525]);
                Controlled X(aux, qs[526]);
                Controlled X(aux, qs[527]);
                Controlled X(aux, qs[528]);
                Controlled X(aux, qs[529]);
                Controlled X(aux, qs[530]);
                Controlled X(aux, qs[531]);
                Controlled X(aux, qs[532]);
                Controlled X(aux, qs[533]);
                Controlled X(aux, qs[534]);
                Controlled X(aux, qs[535]);
                Controlled X(aux, qs[536]);
                Controlled X(aux, qs[537]);
                Controlled X(aux, qs[538]);
                Controlled X(aux, qs[539]);
                Controlled X(aux, qs[540]);
                Controlled X(aux, qs[541]);
                Controlled X(aux, qs[542]);
                Controlled X(aux, qs[543]);
                Controlled X(aux, qs[544]);
                Controlled X(aux, qs[545]);
                Controlled X(aux, qs[546]);
                Controlled X(aux, qs[547]);
                Controlled X(aux, qs[548]);
                Controlled X(aux, qs[549]);
                Controlled X(aux, qs[550]);
                Controlled X(aux, qs[551]);
                Controlled X(aux, qs[552]);
                Controlled X(aux, qs[553]);
                Controlled X(aux, qs[554]);
                Controlled X(aux, qs[555]);
                Controlled X(aux, qs[556]);
                Controlled X(aux, qs[557]);
                Controlled X(aux, qs[558]);
                Controlled X(aux, qs[559]);
                Controlled X(aux, qs[560]);
                Controlled X(aux, qs[561]);
                Controlled X(aux, qs[562]);
                Controlled X(aux, qs[563]);
                Controlled X(aux, qs[564]);
                Controlled X(aux, qs[565]);
                Controlled X(aux, qs[566]);
                Controlled X(aux, qs[567]);
                Controlled X(aux, qs[568]);
                Controlled X(aux, qs[569]);
                Controlled X(aux, qs[570]);
                Controlled X(aux, qs[571]);
                Controlled X(aux, qs[572]);
                Controlled X(aux, qs[573]);
                Controlled X(aux, qs[574]);
                Controlled X(aux, qs[575]);
                Controlled X(aux, qs[576]);
                Controlled X(aux, qs[577]);
                Controlled X(aux, qs[578]);
                Controlled X(aux, qs[579]);
                Controlled X(aux, qs[580]);
                Controlled X(aux, qs[581]);
                Controlled X(aux, qs[582]);
                Controlled X(aux, qs[583]);
                Controlled X(aux, qs[584]);
                Controlled X(aux, qs[585]);
                Controlled X(aux, qs[586]);
                Controlled X(aux, qs[587]);
                Controlled X(aux, qs[588]);
                Controlled X(aux, qs[589]);
                Controlled X(aux, qs[590]);
                Controlled X(aux, qs[591]);
                Controlled X(aux, qs[592]);
                Controlled X(aux, qs[593]);
                Controlled X(aux, qs[594]);
                Controlled X(aux, qs[595]);
                Controlled X(aux, qs[596]);
                Controlled X(aux, qs[597]);
                Controlled X(aux, qs[598]);
                Controlled X(aux, qs[599]);
                Controlled X(aux, qs[600]);
                Controlled X(aux, qs[601]);
                Controlled X(aux, qs[602]);
                Controlled X(aux, qs[603]);
                Controlled X(aux, qs[604]);
                Controlled X(aux, qs[605]);
                Controlled X(aux, qs[606]);
                Controlled X(aux, qs[607]);
                Controlled X(aux, qs[608]);
                Controlled X(aux, qs[609]);
                Controlled X(aux, qs[610]);
                Controlled X(aux, qs[611]);
                Controlled X(aux, qs[612]);
                Controlled X(aux, qs[613]);
                Controlled X(aux, qs[614]);
                Controlled X(aux, qs[615]);
                Controlled X(aux, qs[616]);
                Controlled X(aux, qs[617]);
                Controlled X(aux, qs[618]);
                Controlled X(aux, qs[619]);
                Controlled X(aux, qs[620]);
                Controlled X(aux, qs[621]);
                Controlled X(aux, qs[622]);
                Controlled X(aux, qs[623]);
                Controlled X(aux, qs[624]);
                Controlled X(aux, qs[625]);
                Controlled X(aux, qs[626]);
                Controlled X(aux, qs[627]);
                Controlled X(aux, qs[628]);
                Controlled X(aux, qs[629]);
                Controlled X(aux, qs[630]);
                Controlled X(aux, qs[631]);
                Controlled X(aux, qs[632]);
                Controlled X(aux, qs[633]);
                Controlled X(aux, qs[634]);
                Controlled X(aux, qs[635]);
                Controlled X(aux, qs[636]);
                Controlled X(aux, qs[637]);
                Controlled X(aux, qs[638]);
                Controlled X(aux, qs[639]);
                Controlled X(aux, qs[640]);
                Controlled X(aux, qs[641]);
                Controlled X(aux, qs[642]);
                Controlled X(aux, qs[643]);
                Controlled X(aux, qs[644]);
                Controlled X(aux, qs[645]);
                Controlled X(aux, qs[646]);
                Controlled X(aux, qs[647]);
                Controlled X(aux, qs[648]);
                Controlled X(aux, qs[649]);
                Controlled X(aux, qs[650]);
                Controlled X(aux, qs[651]);
                Controlled X(aux, qs[652]);
                Controlled X(aux, qs[653]);
                Controlled X(aux, qs[654]);
                Controlled X(aux, qs[655]);
                Controlled X(aux, qs[656]);
                Controlled X(aux, qs[657]);
                Controlled X(aux, qs[658]);
                Controlled X(aux, qs[659]);
                Controlled X(aux, qs[660]);
                Controlled X(aux, qs[661]);
                Controlled X(aux, qs[662]);
                Controlled X(aux, qs[663]);
                Controlled X(aux, qs[664]);
                Controlled X(aux, qs[665]);
                Controlled X(aux, qs[666]);
                Controlled X(aux, qs[667]);
                Controlled X(aux, qs[668]);
                Controlled X(aux, qs[669]);
                Controlled X(aux, qs[670]);
                Controlled X(aux, qs[671]);
                Controlled X(aux, qs[672]);
                Controlled X(aux, qs[673]);
                Controlled X(aux, qs[674]);
                Controlled X(aux, qs[675]);
                Controlled X(aux, qs[676]);
                Controlled X(aux, qs[677]);
                Controlled X(aux, qs[678]);
                Controlled X(aux, qs[679]);
                Controlled X(aux, qs[680]);
                Controlled X(aux, qs[681]);
                Controlled X(aux, qs[682]);
                Controlled X(aux, qs[683]);
                Controlled X(aux, qs[684]);
                Controlled X(aux, qs[685]);
                Controlled X(aux, qs[686]);
                Controlled X(aux, qs[687]);
                Controlled X(aux, qs[688]);
                Controlled X(aux, qs[689]);
                Controlled X(aux, qs[690]);
                Controlled X(aux, qs[691]);
                Controlled X(aux, qs[692]);
                Controlled X(aux, qs[693]);
                Controlled X(aux, qs[694]);
                Controlled X(aux, qs[695]);
                Controlled X(aux, qs[696]);
                Controlled X(aux, qs[697]);
                Controlled X(aux, qs[698]);
                Controlled X(aux, qs[699]);
                Controlled X(aux, qs[700]);
                Controlled X(aux, qs[701]);
                Controlled X(aux, qs[702]);
                Controlled X(aux, qs[703]);
                Controlled X(aux, qs[704]);
                Controlled X(aux, qs[705]);
                Controlled X(aux, qs[706]);
                Controlled X(aux, qs[707]);
                Controlled X(aux, qs[708]);
                Controlled X(aux, qs[709]);
                Controlled X(aux, qs[710]);
                Controlled X(aux, qs[711]);
                Controlled X(aux, qs[712]);
                Controlled X(aux, qs[713]);
                Controlled X(aux, qs[714]);
                Controlled X(aux, qs[715]);
                Controlled X(aux, qs[716]);
                Controlled X(aux, qs[717]);
                Controlled X(aux, qs[718]);
                Controlled X(aux, qs[719]);
                Controlled X(aux, qs[720]);
                Controlled X(aux, qs[721]);
                Controlled X(aux, qs[722]);
                Controlled X(aux, qs[723]);
                Controlled X(aux, qs[724]);
                Controlled X(aux, qs[725]);
                Controlled X(aux, qs[726]);
                Controlled X(aux, qs[727]);
                Controlled X(aux, qs[728]);
                Controlled X(aux, qs[729]);
                Controlled X(aux, qs[730]);
                Controlled X(aux, qs[731]);
                Controlled X(aux, qs[732]);
                Controlled X(aux, qs[733]);
                Controlled X(aux, qs[734]);
                Controlled X(aux, qs[735]);
                Controlled X(aux, qs[736]);
                Controlled X(aux, qs[737]);
                Controlled X(aux, qs[738]);
                Controlled X(aux, qs[739]);
                Controlled X(aux, qs[740]);
                Controlled X(aux, qs[741]);
                Controlled X(aux, qs[742]);
                Controlled X(aux, qs[743]);
                Controlled X(aux, qs[744]);
                Controlled X(aux, qs[745]);
                Controlled X(aux, qs[746]);
                Controlled X(aux, qs[747]);
                Controlled X(aux, qs[748]);
                Controlled X(aux, qs[749]);
                Controlled X(aux, qs[750]);
                Controlled X(aux, qs[751]);
                Controlled X(aux, qs[752]);
                Controlled X(aux, qs[753]);
                Controlled X(aux, qs[754]);
                Controlled X(aux, qs[755]);
                Controlled X(aux, qs[756]);
                Controlled X(aux, qs[757]);
                Controlled X(aux, qs[758]);
                Controlled X(aux, qs[759]);
                Controlled X(aux, qs[760]);
                Controlled X(aux, qs[761]);
                Controlled X(aux, qs[762]);
                Controlled X(aux, qs[763]);
                Controlled X(aux, qs[764]);
                Controlled X(aux, qs[765]);
                Controlled X(aux, qs[766]);
                Controlled X(aux, qs[767]);
                Controlled X(aux, qs[768]);
                Controlled X(aux, qs[769]);
                Controlled X(aux, qs[770]);
                Controlled X(aux, qs[771]);
                Controlled X(aux, qs[772]);
                Controlled X(aux, qs[773]);
                Controlled X(aux, qs[774]);
                Controlled X(aux, qs[775]);
                Controlled X(aux, qs[776]);
                Controlled X(aux, qs[777]);
                Controlled X(aux, qs[778]);
                Controlled X(aux, qs[779]);
                Controlled X(aux, qs[780]);
                Controlled X(aux, qs[781]);
                Controlled X(aux, qs[782]);
                Controlled X(aux, qs[783]);
                Controlled X(aux, qs[784]);
                Controlled X(aux, qs[785]);
                Controlled X(aux, qs[786]);
                Controlled X(aux, qs[787]);
                Controlled X(aux, qs[788]);
                Controlled X(aux, qs[789]);
                Controlled X(aux, qs[790]);
                Controlled X(aux, qs[791]);
                Controlled X(aux, qs[792]);
                Controlled X(aux, qs[793]);
                Controlled X(aux, qs[794]);
                Controlled X(aux, qs[795]);
                Controlled X(aux, qs[796]);
                Controlled X(aux, qs[797]);
                Controlled X(aux, qs[798]);
                Controlled X(aux, qs[799]);
                Controlled X(aux, qs[800]);
                Controlled X(aux, qs[801]);
                Controlled X(aux, qs[802]);
                Controlled X(aux, qs[803]);
                Controlled X(aux, qs[804]);
                Controlled X(aux, qs[805]);
                Controlled X(aux, qs[806]);
                Controlled X(aux, qs[807]);
                Controlled X(aux, qs[808]);
                Controlled X(aux, qs[809]);
                Controlled X(aux, qs[810]);
                Controlled X(aux, qs[811]);
                Controlled X(aux, qs[812]);
                Controlled X(aux, qs[813]);
                Controlled X(aux, qs[814]);
                Controlled X(aux, qs[815]);
                Controlled X(aux, qs[816]);
                Controlled X(aux, qs[817]);
                Controlled X(aux, qs[818]);
                Controlled X(aux, qs[819]);
                Controlled X(aux, qs[820]);
                Controlled X(aux, qs[821]);
                Controlled X(aux, qs[822]);
                Controlled X(aux, qs[823]);
                Controlled X(aux, qs[824]);
                Controlled X(aux, qs[825]);
                Controlled X(aux, qs[826]);
                Controlled X(aux, qs[827]);
                Controlled X(aux, qs[828]);
                Controlled X(aux, qs[829]);
                Controlled X(aux, qs[830]);
                Controlled X(aux, qs[831]);
                Controlled X(aux, qs[832]);
                Controlled X(aux, qs[833]);
                Controlled X(aux, qs[834]);
                Controlled X(aux, qs[835]);
                Controlled X(aux, qs[836]);
                Controlled X(aux, qs[837]);
                Controlled X(aux, qs[838]);
                Controlled X(aux, qs[839]);
                Controlled X(aux, qs[840]);
                Controlled X(aux, qs[841]);
                Controlled X(aux, qs[842]);
                Controlled X(aux, qs[843]);
                Controlled X(aux, qs[844]);
                Controlled X(aux, qs[845]);
                Controlled X(aux, qs[846]);
                Controlled X(aux, qs[847]);
                Controlled X(aux, qs[848]);
                Controlled X(aux, qs[849]);
                Controlled X(aux, qs[850]);
                Controlled X(aux, qs[851]);
                Controlled X(aux, qs[852]);
                Controlled X(aux, qs[853]);
                Controlled X(aux, qs[854]);
                Controlled X(aux, qs[855]);
                Controlled X(aux, qs[856]);
                Controlled X(aux, qs[857]);
                Controlled X(aux, qs[858]);
                Controlled X(aux, qs[859]);
                Controlled X(aux, qs[860]);
                Controlled X(aux, qs[861]);
                Controlled X(aux, qs[862]);
                Controlled X(aux, qs[863]);
                Controlled X(aux, qs[864]);
                Controlled X(aux, qs[865]);
                Controlled X(aux, qs[866]);
                Controlled X(aux, qs[867]);
                Controlled X(aux, qs[868]);
                Controlled X(aux, qs[869]);
                Controlled X(aux, qs[870]);
                Controlled X(aux, qs[871]);
                Controlled X(aux, qs[872]);
                Controlled X(aux, qs[873]);
                Controlled X(aux, qs[874]);
                Controlled X(aux, qs[875]);
                Controlled X(aux, qs[876]);
                Controlled X(aux, qs[877]);
                Controlled X(aux, qs[878]);
                Controlled X(aux, qs[879]);
                Controlled X(aux, qs[880]);
                Controlled X(aux, qs[881]);
                Controlled X(aux, qs[882]);
                Controlled X(aux, qs[883]);
                Controlled X(aux, qs[884]);
                Controlled X(aux, qs[885]);
                Controlled X(aux, qs[886]);
                Controlled X(aux, qs[887]);
                Controlled X(aux, qs[888]);
                Controlled X(aux, qs[889]);
                Controlled X(aux, qs[890]);
                Controlled X(aux, qs[891]);
                Controlled X(aux, qs[892]);
                Controlled X(aux, qs[893]);
                Controlled X(aux, qs[894]);
                Controlled X(aux, qs[895]);
                Controlled X(aux, qs[896]);
                Controlled X(aux, qs[897]);
                Controlled X(aux, qs[898]);
                Controlled X(aux, qs[899]);
                Controlled X(aux, qs[900]);
                Controlled X(aux, qs[901]);
                Controlled X(aux, qs[902]);
                Controlled X(aux, qs[903]);
                Controlled X(aux, qs[904]);
                Controlled X(aux, qs[905]);
                Controlled X(aux, qs[906]);
                Controlled X(aux, qs[907]);
                Controlled X(aux, qs[908]);
                Controlled X(aux, qs[909]);
                Controlled X(aux, qs[910]);
                Controlled X(aux, qs[911]);
                Controlled X(aux, qs[912]);
                Controlled X(aux, qs[913]);
                Controlled X(aux, qs[914]);
                Controlled X(aux, qs[915]);
                Controlled X(aux, qs[916]);
                Controlled X(aux, qs[917]);
                Controlled X(aux, qs[918]);
                Controlled X(aux, qs[919]);
                Controlled X(aux, qs[920]);
                Controlled X(aux, qs[921]);
                Controlled X(aux, qs[922]);
                Controlled X(aux, qs[923]);
                Controlled X(aux, qs[924]);
                Controlled X(aux, qs[925]);
                Controlled X(aux, qs[926]);
                Controlled X(aux, qs[927]);
                Controlled X(aux, qs[928]);
                Controlled X(aux, qs[929]);
                Controlled X(aux, qs[930]);
                Controlled X(aux, qs[931]);
                Controlled X(aux, qs[932]);
                Controlled X(aux, qs[933]);
                Controlled X(aux, qs[934]);
                Controlled X(aux, qs[935]);
                Controlled X(aux, qs[936]);
                Controlled X(aux, qs[937]);
                Controlled X(aux, qs[938]);
                Controlled X(aux, qs[939]);
                Controlled X(aux, qs[940]);
                Controlled X(aux, qs[941]);
                Controlled X(aux, qs[942]);
                Controlled X(aux, qs[943]);
                Controlled X(aux, qs[944]);
                Controlled X(aux, qs[945]);
                Controlled X(aux, qs[946]);
                Controlled X(aux, qs[947]);
                Controlled X(aux, qs[948]);
                Controlled X(aux, qs[949]);
                Controlled X(aux, qs[950]);
                Controlled X(aux, qs[951]);
                Controlled X(aux, qs[952]);
                Controlled X(aux, qs[953]);
                Controlled X(aux, qs[954]);
                Controlled X(aux, qs[955]);
                Controlled X(aux, qs[956]);
                Controlled X(aux, qs[957]);
                Controlled X(aux, qs[958]);
                Controlled X(aux, qs[959]);
                Controlled X(aux, qs[960]);
                Controlled X(aux, qs[961]);
                Controlled X(aux, qs[962]);
                Controlled X(aux, qs[963]);
                Controlled X(aux, qs[964]);
                Controlled X(aux, qs[965]);
                Controlled X(aux, qs[966]);
                Controlled X(aux, qs[967]);
                Controlled X(aux, qs[968]);
                Controlled X(aux, qs[969]);
                Controlled X(aux, qs[970]);
                Controlled X(aux, qs[971]);
                Controlled X(aux, qs[972]);
                Controlled X(aux, qs[973]);
                Controlled X(aux, qs[974]);
                Controlled X(aux, qs[975]);
                Controlled X(aux, qs[976]);
                Controlled X(aux, qs[977]);
                Controlled X(aux, qs[978]);
                Controlled X(aux, qs[979]);
                Controlled X(aux, qs[980]);
                Controlled X(aux, qs[981]);
                Controlled X(aux, qs[982]);
                Controlled X(aux, qs[983]);
                Controlled X(aux, qs[984]);
                Controlled X(aux, qs[985]);
                Controlled X(aux, qs[986]);
                Controlled X(aux, qs[987]);
                Controlled X(aux, qs[988]);
                Controlled X(aux, qs[989]);
                Controlled X(aux, qs[990]);
                Controlled X(aux, qs[991]);
                Controlled X(aux, qs[992]);
                Controlled X(aux, qs[993]);
                Controlled X(aux, qs[994]);
                Controlled X(aux, qs[995]);
                Controlled X(aux, qs[996]);
                Controlled X(aux, qs[997]);
                Controlled X(aux, qs[998]);
                Controlled X(aux, qs[999]);
            }
            set res = MResetZ(aux[0]);
        }
        return res;
    }

    @EntryPoint()
    operation Run() : Result {
        use qs = Qubit[1000];
        return ThousandQubitsParityX(qs);
    }
}
