結果

問題 No.861 ケーキカット
ユーザー tatyamtatyam
提出日時 2019-08-09 22:41:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 56,322 bytes
コンパイル時間 2,191 ms
コンパイル使用メモリ 208,952 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 14:46:27
合計ジャッジ時間 3,086 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
5,248 KB
testcase_01 AC 5 ms
5,376 KB
testcase_02 AC 5 ms
5,376 KB
testcase_03 AC 6 ms
5,376 KB
testcase_04 AC 6 ms
5,376 KB
testcase_05 AC 5 ms
5,376 KB
testcase_06 AC 5 ms
5,376 KB
testcase_07 AC 5 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 5 ms
5,376 KB
testcase_10 AC 5 ms
5,376 KB
testcase_11 AC 5 ms
5,376 KB
testcase_12 AC 6 ms
5,376 KB
testcase_13 AC 5 ms
5,376 KB
testcase_14 AC 5 ms
5,376 KB
testcase_15 AC 5 ms
5,376 KB
testcase_16 WA -
testcase_17 AC 5 ms
5,376 KB
testcase_18 AC 6 ms
5,376 KB
testcase_19 WA -
testcase_20 AC 5 ms
5,376 KB
testcase_21 AC 6 ms
5,376 KB
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define each(i,a) for(auto &i:a)
int reverse(int a){
    ll b=0;
    rep(i,0,5)rep(j,0,5){
        b|=((a>>(i*5+j))&1)<<(j*5+i);
    }
    return b;
}
unordered_set<int>s={1,2,3,4,6,7,8,12,14,15,16,24,28,30,31,35,39,47,63,64,66,67,70,71,78,79,94,95,99,103,111,127,128,132,134,135,140,142,143,156,158,159,167,175,191,192,194,195,196,198,199,204,206,207,220,222,223,224,225,227,231,239,255,256,264,268,270,271,280,284,286,287,303,319,334,335,350,351,367,383,384,388,390,391,392,396,398,399,408,412,414,415,423,431,447,448,450,451,452,454,455,456,460,462,463,472,476,478,479,480,481,483,487,495,511,512,528,536,540,542,543,575,606,607,639,668,670,671,703,732,734,735,767,768,784,792,796,798,799,831,862,863,895,896,912,920,924,926,927,959,960,976,984,988,990,991,1023,1063,1071,1087,1127,1135,1151,1191,1199,1215,1248,1249,1251,1255,1263,1279,1327,1343,1391,1407,1447,1455,1471,1504,1505,1507,1511,1519,1535,1599,1663,1727,1791,1855,1919,1983,2047,2126,2127,2142,2143,2159,2175,2240,2242,2243,2244,2246,2247,2252,2254,2255,2268,2270,2271,2275,2279,2287,2303,2382,2383,2398,2399,2415,2431,2496,2498,2499,2500,2502,2503,2504,2508,2510,2511,2520,2524,2526,2527,2528,2529,2531,2535,2543,2559,2654,2655,2687,2780,2782,2783,2815,2910,2911,2943,3008,3024,3032,3036,3038,3039,3071,3119,3135,3183,3199,3303,3311,3327,3375,3391,3439,3455,3520,3552,3553,3555,3559,3567,3583,3647,3711,3839,3903,3967,4095,4096,4224,4228,4230,4231,4236,4238,4239,4252,4254,4255,4263,4271,4287,4288,4290,4291,4292,4294,4295,4300,4302,4303,4316,4318,4319,4320,4321,4323,4327,4335,4351,4480,4484,4486,4487,4488,4492,4494,4495,4504,4508,4510,4511,4519,4527,4543,4544,4546,4547,4548,4550,4551,4552,4556,4558,4559,4568,4572,4574,4575,4576,4577,4579,4583,4591,4607,4764,4766,4767,4799,4828,4830,4831,4863,4992,5008,5016,5020,5022,5023,5055,5056,5072,5080,5084,5086,5087,5119,5287,5295,5311,5344,5345,5347,5351,5359,5375,5543,5551,5567,5600,5601,5603,5607,5615,5631,5823,5887,6079,6143,6222,6223,6238,6239,6255,6271,6272,6276,6278,6279,6284,6286,6287,6300,6302,6303,6336,6338,6339,6340,6342,6343,6348,6350,6351,6364,6366,6367,6371,6375,6383,6399,6528,6532,6534,6535,6536,6540,6542,6543,6552,6556,6558,6559,6592,6594,6595,6596,6598,6599,6600,6604,6606,6607,6616,6620,6622,6623,6624,6625,6627,6631,6639,6655,6750,6751,6783,6812,6814,6815,6876,6878,6879,6911,7040,7056,7064,7068,7070,7071,7104,7120,7128,7132,7134,7135,7167,7215,7231,7279,7295,7399,7407,7423,7552,7584,7585,7616,7648,7649,7651,7655,7663,7679,7743,7807,7935,8191,8192,8448,8456,8460,8462,8463,8472,8476,8478,8479,8495,8511,8526,8527,8542,8543,8559,8575,8576,8580,8582,8583,8584,8588,8590,8591,8600,8604,8606,8607,8615,8623,8639,8640,8642,8643,8644,8646,8647,8648,8652,8654,8655,8664,8668,8670,8671,8672,8673,8675,8679,8687,8703,8960,8976,8984,8988,8990,8991,9023,9054,9055,9087,9088,9104,9112,9116,9118,9119,9151,9152,9168,9176,9180,9182,9183,9215,9519,9535,9583,9599,9639,9647,9663,9696,9697,9699,9703,9711,9727,10047,10111,10175,10239,10574,10575,10590,10591,10607,10623,10688,10690,10691,10692,10694,10695,10696,10700,10702,10703,10712,10716,10718,10719,10720,10721,10723,10727,10735,10751,11102,11103,11135,11200,11216,11224,11228,11230,11231,11263,11567,11583,11631,11647,11712,11744,11745,11747,11751,11759,11775,12095,12159,12287,12288,12416,12420,12422,12423,12428,12430,12431,12444,12446,12447,12455,12463,12479,12480,12482,12483,12484,12486,12487,12492,12494,12495,12508,12510,12511,12512,12513,12515,12519,12527,12543,12544,12552,12556,12558,12559,12568,12572,12574,12575,12591,12607,12672,12676,12678,12679,12680,12684,12686,12687,12696,12700,12702,12703,12711,12719,12735,12736,12738,12739,12740,12742,12743,12744,12748,12750,12751,12760,12764,12766,12767,12768,12769,12771,12775,12783,12799,13056,13072,13080,13084,13086,13087,13119,13184,13200,13208,13212,13214,13215,13247,13248,13264,13272,13276,13278,13279,13311,13479,13487,13503,13536,13537,13539,13543,13551,13567,13615,13631,13735,13743,13759,13792,13793,13795,13799,13807,13823,14143,14271,14335,14336,14400,14402,14403,14406,14407,14414,14415,14430,14431,14432,14433,14435,14439,14447,14463,14464,14468,14470,14471,14476,14478,14479,14492,14494,14495,14528,14530,14531,14532,14534,14535,14540,14542,14543,14556,14558,14559,14560,14561,14563,14567,14575,14591,14592,14600,14604,14606,14607,14616,14620,14622,14623,14656,14658,14659,14664,14680,14688,14689,14691,14720,14724,14726,14727,14728,14732,14734,14735,14744,14748,14750,14751,14784,14786,14787,14788,14790,14791,14792,14796,14798,14799,14808,14812,14814,14815,14816,14817,14819,14823,14831,14847,15104,15120,15128,15132,15134,15135,15168,15184,15192,15232,15248,15256,15260,15262,15263,15296,15312,15320,15324,15326,15327,15359,15360,15392,15393,15395,15399,15407,15423,15424,15456,15457,15459,15463,15471,15487,15488,15520,15521,15552,15584,15585,15587,15591,15599,15615,15616,15648,15649,15651,15680,15712,15713,15715,15744,15776,15777,15808,15840,15841,15843,15847,15855,15871,16383,16384,16896,16912,16920,16924,16926,16927,16959,16990,16991,17023,17052,17054,17055,17087,17116,17118,17119,17151,17152,17168,17176,17180,17182,17183,17215,17246,17247,17279,17280,17296,17304,17308,17310,17311,17343,17344,17360,17368,17372,17374,17375,17407,17983,18047,18111,18175,18239,18303,18367,18431,19038,19039,19071,19164,19166,19167,19199,19294,19295,19327,19392,19408,19416,19420,19422,19423,19455,20031,20095,20223,20287,20351,20479,21148,21150,21151,21183,21212,21214,21215,21247,21376,21392,21400,21404,21406,21407,21439,21440,21456,21464,21468,21470,21471,21503,22207,22271,22463,22527,23134,23135,23167,23196,23198,23199,23260,23262,23263,23295,23424,23440,23448,23452,23454,23455,23488,23504,23512,23516,23518,23519,23551,24127,24191,24319,24575,24576,24832,24960,25024,25088,25104,25112,25116,25118,25119,25151,25182,25183,25215,25344,25360,25368,25372,25374,25375,25407,25438,25439,25471,25472,25488,25496,25500,25502,25503,25535,25536,25552,25560,25564,25566,25567,25599,26175,26239,26431,26495,26559,26623,27072,27230,27231,27263,27486,27487,27519,27584,27600,27608,27612,27614,27615,27647,28223,28287,28479,28543,28671,28672,28800,28864,28928,29056,29120,29184,29200,29208,29212,29214,29215,29247,29312,29328,29376,29392,29440,29456,29464,29468,29470,29471,29503,29568,29584,29592,29596,29598,29599,29631,29632,29648,29656,29660,29662,29663,29695,30271,30527,30655,30719,30720,30784,30848,30912,30976,31040,31104,31168,31232,31248,31256,31260,31262,31263,31296,31312,31320,31360,31376,31424,31440,31488,31504,31512,31516,31518,31519,31552,31568,31576,31616,31632,31640,31644,31646,31647,31680,31696,31704,31708,31710,31711,31743,32767,33839,33855,33903,33919,33967,33983,34031,34047,34095,34111,34159,34175,34215,34223,34239,34272,34273,34275,34279,34287,34303,34367,34431,34495,34559,34623,34687,34751,34815,35903,35967,36079,36095,36143,36159,36207,36223,36288,36320,36321,36323,36327,36335,36351,36415,36479,36607,36671,36735,36863,38063,38079,38127,38143,38311,38319,38335,38368,38369,38371,38375,38383,38399,38591,38655,38847,38911,39999,40063,40175,40191,40320,40352,40353,40384,40416,40417,40419,40423,40431,40447,40511,40575,40703,40959,42287,42303,42351,42367,42407,42415,42431,42464,42465,42467,42471,42479,42495,42815,42879,42943,43007,44335,44351,44399,44415,44480,44512,44513,44515,44519,44527,44543,44863,44927,45055,46247,46255,46271,46304,46305,46307,46311,46319,46335,46383,46399,46503,46511,46527,46560,46561,46563,46567,46575,46591,46911,47039,47103,48128,48160,48161,48163,48167,48175,48191,48192,48224,48225,48227,48231,48239,48255,48256,48288,48289,48320,48352,48353,48355,48359,48367,48383,48384,48416,48417,48419,48448,48480,48481,48483,48512,48544,48545,48576,48608,48609,48611,48615,48623,48639,49151,50751,50815,50879,50943,51007,51071,51135,51199,52799,52863,52991,53055,53119,53247,54975,55039,55231,55295,56895,56959,57087,57343,58943,59007,59199,59263,59327,59391,60991,61055,61247,61311,61439,63039,63295,63423,63487,65535,67678,67679,67711,67804,67806,67807,67839,67918,67919,67934,67935,67951,67967,68032,68034,68035,68036,68038,68039,68040,68044,68046,68047,68056,68060,68062,68063,68067,68071,68079,68095,68190,68191,68223,68316,68318,68319,68351,68446,68447,68479,68544,68560,68568,68572,68574,68575,68607,68671,68735,68863,68911,68927,68975,68991,69095,69103,69119,69183,69247,69375,69439,69503,69631,71774,71775,71807,71836,71838,71839,71900,71902,71903,71935,72064,72068,72070,72071,72072,72076,72078,72079,72088,72092,72094,72095,72128,72130,72131,72132,72134,72135,72136,72140,72142,72143,72152,72156,72158,72159,72163,72167,72175,72191,72286,72287,72319,72348,72350,72351,72412,72414,72415,72447,72576,72592,72600,72604,72606,72607,72640,72656,72664,72668,72670,72671,72703,72767,72831,72959,73191,73199,73215,73279,73343,73471,73727,76110,76111,76126,76127,76143,76159,76224,76226,76227,76228,76230,76231,76232,76236,76238,76239,76248,76252,76254,76255,76256,76257,76259,76263,76271,76287,76638,76639,76671,76736,76752,76760,76764,76766,76767,76799,77103,77119,77167,77183,77248,77280,77281,77283,77287,77295,77311,77631,77695,77823,79872,79936,79938,79939,79942,79943,79950,79951,79966,79967,79968,79969,79971,79975,79983,79999,80000,80004,80006,80007,80012,80014,80015,80028,80030,80031,80064,80066,80067,80068,80070,80071,80076,80078,80079,80092,80094,80095,80096,80097,80099,80103,80111,80127,80128,80136,80140,80142,80143,80152,80156,80158,80159,80192,80194,80195,80200,80216,80224,80225,80227,80256,80260,80262,80263,80264,80268,80270,80271,80280,80284,80286,80287,80320,80322,80323,80324,80326,80327,80328,80332,80334,80335,80344,80348,80350,80351,80352,80353,80355,80359,80367,80383,80640,80656,80664,80668,80670,80671,80704,80720,80728,80768,80784,80792,80796,80798,80799,80832,80848,80856,80860,80862,80863,80895,80896,80928,80929,80931,80935,80943,80959,80960,80992,80993,80995,80999,81007,81023,81024,81056,81057,81088,81120,81121,81123,81127,81135,81151,81152,81184,81185,81187,81216,81248,81249,81251,81280,81312,81313,81344,81376,81377,81379,81383,81391,81407,81919,84574,84575,84607,84700,84702,84703,84735,84830,84831,84863,84928,84944,84952,84956,84958,84959,84991,85567,85631,85759,85823,85887,86015,88670,88671,88703,88732,88734,88735,88796,88798,88799,88831,88960,88976,88984,88988,88990,88991,89024,89040,89048,89052,89054,89055,89087,89663,89727,89855,90111,92608,92766,92767,92799,93022,93023,93055,93120,93136,93144,93148,93150,93151,93183,93759,93823,94015,94079,94207,96256,96320,96384,96448,96512,96576,96640,96704,96768,96784,96792,96796,96798,96799,96832,96848,96856,96896,96912,96960,96976,97024,97040,97048,97052,97054,97055,97088,97104,97112,97152,97168,97176,97180,97182,97183,97216,97232,97240,97244,97246,97247,97279,98303,99391,99455,99519,99583,99631,99647,99695,99711,99759,99775,99823,99839,99903,99967,100031,100095,100159,100223,100287,100351,101439,101503,101631,101695,101759,101871,101887,101951,102015,102143,102207,102271,102399,105535,105599,105727,105967,105983,106047,106111,106239,106495,107823,107839,107887,107903,107943,107951,107967,108000,108001,108003,108007,108015,108031,108351,108415,108479,108543,108992,109871,109887,109935,109951,110016,110048,110049,110051,110055,110063,110079,110399,110463,110591,112640,112704,112768,112832,112896,112960,113024,113088,113664,113696,113697,113699,113703,113711,113727,113728,113760,113761,113763,113767,113775,113791,113792,113824,113825,113856,113888,113889,113891,113895,113903,113919,113920,113952,113953,113955,113984,114016,114017,114019,114048,114080,114081,114112,114144,114145,114147,114151,114159,114175,114687,116287,116351,116415,116479,116543,116607,116671,116735,118335,118399,118527,118591,118655,118783,122431,122495,122623,122879,124479,124543,124735,124799,124863,124927,126527,126591,126783,126847,126975,131071,135324,135326,135327,135359,135388,135390,135391,135423,135576,135580,135582,135583,135615,135640,135644,135646,135647,135679,135836,135838,135839,135871,135900,135902,135903,135935,136064,136080,136088,136092,136094,136095,136127,136128,136144,136152,136156,136158,136159,136191,136383,136447,136639,136703,136895,136959,137151,137215,137310,137311,137343,137372,137374,137375,137436,137438,137439,137471,137624,137628,137630,137631,137688,137692,137694,137695,137727,137822,137823,137855,137884,137886,137887,137948,137950,137951,137983,138112,138128,138136,138140,138142,138143,138176,138192,138200,138204,138206,138207,138239,138303,138367,138495,138751,138815,138879,139007,139263,143360,143488,143492,143494,143495,143500,143502,143503,143516,143518,143519,143527,143535,143551,143552,143554,143555,143556,143558,143559,143564,143566,143567,143580,143582,143583,143584,143585,143587,143591,143599,143615,143616,143624,143628,143630,143631,143640,143644,143646,143647,143663,143679,143744,143748,143750,143751,143752,143756,143758,143759,143768,143772,143774,143775,143783,143791,143807,143808,143810,143811,143812,143814,143815,143816,143820,143822,143823,143832,143836,143838,143839,143840,143841,143843,143847,143855,143871,144128,144144,144152,144156,144158,144159,144191,144256,144272,144280,144284,144286,144287,144319,144320,144336,144344,144348,144350,144351,144383,144551,144559,144575,144608,144609,144611,144615,144623,144639,144687,144703,144807,144815,144831,144864,144865,144867,144871,144879,144895,145215,145343,145407,145486,145487,145502,145503,145519,145535,145536,145540,145542,145543,145548,145550,145551,145564,145566,145567,145600,145602,145603,145604,145606,145607,145612,145614,145615,145628,145630,145631,145635,145639,145647,145663,145664,145672,145676,145678,145679,145688,145692,145694,145695,145728,145730,145731,145736,145752,145760,145761,145763,145792,145796,145798,145799,145800,145804,145806,145807,145816,145820,145822,145823,145856,145858,145859,145860,145862,145863,145864,145868,145870,145871,145880,145884,145886,145887,145888,145889,145891,145895,145903,145919,146176,146192,146200,146204,146206,146207,146240,146256,146264,146304,146320,146328,146332,146334,146335,146368,146384,146392,146396,146398,146399,146431,146479,146495,146543,146559,146663,146671,146687,146688,146720,146721,146723,146752,146784,146785,146787,146816,146848,146849,146880,146912,146913,146915,146919,146927,146943,147455,152220,152222,152223,152255,152284,152286,152287,152319,152448,152464,152472,152476,152478,152479,152511,152512,152528,152536,152540,152542,152543,152575,153279,153343,153535,153599,154206,154207,154239,154268,154270,154271,154332,154334,154335,154367,154496,154512,154520,154524,154526,154527,154560,154576,154584,154588,154590,154591,154623,155199,155263,155391,155647,159744,159872,159936,160000,160128,160192,160256,160272,160280,160284,160286,160287,160319,160384,160400,160448,160464,160512,160528,160536,160540,160542,160543,160575,160640,160656,160664,160668,160670,160671,160703,160704,160720,160728,160732,160734,160735,160767,161343,161599,161727,161791,161792,161856,161920,161984,162048,162112,162176,162240,162304,162320,162328,162332,162334,162335,162368,162384,162392,162432,162448,162496,162512,162560,162576,162584,162588,162590,162591,162624,162640,162648,162688,162704,162712,162716,162718,162719,162752,162768,162776,162780,162782,162783,162815,163839,169151,169215,169407,169471,169663,169727,169919,169983,171071,171135,171263,171519,171583,171647,171775,172031,177327,177343,177391,177407,177455,177471,177575,177583,177599,177632,177633,177635,177639,177647,177663,177983,178111,178175,179263,179327,179439,179455,179456,179488,179489,179491,179520,179552,179553,179555,179584,179616,179617,179648,179680,179681,179683,179687,179695,179711,180223,186047,186111,186303,186367,187967,188031,188159,188415,194111,194367,194495,194559,196607,198750,198751,198783,198876,198878,198879,198911,199006,199007,199039,199128,199132,199134,199135,199167,199262,199263,199295,199388,199390,199391,199423,199518,199519,199551,199616,199632,199640,199644,199646,199647,199679,199743,199807,199935,199999,200063,200191,200255,200319,200447,200511,200575,200703,200860,200862,200863,200895,200924,200926,200927,200959,201112,201116,201118,201119,201151,201176,201180,201182,201183,201215,201372,201374,201375,201407,201436,201438,201439,201471,201600,201616,201624,201628,201630,201631,201663,201664,201680,201688,201692,201694,201695,201727,202846,202847,202879,202908,202910,202911,202972,202974,202975,203007,203160,203164,203166,203167,203224,203228,203230,203231,203263,203358,203359,203391,203420,203422,203423,203484,203486,203487,203519,203648,203664,203672,203676,203678,203679,203712,203728,203736,203740,203742,203743,203775,203839,203903,204031,204287,204351,204415,204543,204799,209052,209054,209055,209087,209116,209118,209119,209151,209152,209160,209164,209166,209167,209176,209180,209182,209183,209199,209215,209280,209284,209286,209287,209288,209292,209294,209295,209304,209308,209310,209311,209319,209327,209343,209344,209346,209347,209348,209350,209351,209352,209356,209358,209359,209368,209372,209374,209375,209376,209377,209379,209383,209391,209407,209664,209680,209688,209692,209694,209695,209727,209792,209808,209816,209820,209822,209823,209855,209856,209872,209880,209884,209886,209887,209919,211038,211039,211071,211100,211102,211103,211164,211166,211167,211199,211208,211212,211214,211215,211224,211228,211230,211231,211272,211288,211328,211332,211334,211335,211336,211340,211342,211343,211352,211356,211358,211359,211392,211394,211395,211396,211398,211399,211400,211404,211406,211407,211416,211420,211422,211423,211427,211431,211439,211455,211712,211728,211736,211740,211742,211743,211776,211792,211800,211840,211856,211864,211868,211870,211871,211904,211920,211928,211932,211934,211935,211967,212031,212095,212223,212455,212463,212479,212991,215646,215647,215679,215772,215774,215775,215807,215902,215903,215935,216000,216016,216024,216028,216030,216031,216063,216639,216703,216831,216895,216959,217087,217756,217758,217759,217791,217820,217822,217823,217855,217984,218000,218008,218012,218014,218015,218047,218048,218064,218072,218076,218078,218079,218111,219742,219743,219775,219804,219806,219807,219868,219870,219871,219903,220032,220048,220056,220060,220062,220063,220096,220112,220120,220124,220126,220127,220159,220735,220799,220927,221183,225280,225408,225472,225536,225664,225728,225792,225808,225816,225820,225822,225823,225855,225920,225936,225984,226000,226048,226064,226072,226076,226078,226079,226111,226176,226192,226200,226204,226206,226207,226239,226240,226256,226264,226268,226270,226271,226303,227328,227392,227456,227520,227584,227648,227712,227776,227840,227856,227864,227868,227870,227871,227904,227920,227928,227968,227984,228032,228048,228096,228112,228120,228124,228126,228127,228160,228176,228184,228224,228240,228248,228252,228254,228255,228288,228304,228312,228316,228318,228319,228351,229375,230463,230527,230591,230655,230719,230783,230847,230911,230975,231039,231103,231167,231231,231295,231359,231423,232511,232575,232703,232767,232831,232959,233023,233087,233215,233279,233343,233471,234559,235071,236607,236671,236799,237055,237119,237183,237311,237567,242751,244799,244863,244991,245231,245247,245759,247359,247423,247487,247551,247615,247679,247743,247807,249407,249471,249599,249663,249727,249855,251455,253503,253567,253695,253951,262143,262144,270336,270592,270600,270604,270606,270607,270616,270620,270622,270623,270639,270655,270670,270671,270686,270687,270703,270719,270720,270724,270726,270727,270728,270732,270734,270735,270744,270748,270750,270751,270759,270767,270783,270784,270786,270787,270788,270790,270791,270792,270796,270798,270799,270808,270812,270814,270815,270816,270817,270819,270823,270831,270847,271104,271120,271128,271132,271134,271135,271167,271198,271199,271231,271232,271248,271256,271260,271262,271263,271295,271296,271312,271320,271324,271326,271327,271359,271663,271679,271727,271743,271783,271791,271807,271840,271841,271843,271847,271855,271871,272191,272255,272319,272383,272718,272719,272734,272735,272751,272767,272832,272834,272835,272836,272838,272839,272840,272844,272846,272847,272856,272860,272862,272863,272864,272865,272867,272871,272879,272895,273246,273247,273279,273344,273360,273368,273372,273374,273375,273407,273711,273727,273775,273791,273856,273888,273889,273891,273895,273903,273919,274239,274303,274431,274432,274560,274564,274566,274567,274572,274574,274575,274588,274590,274591,274599,274607,274623,274624,274626,274627,274628,274630,274631,274636,274638,274639,274652,274654,274655,274656,274657,274659,274663,274671,274687,274688,274696,274700,274702,274703,274712,274716,274718,274719,274735,274751,274816,274820,274822,274823,274824,274828,274830,274831,274840,274844,274846,274847,274855,274863,274879,274880,274882,274883,274884,274886,274887,274888,274892,274894,274895,274904,274908,274910,274911,274912,274913,274915,274919,274927,274943,275200,275216,275224,275228,275230,275231,275263,275328,275344,275352,275356,275358,275359,275391,275392,275408,275416,275420,275422,275423,275455,275623,275631,275647,275680,275681,275683,275687,275695,275711,275759,275775,275879,275887,275903,275936,275937,275939,275943,275951,275967,276287,276415,276479,276480,276544,276546,276547,276550,276551,276558,276559,276574,276575,276576,276577,276579,276583,276591,276607,276608,276612,276614,276615,276620,276622,276623,276636,276638,276639,276672,276674,276675,276676,276678,276679,276684,276686,276687,276700,276702,276703,276704,276705,276707,276711,276719,276735,276736,276744,276748,276750,276751,276760,276764,276766,276767,276800,276802,276803,276808,276824,276832,276833,276835,276864,276868,276870,276871,276872,276876,276878,276879,276888,276892,276894,276895,276928,276930,276931,276932,276934,276935,276936,276940,276942,276943,276952,276956,276958,276959,276960,276961,276963,276967,276975,276991,277248,277264,277272,277276,277278,277279,277312,277328,277336,277376,277392,277400,277404,277406,277407,277440,277456,277464,277468,277470,277471,277503,277504,277536,277537,277539,277543,277551,277567,277568,277600,277601,277603,277607,277615,277631,277632,277664,277665,277696,277728,277729,277731,277735,277743,277759,277760,277792,277793,277795,277824,277856,277857,277859,277888,277920,277921,277952,277984,277985,277987,277991,277999,278015,278527,286720,286976,287104,287168,287232,287248,287256,287260,287262,287263,287295,287326,287327,287359,287488,287504,287512,287516,287518,287519,287551,287582,287583,287615,287616,287632,287640,287644,287646,287647,287679,287680,287696,287704,287708,287710,287711,287743,288319,288383,288575,288639,288703,288767,289216,289374,289375,289407,289630,289631,289663,289728,289744,289752,289756,289758,289759,289791,290367,290431,290623,290687,290815,290816,290944,291008,291072,291200,291264,291328,291344,291352,291356,291358,291359,291391,291456,291472,291520,291536,291584,291600,291608,291612,291614,291615,291647,291712,291728,291736,291740,291742,291743,291775,291776,291792,291800,291804,291806,291807,291839,292415,292671,292799,292863,292864,292928,292992,293056,293120,293184,293248,293312,293376,293392,293400,293404,293406,293407,293440,293456,293464,293504,293520,293568,293584,293632,293648,293656,293660,293662,293663,293696,293712,293720,293760,293776,293784,293788,293790,293791,293824,293840,293848,293852,293854,293855,293887,294911,304431,304447,304495,304511,304551,304559,304575,304608,304609,304611,304615,304623,304639,304959,305023,305087,305151,306479,306495,306543,306559,306624,306656,306657,306659,306663,306671,306687,307007,307071,307199,308391,308399,308415,308448,308449,308451,308455,308463,308479,308527,308543,308647,308655,308671,308704,308705,308707,308711,308719,308735,309055,309183,309247,310272,310304,310305,310307,310311,310319,310335,310336,310368,310369,310371,310375,310383,310399,310400,310432,310433,310464,310496,310497,310499,310503,310511,310527,310528,310560,310561,310563,310592,310624,310625,310627,310656,310688,310689,310720,310752,310753,310755,310759,310767,310783,311295,321087,321151,321343,321407,321471,321535,323135,323199,323391,323455,323583,325183,325439,325567,325631,327679,338254,338255,338270,338271,338287,338303,338368,338370,338371,338372,338374,338375,338376,338380,338382,338383,338392,338396,338398,338399,338400,338401,338403,338407,338415,338431,338782,338783,338815,338880,338896,338904,338908,338910,338911,338943,339247,339263,339311,339327,339392,339424,339425,339427,339431,339439,339455,339775,339839,339967,342016,342080,342082,342083,342086,342087,342094,342095,342110,342111,342112,342113,342115,342119,342127,342143,342144,342148,342150,342151,342156,342158,342159,342172,342174,342175,342208,342210,342211,342212,342214,342215,342220,342222,342223,342236,342238,342239,342240,342241,342243,342247,342255,342271,342272,342280,342284,342286,342287,342296,342300,342302,342303,342336,342338,342339,342344,342360,342368,342369,342371,342400,342404,342406,342407,342408,342412,342414,342415,342424,342428,342430,342431,342464,342466,342467,342468,342470,342471,342472,342476,342478,342479,342488,342492,342494,342495,342496,342497,342499,342503,342511,342527,342784,342800,342808,342812,342814,342815,342848,342864,342872,342912,342928,342936,342940,342942,342943,342976,342992,343000,343004,343006,343007,343039,343040,343072,343073,343075,343079,343087,343103,343104,343136,343137,343139,343143,343151,343167,343168,343200,343201,343232,343264,343265,343267,343271,343279,343295,343296,343328,343329,343331,343360,343392,343393,343395,343424,343456,343457,343488,343520,343521,343523,343527,343535,343551,344063,354752,354910,354911,354943,355166,355167,355199,355264,355280,355288,355292,355294,355295,355327,355903,355967,356159,356223,356351,358400,358464,358528,358592,358656,358720,358784,358848,358912,358928,358936,358940,358942,358943,358976,358992,359000,359040,359056,359104,359120,359168,359184,359192,359196,359198,359199,359232,359248,359256,359296,359312,359320,359324,359326,359327,359360,359376,359384,359388,359390,359391,359423,360447,369967,369983,370031,370047,370087,370095,370111,370144,370145,370147,370151,370159,370175,370495,370559,370623,370687,371136,372015,372031,372079,372095,372160,372192,372193,372195,372199,372207,372223,372543,372607,372735,374784,374848,374912,374976,375040,375104,375168,375232,375808,375840,375841,375843,375847,375855,375871,375872,375904,375905,375907,375911,375919,375935,375936,375968,375969,376000,376032,376033,376035,376039,376047,376063,376064,376096,376097,376099,376128,376160,376161,376163,376192,376224,376225,376256,376288,376289,376291,376295,376303,376319,376831,386623,386687,386879,386943,387007,387071,388671,388735,388927,388991,389119,393215,397468,397470,397471,397503,397532,397534,397535,397567,397720,397724,397726,397727,397759,397784,397788,397790,397791,397823,397980,397982,397983,398015,398044,398046,398047,398079,398208,398224,398232,398236,398238,398239,398271,398272,398288,398296,398300,398302,398303,398335,398527,398591,398783,398847,399039,399103,399295,399359,399454,399455,399487,399516,399518,399519,399580,399582,399583,399615,399768,399772,399774,399775,399832,399836,399838,399839,399871,399966,399967,399999,400028,400030,400031,400092,400094,400095,400127,400256,400272,400280,400284,400286,400287,400320,400336,400344,400348,400350,400351,400383,400447,400511,400639,400895,400959,401023,401151,401407,401408,401664,401672,401676,401678,401679,401688,401692,401694,401695,401711,401727,401742,401743,401758,401759,401775,401791,401792,401796,401798,401799,401800,401804,401806,401807,401816,401820,401822,401823,401831,401839,401855,401856,401858,401859,401860,401862,401863,401864,401868,401870,401871,401880,401884,401886,401887,401888,401889,401891,401895,401903,401919,402176,402192,402200,402204,402206,402207,402239,402270,402271,402303,402304,402320,402328,402332,402334,402335,402367,402368,402384,402392,402396,402398,402399,402431,402735,402751,402799,402815,402855,402863,402879,402912,402913,402915,402919,402927,402943,403263,403327,403391,403455,405504,405632,405636,405638,405639,405644,405646,405647,405660,405662,405663,405671,405679,405695,405696,405698,405699,405700,405702,405703,405708,405710,405711,405724,405726,405727,405728,405729,405731,405735,405743,405759,405760,405768,405772,405774,405775,405784,405788,405790,405791,405807,405823,405888,405892,405894,405895,405896,405900,405902,405903,405912,405916,405918,405919,405927,405935,405951,405952,405954,405955,405956,405958,405959,405960,405964,405966,405967,405976,405980,405982,405983,405984,405985,405987,405991,405999,406015,406272,406288,406296,406300,406302,406303,406335,406400,406416,406424,406428,406430,406431,406463,406464,406480,406488,406492,406494,406495,406527,406695,406703,406719,406752,406753,406755,406759,406767,406783,406831,406847,406951,406959,406975,407008,407009,407011,407015,407023,407039,407359,407487,407551,407630,407631,407646,407647,407663,407679,407680,407684,407686,407687,407692,407694,407695,407708,407710,407711,407744,407746,407747,407748,407750,407751,407756,407758,407759,407772,407774,407775,407779,407783,407791,407807,407808,407816,407820,407822,407823,407832,407836,407838,407839,407872,407874,407875,407880,407896,407904,407905,407907,407936,407940,407942,407943,407944,407948,407950,407951,407960,407964,407966,407967,408000,408002,408003,408004,408006,408007,408008,408012,408014,408015,408024,408028,408030,408031,408032,408033,408035,408039,408047,408063,408320,408336,408344,408348,408350,408351,408384,408400,408408,408448,408464,408472,408476,408478,408479,408512,408528,408536,408540,408542,408543,408575,408623,408639,408687,408703,408807,408815,408831,408832,408864,408865,408867,408896,408928,408929,408931,408960,408992,408993,409024,409056,409057,409059,409063,409071,409087,409599,417792,418048,418176,418240,418304,418320,418328,418332,418334,418335,418367,418398,418399,418431,418560,418576,418584,418588,418590,418591,418623,418654,418655,418687,418688,418704,418712,418716,418718,418719,418751,418752,418768,418776,418780,418782,418783,418815,419391,419455,419647,419711,419775,419839,421888,422016,422080,422144,422272,422336,422400,422416,422424,422428,422430,422431,422463,422528,422544,422592,422608,422656,422672,422680,422684,422686,422687,422719,422784,422800,422808,422812,422814,422815,422847,422848,422864,422872,422876,422878,422879,422911,423487,423743,423871,423935,423936,424000,424064,424128,424192,424256,424320,424384,424448,424464,424472,424476,424478,424479,424512,424528,424536,424576,424592,424640,424656,424704,424720,424728,424732,424734,424735,424768,424784,424792,424832,424848,424856,424860,424862,424863,424896,424912,424920,424924,424926,424927,424959,425983,431295,431359,431551,431615,431807,431871,432063,432127,433215,433279,433407,433663,433727,433791,433919,434175,435503,435519,435567,435583,435623,435631,435647,435680,435681,435683,435687,435695,435711,436031,436095,436159,436223,439471,439487,439535,439551,439599,439615,439719,439727,439743,439776,439777,439779,439783,439791,439807,440127,440255,440319,441407,441471,441583,441599,441600,441632,441633,441635,441664,441696,441697,441699,441728,441760,441761,441792,441824,441825,441827,441831,441839,441855,442367,452159,452223,452415,452479,452543,452607,456255,456511,456639,456703,458751,460894,460895,460927,461020,461022,461023,461055,461150,461151,461183,461272,461276,461278,461279,461311,461406,461407,461439,461532,461534,461535,461567,461662,461663,461695,461760,461776,461784,461788,461790,461791,461823,461887,461951,462079,462143,462207,462335,462399,462463,462591,462655,462719,462847,463004,463006,463007,463039,463068,463070,463071,463103,463256,463260,463262,463263,463295,463320,463324,463326,463327,463359,463516,463518,463519,463551,463580,463582,463583,463615,463744,463760,463768,463772,463774,463775,463807,463808,463824,463832,463836,463838,463839,463871,464990,464991,465023,465052,465054,465055,465116,465118,465119,465151,465304,465308,465310,465311,465368,465372,465374,465375,465407,465502,465503,465535,465564,465566,465567,465628,465630,465631,465663,465792,465808,465816,465820,465822,465823,465856,465872,465880,465884,465886,465887,465919,465983,466047,466175,466431,466495,466559,466687,466943,467200,467208,467212,467214,467215,467224,467228,467230,467231,467247,467263,467278,467279,467294,467295,467311,467327,467328,467332,467334,467335,467336,467340,467342,467343,467352,467356,467358,467359,467367,467375,467391,467392,467394,467395,467396,467398,467399,467400,467404,467406,467407,467416,467420,467422,467423,467424,467425,467427,467431,467439,467455,467712,467728,467736,467740,467742,467743,467775,467806,467807,467839,467840,467856,467864,467868,467870,467871,467903,467904,467920,467928,467932,467934,467935,467967,469086,469087,469119,469256,469260,469262,469263,469272,469276,469278,469279,469320,469336,469760,469776,469784,469788,469790,469791,469824,469840,469848,470079,470143,471196,471198,471199,471231,471260,471262,471263,471295,471296,471304,471308,471310,471311,471320,471324,471326,471327,471343,471359,471424,471428,471430,471431,471432,471436,471438,471439,471448,471452,471454,471455,471463,471471,471487,471488,471490,471491,471492,471494,471495,471496,471500,471502,471503,471512,471516,471518,471519,471520,471521,471523,471527,471535,471551,471808,471824,471832,471836,471838,471839,471871,471936,471952,471960,471964,471966,471967,471999,472000,472016,472024,472028,472030,472031,472063,473182,473183,473215,473244,473246,473247,473308,473310,473311,473343,473352,473356,473358,473359,473368,473372,473374,473375,473416,473432,473472,473476,473478,473479,473480,473484,473486,473487,473496,473500,473502,473503,473536,473538,473539,473540,473542,473543,473544,473548,473550,473551,473560,473564,473566,473567,473571,473575,473583,473599,473856,473872,473880,473884,473886,473887,473920,473936,473944,473984,474000,474008,474012,474014,474015,474048,474064,474072,474076,474078,474079,474111,474175,474239,474367,474599,474607,474623,475135,483328,483584,483712,483776,483840,483856,483864,483868,483870,483871,483903,483934,483935,483967,484096,484112,484120,484124,484126,484127,484159,484190,484191,484223,484224,484240,484248,484252,484254,484255,484287,484288,484304,484312,484316,484318,484319,484351,485376,485440,485632,485696,485888,485904,485912,485916,485918,485919,485952,485968,485976,486144,486160,486168,486172,486174,486175,486208,486224,486232,487424,487552,487616,487680,487808,487872,487936,487952,487960,487964,487966,487967,487999,488064,488080,488128,488144,488192,488208,488216,488220,488222,488223,488255,488320,488336,488344,488348,488350,488351,488383,488384,488400,488408,488412,488414,488415,488447,489472,489536,489600,489664,489728,489792,489856,489920,489984,490000,490008,490012,490014,490015,490048,490064,490072,490112,490128,490176,490192,490240,490256,490264,490268,490270,490271,490304,490320,490328,490368,490384,490392,490396,490398,490399,490432,490448,490456,490460,490462,490463,490495,491519,492607,492671,492735,492799,492863,492927,492991,493055,493119,493183,493247,493311,493375,493439,493503,493567,494655,494719,494847,494911,494975,495103,495167,495231,495359,495423,495487,495615,496703,497215,498751,498815,498943,499199,499263,499327,499455,499711,500799,500863,502847,502911,504895,506943,507007,507135,507375,507391,507903,524287,524288,540672,541184,541200,541208,541212,541214,541215,541247,541278,541279,541311,541340,541342,541343,541375,541404,541406,541407,541439,541440,541456,541464,541468,541470,541471,541503,541534,541535,541567,541568,541584,541592,541596,541598,541599,541631,541632,541648,541656,541660,541662,541663,541695,542271,542335,542399,542463,542527,542591,542655,542719,543326,543327,543359,543452,543454,543455,543487,543582,543583,543615,543680,543696,543704,543708,543710,543711,543743,544319,544383,544511,544575,544639,544767,545436,545438,545439,545471,545500,545502,545503,545535,545664,545680,545688,545692,545694,545695,545727,545728,545744,545752,545756,545758,545759,545791,546495,546559,546751,546815,547422,547423,547455,547484,547486,547487,547548,547550,547551,547583,547712,547728,547736,547740,547742,547743,547776,547792,547800,547804,547806,547807,547839,548415,548479,548607,548863,548864,549120,549248,549312,549376,549392,549400,549404,549406,549407,549439,549470,549471,549503,549632,549648,549656,549660,549662,549663,549695,549726,549727,549759,549760,549776,549784,549788,549790,549791,549823,549824,549840,549848,549852,549854,549855,549887,550463,550527,550719,550783,550847,550911,551360,551518,551519,551551,551774,551775,551807,551872,551888,551896,551900,551902,551903,551935,552511,552575,552767,552831,552959,552960,553088,553152,553216,553344,553408,553472,553488,553496,553500,553502,553503,553535,553600,553616,553664,553680,553728,553744,553752,553756,553758,553759,553791,553856,553872,553880,553884,553886,553887,553919,553920,553936,553944,553948,553950,553951,553983,554559,554815,554943,555007,555008,555072,555136,555200,555264,555328,555392,555456,555520,555536,555544,555548,555550,555551,555584,555600,555608,555648,555664,555712,555728,555776,555792,555800,555804,555806,555807,555840,555856,555864,555904,555920,555928,555932,555934,555935,555968,555984,555992,555996,555998,555999,556031,557055,575039,575103,575167,575231,575295,575359,575423,575487,577087,577151,577279,577343,577407,577535,579263,579327,579519,579583,581183,581247,581375,581631,583231,583295,583487,583551,583615,583679,585279,585343,585535,585599,585727,587327,587583,587711,587775,589823,608862,608863,608895,608988,608990,608991,609023,609118,609119,609151,609216,609232,609240,609244,609246,609247,609279,609855,609919,610047,610111,610175,610303,612958,612959,612991,613020,613022,613023,613084,613086,613087,613119,613248,613264,613272,613276,613278,613279,613312,613328,613336,613340,613342,613343,613375,613951,614015,614143,614399,616896,617054,617055,617087,617310,617311,617343,617408,617424,617432,617436,617438,617439,617471,618047,618111,618303,618367,618495,620544,620608,620672,620736,620800,620864,620928,620992,621056,621072,621080,621084,621086,621087,621120,621136,621144,621184,621200,621248,621264,621312,621328,621336,621340,621342,621343,621376,621392,621400,621440,621456,621464,621468,621470,621471,621504,621520,621528,621532,621534,621535,621567,622591,640575,640639,640703,640767,640831,640895,640959,641023,642623,642687,642815,642879,642943,643071,646719,646783,646911,647167,648767,648831,649023,649087,649151,649215,650815,650879,651071,651135,651263,655359,676508,676510,676511,676543,676572,676574,676575,676607,676736,676752,676760,676764,676766,676767,676799,676800,676816,676824,676828,676830,676831,676863,677567,677631,677823,677887,678494,678495,678527,678556,678558,678559,678620,678622,678623,678655,678784,678800,678808,678812,678814,678815,678848,678864,678872,678876,678878,678879,678911,679487,679551,679679,679935,684032,684160,684224,684288,684416,684480,684544,684560,684568,684572,684574,684575,684607,684672,684688,684736,684752,684800,684816,684824,684828,684830,684831,684863,684928,684944,684952,684956,684958,684959,684991,684992,685008,685016,685020,685022,685023,685055,685631,685887,686015,686079,686080,686144,686208,686272,686336,686400,686464,686528,686592,686608,686616,686620,686622,686623,686656,686672,686680,686720,686736,686784,686800,686848,686864,686872,686876,686878,686879,686912,686928,686936,686976,686992,687000,687004,687006,687007,687040,687056,687064,687068,687070,687071,687103,688127,710335,710399,710591,710655,712255,712319,712447,712703,718399,718655,718783,718847,720895,739934,739935,739967,740060,740062,740063,740095,740190,740191,740223,740288,740304,740312,740316,740318,740319,740351,740927,740991,741119,741183,741247,741375,742044,742046,742047,742079,742108,742110,742111,742143,742272,742288,742296,742300,742302,742303,742335,742336,742352,742360,742364,742366,742367,742399,744030,744031,744063,744092,744094,744095,744156,744158,744159,744191,744320,744336,744344,744348,744350,744351,744384,744400,744408,744412,744414,744415,744447,745023,745087,745215,745471,749568,749696,749760,749824,749952,750016,750080,750096,750104,750108,750110,750111,750143,750208,750224,750272,750288,750336,750352,750360,750364,750366,750367,750399,750464,750480,750488,750492,750494,750495,750527,750528,750544,750552,750556,750558,750559,750591,751616,751680,751744,751808,751872,751936,752000,752064,752128,752144,752152,752156,752158,752159,752192,752208,752216,752256,752272,752320,752336,752384,752400,752408,752412,752414,752415,752448,752464,752472,752512,752528,752536,752540,752542,752543,752576,752592,752600,752604,752606,752607,752639,753663,771647,771711,771775,771839,771903,771967,772031,772095,773695,773759,773887,773951,774015,774143,775743,777791,777855,777983,778239,786431,786432,794624,794880,795008,795072,797120,798720,798848,798912,798976,799104,799168,800768,800832,800896,800960,801024,801088,801152,801216,802816,803328,803344,803352,803356,803358,803359,803391,803422,803423,803455,803484,803486,803487,803519,803548,803550,803551,803583,803584,803600,803608,803612,803614,803615,803647,803678,803679,803711,803712,803728,803736,803740,803742,803743,803775,803776,803792,803800,803804,803806,803807,803839,804415,804479,804543,804607,804671,804735,804799,804863,805470,805471,805503,805596,805598,805599,805631,805726,805727,805759,805824,805840,805848,805852,805854,805855,805887,806463,806527,806655,806719,806783,806911,811008,811264,811392,811456,811520,811536,811544,811548,811550,811551,811583,811614,811615,811647,811776,811792,811800,811804,811806,811807,811839,811870,811871,811903,811904,811920,811928,811932,811934,811935,811967,811968,811984,811992,811996,811998,811999,812031,812607,812671,812863,812927,812991,813055,813504,813662,813663,813695,813918,813919,813951,814016,814032,814040,814044,814046,814047,814079,814655,814719,814911,814975,815103,815104,815232,815296,815360,815488,815552,815616,815632,815640,815644,815646,815647,815679,815744,815760,815808,815824,815872,815888,815896,815900,815902,815903,815935,816000,816016,816024,816028,816030,816031,816063,816064,816080,816088,816092,816094,816095,816127,816703,816959,817087,817151,817152,817216,817280,817344,817408,817472,817536,817600,817664,817680,817688,817692,817694,817695,817728,817744,817752,817792,817808,817856,817872,817920,817936,817944,817948,817950,817951,817984,818000,818008,818048,818064,818072,818076,818078,818079,818112,818128,818136,818140,818142,818143,818175,819199,837183,837247,837311,837375,837439,837503,837567,837631,839231,839295,839423,839487,839551,839679,845375,845439,845631,845695,845759,845823,847423,847487,847679,847743,847871,849471,849727,849855,849919,851967,862656,866304,866368,866432,866496,866560,866624,866688,866752,871006,871007,871039,871132,871134,871135,871167,871262,871263,871295,871360,871376,871384,871388,871390,871391,871423,871999,872063,872191,872255,872319,872447,879040,879198,879199,879231,879454,879455,879487,879552,879568,879576,879580,879582,879583,879615,880191,880255,880447,880511,880639,882688,882752,882816,882880,882944,883008,883072,883136,883200,883216,883224,883228,883230,883231,883264,883280,883288,883328,883344,883392,883408,883456,883472,883480,883484,883486,883487,883520,883536,883544,883584,883600,883608,883612,883614,883615,883648,883664,883672,883676,883678,883679,883711,884735,902719,902783,902847,902911,902975,903039,903103,903167,904767,904831,904959,905023,905087,905215,910911,910975,911167,911231,911295,911359,912959,913023,913215,913279,913407,917503,917504,921600,921728,921792,921984,922048,923648,923712,923776,923840,924032,924096,925696,925952,926080,926144,929792,929920,929984,930048,930176,930240,931840,931904,931968,932032,932096,932160,932224,932288,933888,934400,934416,934424,934428,934430,934431,934463,934494,934495,934527,934556,934558,934559,934591,934620,934622,934623,934655,934656,934672,934680,934684,934686,934687,934719,934750,934751,934783,934784,934800,934808,934812,934814,934815,934847,934848,934864,934872,934876,934878,934879,934911,935487,935551,935615,935679,935743,935807,935871,935935,937984,938112,938176,938496,938512,938520,938524,938526,938527,938559,938624,938640,938688,938704,939583,940032,940096,940160,940224,940544,940560,940568,940572,940574,940575,940608,940624,940632,940672,940688,940736,940752,942080,942336,942464,942528,942592,942608,942616,942620,942622,942623,942655,942686,942687,942719,942848,942864,942872,942876,942878,942879,942911,942942,942943,942975,942976,942992,943000,943004,943006,943007,943039,943040,943056,943064,943068,943070,943071,943103,943679,943743,943935,943999,944063,944127,946176,946304,946368,946432,946560,946624,946688,946704,946712,946716,946718,946719,946751,946816,946832,946880,946896,946944,946960,946968,946972,946974,946975,947007,947072,947088,947096,947100,947102,947103,947135,947136,947152,947160,947164,947166,947167,947199,947775,948031,948159,948223,948224,948288,948352,948416,948480,948544,948608,948672,948736,948752,948760,948764,948766,948767,948800,948816,948824,948864,948880,948928,948944,948992,949008,949016,949020,949022,949023,949056,949072,949080,949120,949136,949144,949148,949150,949151,949184,949200,949208,949212,949214,949215,949247,950271,968255,968319,968383,968447,968511,968575,968639,968703,972351,976447,976511,976703,976767,976831,976895,980543,980799,980927,980991,983039,983040,985088,985152,985280,985536,987136,987264,987328,987520,987584,989184,989248,989312,989376,989568,989632,991232,991488,991616,991680,993280,993344,993536,993600,995328,995456,995520,995584,995712,995776,997376,997440,997504,997568,997632,997696,997760,997824,999424,999936,999952,999960,999964,999966,999967,999999,1000030,1000031,1000063,1000092,1000094,1000095,1000127,1000156,1000158,1000159,1000191,1000192,1000208,1000216,1000220,1000222,1000223,1000255,1000286,1000287,1000319,1000320,1000336,1000344,1000348,1000350,1000351,1000383,1000384,1000400,1000408,1000412,1000414,1000415,1000447,1001472,1001536,1001664,1001984,1002000,1002008,1002012,1002014,1002015,1002048,1002064,1002072,1002176,1002192,1002240,1002256,1002264,1002268,1002270,1002271,1002304,1002320,1002328,1003520,1003648,1003712,1004032,1004048,1004056,1004060,1004062,1004063,1004095,1004160,1004176,1004224,1004240,1005568,1005632,1005696,1005760,1006080,1006096,1006104,1006108,1006110,1006111,1006144,1006160,1006168,1006208,1006224,1006272,1006288,1007616,1007872,1008000,1008064,1008128,1008144,1008152,1008156,1008158,1008159,1008191,1008222,1008223,1008255,1008384,1008400,1008408,1008412,1008414,1008415,1008447,1008478,1008479,1008511,1008512,1008528,1008536,1008540,1008542,1008543,1008575,1008576,1008592,1008600,1008604,1008606,1008607,1008639,1009664,1009728,1009920,1009984,1010176,1010192,1010200,1010204,1010206,1010207,1010240,1010256,1010264,1010432,1010448,1010456,1010460,1010462,1010463,1010496,1010512,1010520,1011712,1011840,1011904,1011968,1012096,1012160,1012224,1012240,1012248,1012252,1012254,1012255,1012287,1012352,1012368,1012416,1012432,1012480,1012496,1012504,1012508,1012510,1012511,1012543,1012608,1012624,1012632,1012636,1012638,1012639,1012671,1012672,1012688,1012696,1012700,1012702,1012703,1012735,1013760,1013824,1013888,1013952,1014016,1014080,1014144,1014208,1014272,1014288,1014296,1014300,1014302,1014303,1014336,1014352,1014360,1014400,1014416,1014464,1014480,1014528,1014544,1014552,1014556,1014558,1014559,1014592,1014608,1014616,1014656,1014672,1014680,1014684,1014686,1014687,1014720,1014736,1014744,1014748,1014750,1014751,1014783,1015807,1048575,1082431,1082495,1082559,1082623,1082687,1082751,1082815,1082879,1082943,1083007,1083071,1083135,1083199,1083263,1083327,1083391,1084671,1084735,1084799,1084927,1084991,1085055,1085183,1085247,1085311,1085439,1086655,1086719,1086911,1086975,1087167,1087231,1087423,1087487,1088767,1089023,1089087,1089151,1089279,1089535,1090879,1090943,1091007,1091071,1091391,1091455,1091519,1091583,1092927,1092991,1093119,1093439,1093503,1093631,1094847,1094911,1094975,1095103,1095167,1095487,1095615,1095679,1096767,1096831,1096959,1097215,1097727,1099327,1099391,1099455,1099519,1099583,1099647,1099711,1099775,1101375,1101439,1101567,1101631,1101695,1101823,1103551,1103615,1103807,1103871,1105471,1105535,1105663,1105919,1107519,1107583,1107775,1107839,1107903,1107967,1109567,1109631,1109823,1109887,1110015,1111615,1111871,1111999,1112063,1114111,1148223,1148287,1148351,1148415,1148479,1148543,1148607,1148671,1148735,1148799,1148863,1148927,1150463,1150527,1150591,1150719,1150783,1150847,1150975,1154559,1154623,1154687,1154815,1155071,1156415,1156479,1156543,1156607,1156927,1156991,1157055,1157119,1158463,1158527,1158655,1158975,1159039,1159167,1162303,1162367,1162495,1162751,1163263,1164863,1164927,1164991,1165055,1165119,1165183,1165247,1165311,1166911,1166975,1167103,1167167,1167231,1167359,1171007,1171071,1171199,1171455,1173055,1173119,1173311,1173375,1173439,1173503,1175103,1175167,1175359,1175423,1175551,1179647,1218239,1218303,1218495,1218559,1220159,1220223,1220351,1220607,1225919,1225983,1226047,1226175,1226239,1226559,1226687,1226751,1228031,1228287,1228799,1234623,1234687,1234879,1234943,1236543,1236607,1236735,1236991,1242687,1242943,1243071,1243135,1245183,1279551,1279615,1279679,1279743,1279807,1279871,1279935,1279999,1281599,1281663,1281791,1281855,1281919,1282047,1283647,1285695,1285759,1285887,1286143,1293823,1294335,1295935,1295999,1296063,1296127,1296191,1296255,1296319,1296383,1297983,1298047,1298175,1298239,1298303,1298431,1300031,1302079,1302143,1302271,1302527,1310719,1353023,1353087,1353151,1353215,1353535,1353599,1353663,1353727,1355071,1355135,1355263,1355583,1355647,1355775,1356991,1357055,1357119,1357247,1357311,1357631,1357759,1357823,1358911,1358975,1359103,1359359,1359871,1369663,1369727,1369919,1369983,1370047,1370111,1371711,1371775,1371967,1372031,1372159,1373759,1374015,1374143,1374207,1376255,1418559,1418623,1418687,1418751,1419071,1419135,1419199,1419263,1420607,1420671,1420799,1421119,1421183,1421311,1424447,1424511,1424639,1424895,1425407,1435199,1435263,1435455,1435519,1435583,1435647,1437247,1437311,1437503,1437567,1437695,1441791,1480383,1480447,1480639,1480703,1482303,1482367,1482495,1482751,1484095,1484159,1484223,1484287,1484607,1484671,1484735,1484799,1488063,1488127,1488191,1488319,1488383,1488703,1488831,1488895,1490175,1490431,1490943,1500735,1500799,1500991,1501055,1501119,1501183,1504831,1505087,1505215,1505279,1507327,1541695,1541759,1541823,1541887,1541951,1542015,1542079,1542143,1543743,1543807,1543935,1543999,1544063,1544191,1545791,1547839,1547903,1548031,1548287,1555967,1556479,1572863,1623615,1623679,1623743,1623807,1623871,1623935,1623999,1624063,1625663,1625727,1625855,1625919,1625983,1626111,1627839,1627903,1628095,1628159,1629759,1629823,1629951,1630207,1631807,1631871,1632063,1632127,1632191,1632255,1633855,1633919,1634111,1634175,1634303,1635903,1636159,1636287,1636351,1638399,1689151,1689215,1689279,1689343,1689407,1689471,1689535,1689599,1691199,1691263,1691391,1691455,1691519,1691647,1695295,1695359,1695487,1695743,1697343,1697407,1697599,1697663,1697727,1697791,1699391,1699455,1699647,1699711,1699839,1703935,1758911,1758975,1759167,1759231,1760831,1760895,1761023,1761279,1766975,1767231,1767359,1767423,1769471,1820223,1820287,1820351,1820415,1820479,1820543,1820607,1820671,1822271,1822335,1822463,1822527,1822591,1822719,1824319,1826367,1826431,1826559,1826815,1835007,1885759,1885823,1885887,1885951,1886015,1886079,1886143,1886207,1887807,1887871,1887999,1888063,1888127,1888255,1893951,1894015,1894207,1894271,1894335,1894399,1895999,1896063,1896255,1896319,1896447,1898047,1898303,1898431,1898495,1900543,1951295,1951359,1951423,1951487,1951551,1951615,1951679,1951743,1953343,1953407,1953535,1953599,1953663,1953791,1959487,1959551,1959743,1959807,1959871,1959935,1961535,1961599,1961791,1961855,1961983,1966079,2016831,2016895,2016959,2017023,2017087,2017151,2017215,2017279,2020927,2025023,2025087,2025279,2025343,2025407,2025471,2029119,2029375,2029503,2029567,2031615,2097151,3180095,3180159,3180223,3180287,3180351,3180415,3180479,3180543,3182335,3182399,3182463,3182591,3184319,3184383,3184575,3184639,3186431,3186687,3188543,3188607,3188671,3188735,3190591,3190655,3190783,3192639,3192767,3192831,3194879,3196479,3196543,3196607,3196671,3196735,3196799,3196863,3196927,3198527,3198591,3198719,3198783,3198847,3198975,3200703,3200767,3200959,3201023,3202623,3202687,3202815,3203071,3204671,3204735,3204927,3204991,3205055,3205119,3206719,3206783,3206975,3207039,3207167,3208767,3209023,3209151,3209215,3211263,3245887,3245951,3246015,3246079,3248127,3252223,3254079,3254143,3254207,3254271,3256127,3256191,3256319,3260415,3262015,3262079,3262143,3262207,3262271,3262335,3262399,3262463,3264063,3264127,3264255,3264319,3264383,3264511,3268159,3268223,3268351,3268607,3270207,3270271,3270463,3270527,3270591,3270655,3272255,3272319,3272511,3272575,3272703,3276799,3391487,3393087,3393151,3393215,3393279,3393343,3393407,3393471,3393535,3395135,3395199,3395327,3395391,3395455,3395583,3397183,3399231,3399295,3399423,3399679,3407871,3450687,3450751,3450815,3450879,3452735,3452799,3452927,3454783,3454911,3454975,3457023,3466815,3466879,3467071,3467135,3467199,3467263,3468863,3468927,3469119,3469183,3469311,3470911,3471167,3471295,3471359,3473407,3516223,3516287,3516351,3516415,3518271,3518335,3518463,3522559,3532351,3532415,3532607,3532671,3532735,3532799,3534399,3534463,3534655,3534719,3534847,3538943,3653631,3670015,3720767,3720831,3720895,3720959,3721023,3721087,3721151,3721215,3722815,3722879,3723007,3723071,3723135,3723263,3724991,3725055,3725247,3725311,3726911,3726975,3727103,3727359,3728959,3729023,3729215,3729279,3729343,3729407,3731007,3731071,3731263,3731327,3731455,3733055,3733311,3733439,3733503,3735551,3786303,3786367,3786431,3786495,3786559,3786623,3786687,3786751,3788351,3788415,3788543,3788607,3788671,3788799,3792447,3792511,3792639,3792895,3794495,3794559,3794751,3794815,3794879,3794943,3796543,3796607,3796799,3796863,3796991,3801087,3917375,3917439,3917503,3917567,3917631,3917695,3917759,3917823,3919423,3919487,3919615,3919679,3919743,3919871,3921471,3923519,3923583,3923711,3923967,3932159,3982911,3982975,3983039,3983103,3983167,3983231,3983295,3983359,3984959,3985023,3985151,3985215,3985279,3985407,3991103,3991167,3991359,3991423,3991487,3991551,3993151,3993215,3993407,3993471,3993599,3995199,3995455,3995583,3995647,3997695,4048447,4048511,4048575,4048639,4048703,4048767,4048831,4048895,4050495,4050559,4050687,4050751,4050815,4050943,4056639,4056703,4056895,4056959,4057023,4057087,4058687,4058751,4058943,4059007,4059135,4063231,4194303,7390783,7390847,7390911,7390975,7391039,7391103,7391167,7391231,7393023,7393087,7393151,7393279,7395007,7395071,7395263,7395327,7397119,7397375,7398975,7399039,7399231,7399295,7399359,7399423,7401023,7401087,7401279,7401343,7401471,7403071,7403327,7403455,7403519,7405567,7456575,7456639,7456703,7456767,7458815,7462911,7464511,7464575,7464767,7464831,7464895,7464959,7466559,7466623,7466815,7466879,7467007,7471103,7602175,7864319,7915071,7915135,7915199,7915263,7915327,7915391,7915455,7915519,7917119,7917183,7917311,7917375,7917439,7917567,7919295,7919359,7919551,7919615,7921215,7921279,7921407,7921663,7923263,7923327,7923519,7923583,7923647,7923711,7925311,7925375,7925567,7925631,7925759,7927359,7927615,7927743,7927807,7929855,7980607,7980671,7980735,7980799,7980863,7980927,7980991,7981055,7982655,7982719,7982847,7982911,7982975,7983103,7986751,7986815,7986943,7987199,7988799,7988863,7989055,7989119,7989183,7989247,7990847,7990911,7991103,7991167,7991295,7995391,8046143,8046207,8046271,8046335,8046399,8046463,8046527,8046591,8050239,8111679,8111743,8111807,8111871,8111935,8111999,8112063,8112127,8113727,8113791,8113919,8113983,8114047,8114175,8115775,8117823,8117887,8118015,8118271,8126463,8388607,16777215};
template<typename T>
inline constexpr bool chmin(T &mn,const T &cnt){if(mn>cnt){mn=cnt;return 1;}else return 0;}
int main(){
    each(i,s)s.insert(reverse(i));
    ll a[25];
    rep(i,0,25)cin>>a[i];
    ll sum=0,ans=1e18;
    rep(i,0,25)sum+=a[i];
    each(i,s){
        ll cnt=0;
        rep(j,0,25)if((i>>j)&1)cnt+=a[j];
        chmin(ans,abs(sum-cnt*2));
    }
    cout<<ans<<endl;
}
0