decode.in
HPC
PJVYMIY
BLMRGJIASOPZEFDCKWYHUNXQTV
decode.out
ACM
CONTEST
decode.in
FDY
GAI
BG
UKMY
KIMHOTSQYRLCUZPAGWJNBVDXEF
decode.out
THE
SKY
IS
BLUE

program decode;
var
s:ansistring;
a:array[0..27]of char;
i,j:longint;
begin
assign(input,'decode.in');
reset(input);
assign(output,'decode.out');
rewrite(output);
for i:=1 to 26 do
for i:=1 to length(s) do
if (s[i]=' ') then
begin
write(' ');
end
else
begin
j:=ord(s[i])-64;
write(a[j]);
end;
writeln;
close(input);
close(output);
end.


Monday-Saturday Number，也就是可以表示成7N+1 或7N+6 的数(N>=0)。那么Monday-Saturday Prime

27 是一个Monday-Saturday Prime，但216 就不是，因为216=8×27，216 包含除1 和216 以外的
Monday-Saturday Number 的因数。现在小s 想知道，对于一个Monday-Saturday Number M，它能被哪

prime.in
205920
prime.out
205920: 6 8 13 15 20 22 55 99
prime.in
8
prime.out
-1
2
prime.in
262144
prime.out
262144: 8

40% M<=1000
100% 1<=M<=3000000

program prime;
const
sum=317246;
p:array[1..sum]of longint=(6,8,13,15,20,22,27,29,34,41,
43,50,55,57,62,69,71,76,83,85,
92,97,99,106,111,113,118,125,127,134,
139,141,146,148,153,155,167,181,183,188,
190,197,202,209,211,218,223,230,237,239,
244,251,253,265,267,274,279,281,293,295,
302,307,309,314,316,321,323,335,337,349,
356,358,363,365,370,379,386,391,393,398,
407,412,419,421,428,433,447,449,454,461,
463,470,475,477,482,489,491,503,505,517,
519,524,526,531,538,545,547,554,561,566,
573,575,587,589,596,601,603,610,617,622,
629,631,643,652,657,659,671,673,685,687,
692,694,699,701,706,713,722,727,734,743,
755,757,764,769,771,778,785,790,797,799,
811,813,818,827,839,853,862,867,869,874,
881,883,890,895,909,911,916,925,932,937,
939,951,953,958,965,967,974,979,981,993,
995,1007,1009,1021,1023,1028,1030,1037,1042,1049,
1051,1058,1063,1070,1077,1084,1091,1093,1114,1119,
1121,1126,1133,1135,1142,1147,1149,1154,1163,1175,
1177,1191,1198,1203,1205,1217,1219,1226,1231,1233,
1238,1252,1259,1268,1273,1282,1289,1294,1301,1303,
1310,1315,1317,1322,1324,1329,1331,1343,1345,1357,
1359,1366,1371,1373,1385,1387,1399,1401,1406,1413,
1415,1427,1429,1436,1441,1457,1471,1478,1483,1490,
1492,1497,1499,1511,1513,1525,1527,1532,1541,1546,
1553,1555,1567,1569,1574,1581,1583,1588,1597,1604,
1609,1611,1618,1623,1630,1637,1639,1646,1658,1667,
1679,1693,1702,1707,1709,1714,1721,1723,1730,1735,
1737,1749,1751,1756,1765,1772,1777,1779,1786,1791,
1793,1805,1814,1819,1821,1828,1835,1847,1861,1868,
1877,1882,1889,1891,1903,1910,1919,1931,1933,1945,
1947,1954,1959,1961,1966,1973,1975,1982,1987,1994,
1996,2003,2017,2029,2031,2036,2038,2043,2045,2057,
2066,2071,2073,2078,2087,2092,2099,2101,2113,2122,
2127,2129,2141,2143,2155,2157,2162,2164,2169,2183,
2185,2199,2206,2211,2213,2218,2225,2227,2234,2239,
2246,2253,2267,2269,2276,2281,2283,2290,2297,2302,
2309,2311,2318,2323,2330,2339,2351,2367,2372,2374,
2381,2386,2393,2395,2402,2409,2421,2423,2428,2435,
2437,2449,2458,2463,2477,2479,2491,2493,2498,2507,
2519,2521,2533,2547,2549,2554,2563,2570,2575,2577,
2582,2589,2591,2603,2605,2612,2617,2631,2633,2638,
2645,2647,2654,2659,2661,2675,2687,2689,2701,2703,
2708,2710,2722,2729,2731,2738,2757,2759,2764,2771,
2773,2785,2787,2799,2801,2806,2815,2827,2836,2841,
2843,2855,2857,2869,2876,2878,2883,2885,2897,2906,
2913,2918,2927,2932,2939,2941,2953,2962,2969,2974,
2981,2983,2995,3002,3004,3009,3011,3023,3037,3039,
3044,3046,3065,3067,3079,3086,3093,3095,3109,3121,
3123,3130,3137,3142,3149,3151,3158,3163,3170,3177,
3179,3191,3193,3205,3207,3214,3221,3226,3233,3235,
3242,3247,3254,3261,3275,3284,3291,3303,3305,3310,
3317,3319,3326,3331,3333,3338,3347,3359,3361,3373,
3382,3387,3389,3394,3401,3415,3417,3431,3436,3443,
3452,3457,3459,3466,3473,3478,3487,3494,3499,3501,
3506,3508,3513,3515,3527,3529,3541,3543,3548,3557,
3571,3578,3583,3590,3597,3599,3611,3613,3634,3639,
3641,3646,3662,3667,3669,3676,3681,3695,3697,3709,
3711,3716,3723,3725,3730,3737,3739,3746,3751,3758,
3767,3779,3781,3788,3793,3802,3814,3821,3823,3830,
3837,3849,3851,3863,3865,3877,3879,3884,3891,3893,
3898,3907,3914,3919,3921,3935,3947,3949,3961,3963,
3970,3989,3998,4003,4010,4019,4033,4045,4052,4054,
4061,4066,4073,4075,4087,4094,4101,4103,4115,4117,
4124,4129,4138,4143,4145,4157,4159,4166,4178,4187,
4201,4213,4222,4227,4229,4241,4243,4255,4262,4269,
4271,4276,4283,4285,4297,4299,4306,4311,4313,4325,
4327,4339,4341,4348,4353,4367,4369,4383,4388,4390,
4397,4409,4411,4418,4423,4430,4439,4451,4453,4465,
4467,4474,4479,4481,4486,4493,4502,4507,4514,4516,
4521,4523,4535,4549,4570,4577,4579,4586,4591,4593,
4607,4612,4619,4621,4647,4649,4661,4663,4670,4677,
4682,4684,4689,4691,4703,4705,4717,4724,4733,4738,
4747,4754,4759,4766,4775,4787,4789,4801,4803,4817,
4822,4829,4831,4852,4857,4871,4873,4885,4892,4894,
4913,4915,4922,4929,4934,4943,4948,4955,4957,4969,
4971,4978,4983,4985,4990,4997,4999,5006,5011,5013,
5027,5039,5053,5062,5067,5069,5081,5090,5095,5097,
5102,5111,5116,5123,5132,5137,5139,5151,5153,5158,
5165,5167,5179,5181,5186,5188,5193,5195,5209,5221,
5223,5228,5230,5237,5242,5251,5263,5277,5279,5284,
5293,5305,5314,5321,5326,5333,5342,5347,5349,5354,
5361,5363,5377,5389,5391,5398,5403,5405,5410,5417,
5419,5426,5431,5433,5438,5459,5468,5482,5487,5489,
5501,5503,5515,5517,5524,5531,5543,5545,5557,5559,
5571,5573,5578,5585,5587,5594,5599,5601,5606,5613,
5615,5627,5636,5641,5657,5662,5669,5671,5683,5690,
5692,5711,5725,5732,5734,5739,5741,5753,5755,5767,
5769,5774,5783,5788,5795,5797,5804,5809,5818,5823,
5825,5839,5846,5851,5853,5867,5879,5881,5907,5909,
5914,5921,5923,5930,5935,5937,5942,5949,5951,5956,
5963,5965,5972,5979,5991,5998,6005,6007,6026,6033,
6047,6049,6070,6077,6082,6089,6091,6098,6103,6117,
6124,6131,6133,6145,6147,6159,6161,6166,6173,6187,
6189,6194,6196,6203,6217,6229,6231,6236,6238,6243,
6245,6257,6259,6271,6287,6299,6301,6313,6329,6334,
6341,6343,6362,6369,6371,6385,6397,6404,6406,6411,
6413,6418,6425,6427,6434,6439,6455,6469,6476,6481,
6483,6497,6502,6509,6511,6518,6523,6530,6537,6551,
6553,6567,6574,6581,6586,6593,6595,6602,6607,6609,
6614,6621,6623,6628,6635,6637,6649,6651,6658,6663,
6677,6679,6686,6691,6707,6719,6733,6742,6749,6761,
6763,6770,6775,6782,6789,6791,6796,6803,6805,6817,
6819,6826,6833,6845,6854,6859,6861,6866,6901,6910,
6917,6922,6938,6943,6957,6959,6964,6971,6973,6987,
6999,7001,7013,7015,7022,7027,7034,7036,7041,7043,
7057,7069,7071,7078,7083,7090,7097,7099,7113,7118,
7127,7132,7139,7141,7148,7153,7162,7167,7169,7183,
7190,7195,7197,7204,7211,7223,7237,7244,7246,7251,
7253,7258,7265,7274,7281,7286,7295,7307,7309,7321,
7323,7330,7342,7349,7351,7363,7377,7379,7391,7393,
7405,7407,7419,7426,7433,7435,7442,7447,7454,7461,
7463,7468,7477,7484,7489,7491,7498,7505,7510,7517,
7519,7531,7538,7547,7559,7561,7573,7589,7594,7601,
7603,7610,7615,7617,7622,7629,7643,7652,7666,7671,
7673,7687,7694,7699,7701,7706,7713,7715,7727,7729,
7741,7757,7762,7769,7771,7778,7799,7804,7811,7825,
7827,7834,7841,7846,7853,7855,7862,7867,7883,7895,
7897,7909,7916,7918,7925,7937,7939,7951,7953,7958,
7967,7972,7979,7981,7988,7993,8002,8007,8009,8014,
8035,8042,8044,8049,8063,8065,8079,8093,8098,8105,
8107,8114,8119,8121,8133,8135,8147,8156,8161,8163,
8182,8189,8191,8198,8210,8212,8219,8231,8233,8247,
8252,8254,8259,8261,8266,8273,8275,8287,8301,8303,
8315,8317,8324,8329,8331,8345,8357,8366,8371,8373,
8387,8399,8401,8413,8422,8427,8429,8434,8441,8443,
8455,8457,8462,8469,8483,8485,8499,8506,8511,8513,
8518,8527,8539,8546,8548,8553,8581,8583,8590,8597,
8609,8611,8623,8630,8637,8639,8644,8653,8665,8674,
8679,8681,8693,8695,8702,8707,8709,8714,8716,8735,
8737,8751,8765,8770,8777,8779,8786,8791,8793,8807,
8812,8819,8821,8828,8833,8842,8847,8849,8854,8861,
8863,8870,8877,8882,8884,8889,8891,8917,8919,8926,
8933,8945,8947,8959,8966,8973,8975,8989,9001,9003,
9029,9031,9038,9043,9057,9059,9071,9085,9092,9094,
9101,9115,9122,9127,9129,9134,9141,9148,9155,9157,
9169,9171,9183,9190,9197,9199,9206,9211,9227,9239,
9241,9253,9267,9274,9281,9283,9290,9297,9302,9311,
9323,9325,9332,9337,9339,9346,9351,9353,9358,9365,
9381,9388,9393,9395,9407,9421,9428,9437,9442,9449,
9458,9463,9470,9479,9484,9491,9493,9505,9507,9521,
9533,9535,9547,9549,9556,9561,9563,9575,9577,9596,
9598,9617,9619,9626,9631,9638,9647,9661,9668,9673,
9682,9687,9689,9694,9701,9703,9710,9722,9731,9743,
9745,9757,9759,9764,9766,9771,9778,9785,9787,9806,
9813,9827,9829,9836,9843,9857,9862,9871,9883,9892,
9897,9899,9911,9913,9925,9927,9934,9939,9941,9946,
9953,9967,9969,9974,9981,9983,9995,10009,10018,10025,
10037,10039,10046,10051,10053,10058,10067,10079,10081,10093,
10102,10107,10109,10123,10130,10135,10137,10149,10151,10156,
10163,10165,10172,10177,10193,10198,10207,10214,10219,10221,
10226,10228,10235,10247,10249,10261,10263,10289,10298,10303,
10310,10319,10331,10333,10345,10347,10359,10389,10394,10401,
10403,10415,10417,10429,10436,10443,10445,10457,10459,10466,
10471,10473,10487,10499,10501,10513,10522,10529,10534,10555,
10562,10571,10583,10597,10599,10606,10613,10618,10627,10639,
10641,10646,10653,10655,10667,10669,10681,10683,10690,10697,
10702,10709,10711,10718,10723,10732,10737,10739,10753,10765,
10772,10774,10779,10781,10786,10807,10809,10814,10821,10823,
10828,10837,10844,10849,10851,10858,10870,10877,10886,10891,
10893,10898,10919,10921,10942,10949,10954,10963,10970,10975,
10977,10996,11003,11012,11017,11019,11026,11031,11033,11038,
11045,11047,11054,11059,11061,11068,11073,11075,11087,11101,
11103,11108,11117,11129,11131,11138,11143,11157,11159,11164,
11171,11173,11185,11199,11201,11213,11215,11227,11241,11243,
11255,11257,11269,11276,11278,11283,11285,11290,11299,11306,
11311,11318,11327,11332,11341,11348,11353,11369,11381,11383,
11402,11404,11409,11411,11423,11425,11437,11444,11451,11465,
11467,11474,11486,11493,11507,11509,11516,11530,11549,11551,
11558,11563,11577,11579,11591,11593,11607,11612,11614,11619,
11621,11626,11633,11642,11647,11649,11654,11663,11668,11675,
11677,11689,11698,11705,11710,11717,11719,11731,11733,11738,
11747,11759,11761,11773,11787,11789,11794,11801,11810,11822,
11829,11831,11845,11852,11859,11871,11873,11878,11885,11887,
11894,11899,11901,11906,11915,11927,11929,11941,11943,11957,
11962,11969,11971,11983,12004,12011,12039,12041,12046,12053,
12055,12062,12067,12074,12076,12081,12097,12109,12111,12130,
12137,12139,12146,12153,12158,12167,12179,12193,12202,12221,
12223,12230,12235,12237,12242,12244,12249,12251,12263,12277,
12279,12286,12291,12293,12305,12307,12314,12326,12333,12335,
12347,12349,12356,12361,12370,12377,12391,12398,12403,12417,
12419,12431,12433,12445,12459,12461,12466,12473,12475,12482,
12487,12494,12503,12515,12517,12529,12531,12538,12559,12566,
12578,12601,12613,12622,12629,12634,12641,12643,12655,12657,
12671,12676,12683,12697,12706,12713,12718,12725,12734,12739,
12741,12746,12748,12755,12767,12781,12783,12790,12797,12802,
12809,12811,12823,12830,12837,12839,12853,12867,12881,12893,
12895,12902,12907,12916,12921,12923,12937,12949,12951,12965,
12970,12977,12979,12991,13007,13012,13019,13028,13033,13042,
13047,13049,13054,13061,13063,13070,13075,13077,13084,13089,
13103,13105,13119,13126,13131,13133,13138,13147,13154,13159,
13173,13187,13189,13196,13210,13217,13229,13231,13238,13252,
13259,13271,13285,13292,13301,13306,13313,13315,13322,13327,
13329,13341,13343,13355,13357,13371,13378,13383,13385,13397,
13399,13406,13411,13413,13418,13439,13441,13453,13467,13469,
13474,13495,13497,13511,13523,13525,13537,13539,13551,13553,
13558,13565,13567,13579,13586,13595,13607,13609,13621,13628,
13642,13649,13651,13658,13670,13679,13691,13693,13705,13707,
13714,13719,13721,13726,13733,13742,13747,13749,13763,13777,
13789,13791,13796,13798,13810,13831,13847,13852,13859,13868,
13873,13887,13894,13901,13903,13917,13922,13929,13931,13943,
13945,13957,13964,13966,13971,13973,13985,13994,13999,14006,
14015,14029,14041,14043,14057,14062,14069,14071,14078,14083,
14090,14099,14111,14113,14127,14132,14134,14139,14141,14153,
14155,14167,14169,14174,14188,14197,14211,14218,14223,14225,
14230,14237,14251,14253,14258,14267,14279,14281,14293,14302,
14321,14323,14330,14335,14349,14363,14372,14377,14379,14386,
14393,14398,14407,14414,14419,14426,14428,14433,14435,14447,
14449,14461,14463,14468,14470,14477,14489,14503,14510,14517,
14519,14524,14531,14533,14545,14554,14561,14566,14582,14589,
14594,14601,14603,14615,14617,14629,14631,14636,14643,14657,
14659,14666,14671,14673,14687,14692,14699,14701,14708,14713,
14727,14741,14743,14757,14764,14771,14783,14785,14797,14799,
14804,14811,14813,14825,14827,14834,14853,14855,14867,14869,
14876,14881,14890,14897,14902,14909,14918,14923,14930,14932,
14939,14951,14953,14967,14974,14979,14995,15009,15014,15021,
15037,15044,15049,15058,15063,15065,15077,15079,15086,15091,
15098,15107,15121,15133,15149,15154,15161,15163,15175,15177,
15182,15191,15203,15205,15212,15217,15226,15231,15233,15238,
15245,15247,15259,15261,15273,15287,15289,15303,15310,15317,
15322,15329,15331,15338,15343,15357,15359,15371,15373,15401,
15406,15413,15415,15427,15434,15441,15443,15469,15485,15490,
15497,15499,15506,15511,15513,15518,15527,15541,15553,15567,
15569,15581,15583,15590,15595,15597,15611,15623,15637,15644,
15646,15653,15658,15667,15679,15681,15693,15709,15716,15721,
15723,15737,15749,15751,15758,15763,15772,15777,15779,15791,
15793,15807,15814,15819,15835,15842,15854,15861,15868,15877,
15889,15891,15898,15905,15917,15919,15926,15931,15947,15959,
15961,15973,15982,15987,15989,16001,16010,16015,16022,16043,
16045,16052,16057,16059,16071,16073,16078,16085,16087,16099,
16101,16106,16108,16127,16141,16143,16157,16162,16169,16171,
16178,16183,16190,16197,16204,16213,16234,16239,16241,16246,
16253,16255,16262,16267,16274,16283,16295,16309,16311,16316,
16323,16325,16337,16339,16358,16372,16379,16381,16407,16409,
16421,16423,16435,16437,16442,16444,16449,16451,16463,16465,
16477,16479,16486,16493,16505,16507,16514,16519,16521,16526,
16535,16547,16556,16561,16563,16570,16577,16582,16589,16591,
16603,16612,16619,16631,16633,16645,16647,16661,16673,16682,
16689,16703,16708,16715,16717,16729,16738,16743,16759,16771,
16773,16778,16787,16799,16801,16829,16834,16841,16843,16855,
16857,16862,16869,16871,16876,16883,16897,16906,16911,16925,
16927,16934,16941,16946,16953,16955,16967,16981,16990,16997,
17002,17009,17011,17039,17044,17051,17053,17065,17067,17074,
17079,17086,17093,17107,17109,17123,17135,17137,17149,17151,
17156,17158,17163,17165,17177,17191,17193,17198,17207,17219,
17221,17233,17242,17247,17249,17254,17263,17275,17282,17291,
17305,17317,17326,17331,17333,17338,17345,17354,17359,17366,
17373,17387,17389,17396,17401,17403,17410,17417,17431,17438,
17443,17452,17471,17473,17492,17494,17506,17522,17527,17529,
17541,17543,17555,17564,17569,17571,17583,17585,17590,17597,
17599,17606,17611,17618,17627,17639,17662,17669,17674,17681,
17683,17695,17697,17709,17711,17723,17725,17737,17746,17767,
17774,17779,17781,17786,17788,17795,17807,17809,17828,17830,
17837,17851,17858,17863,17870,17877,17879,17891,17905,17921,
17926,17933,17942,17947,17949,17954,17961,17975,17977,17989,
17991,17998,18003,18010,18019,18026,18033,18047,18052,18059,
18061,18068,18073,18082,18087,18089,18101,18110,18115,18129,
18131,18143,18145,18157,18159,18173,18178,18185,18199,18201,
18206,18215,18227,18229,18243,18257,18262,18269,18271,18283,
18311,18313,18325,18332,18334,18339,18341,18346,18353,18355,
18362,18367,18374,18381,18383,18388,18397,18418,18437,18439,
18446,18451,18453,18467,18479,18481,18493,18507,18514,18521,
18523,18556,18563,18565,18572,18579,18586,18591,18593,18605,
18607,18621,18628,18633,18635,18649,18661,18663,18670,18677,
18682,18689,18691,18698,18703,18710,18717,18719,18731,18745,
18747,18754,18761,18773,18775,18782,18787,18789,18794,18801,
18803,18817,18829,18831,18838,18843,18845,18857,18859,18866,
18878,18887,18892,18899,18913,18922,18929,18934,18943,18962,
18969,18971,18985,18997,18999,19004,19011,19013,19018,19025,
19027,19039,19041,19046,19055,19067,19069,19081,19083,19102,
19130,19132,19137,19139,19151,19153,19165,19167,19172,19174,
19179,19181,19193,19202,19207,19223,19235,19237,19249,19258,
19263,19265,19277,19286,19291,19293,19298,19319,19333,19342,
19347,19349,19354,19361,19363,19377,19391,19403,19405,19417,
19419,19433,19438,19445,19447,19466,19473,19489,19501,19508,
19510,19529,19531,19538,19543,19559,19571,19573,19585,19587,
19601,19606,19613,19615,19622,19627,19634,19636,19641,19655,
19657,19676,19678,19697,19699,19711,19713,19718,19727,19732,
19739,19741,19748,19753,19767,19769,19774,19781,19783,19790,
19795,19797,19802,19804,19811,19839,19846,19853,19858,19867,
19874,19879,19886,19895,19907,19921,19930,19937,19949,19963,
19970,19972,19977,19979,19991,19993,20005,20012,20014,20019,
20021,20035,20047,20054,20063,20077,20084,20089,20103,20105,
20110,20117,20119,20133,20138,20147,20159,20161,20173,20182,
20187,20194,20201,20203,20222,20229,20231,20236,20243,20245,
20257,20259,20266,20278,20285,20287,20299,20301,20308,20327,
20341,20343,20348,20357,20362,20369,20378,20383,20390,20399,
20404,20411,20413,20427,20441,20446,20455,20469,20476,20481,
20483,20495,20497,20509,20518,20523,20525,20530,20537,20539,
20546,20551,20558,20567,20581,20588,20593,20602,20607,20609,
20621,20630,20635,20637,20642,20649,20651,20663,20665,20684,
20686,20693,20698,20707,20714,20719,20721,20733,20747,20749,
20756,20777,20782,20789,20791,20798,20810,20819,20831,20847,
20854,20859,20861,20866,20873,20887,20901,20903,20908,20915,
20924,20929,20931,20957,20959,20971,20973,20987,21001,21013,
21022,21029,21041,21043,21055,21057,21062,21069,21071,21085,
21092,21097,21106,21111,21118,21127,21134,21139,21153,21155,
21167,21169,21181,21188,21202,21211,21218,21223,21237,21239,
21251,21253,21265,21293,21295,21302,21309,21314,21323,21337,
21349,21351,21363,21365,21370,21377,21379,21391,21393,21407,
21419,21421,21433,21447,21449,21461,21475,21477,21482,21491,
21503,21517,21524,21526,21531,21533,21559,21561,21575,21587,
21589,21596,21601,21610,21617,21622,21643,21652,21657,21659,
21673,21685,21687,21694,21699,21701,21706,21713,21722,21727,
21729,21734,21741,21743,21748,21755,21757,21764,21769,21778,
21783,21785,21790,21799,21806,21811,21813,21818,21839,21841,
21869,21874,21881,21883,21902,21909,21911,21916,21923,21925,
21932,21937,21946,21958,21965,21967,21974,21979,21981,21986,
21993,22007,22021,22023,22028,22030,22037,22042,22049,22051,
22063,22070,22079,22084,22091,22093,22105,22107,22114,22119,
22121,22133,22135,22142,22147,22163,22175,22177,22189,22203,
22205,22210,22219,22226,22233,22238,22247,22252,22259,22273,
22289,22303,22315,22322,22324,22331,22343,22357,22364,22371,
22387,22394,22413,22415,22429,22441,22443,22457,22469,22471,
22478,22483,22492,22497,22499,22511,22513,22527,22534,22539,
22541,22546,22553,22567,22569,22574,22583,22588,22595,22597,
22604,22609,22611,22623,22637,22639,22651,22658,22667,22679,
22681,22693,22702,22709,22721,22723,22730,22735,22749,22751,
22756,22772,22777,22779,22786,22793,22798,22805,22807,22819,
22821,22835,22847,22849,22861,22863,22868,22870,22877,22889,
22891,22898,22903,22917,22931,22947,22954,22959,22961,22966,
22973,22975,22982,22994,22996,23003,23015,23017,23029,23038,
23043,23057,23059,23066,23071,23073,23087,23099,23129,23141,
23143,23162,23164,23169,23185,23197,23204,23211,23225,23227,
23234,23239,23255,23267,23269,23281,23297,23302,23311,23318,
23330,23337,23339,23351,23353,23365,23367,23372,23379,23381,
23393,23395,23402,23407,23414,23423,23428,23437,23444,23449,
23451,23458,23470,23477,23479,23486,23507,23533,23542,23549,
23554,23561,23563,23570,23589,23591,23603,23605,23612,23619,
23626,23631,23633,23645,23654,23659,23666,23675,23687,23689,
23701,23703,23708,23710,23717,23729,23731,23743,23757,23759,
23771,23773,23794,23799,23801,23806,23813,23827,23857,23869,
23871,23878,23890,23897,23899,23906,23911,23913,23918,23939,
23941,23948,23953,23962,23967,23969,23974,23981,23990,23995,
24009,24023,24039,24044,24051,24053,24058,24065,24074,24079,
24086,24093,24095,24107,24109,24116,24121,24137,24142,24151,
24158,24163,24170,24172,24177,24179,24191,24205,24207,24212,
24214,24221,24226,24233,24235,24247,24249,24261,24263,24268,
24275,24277,24289,24291,24298,24303,24305,24317,24326,24333,
24359,24361,24373,24387,24394,24403,24410,24415,24417,24422,
24429,24431,24443,24445,24452,24457,24459,24471,24473,24478,
24487,24494,24499,24501,24506,24513,24515,24527,24529,24562,
24569,24571,24578,24590,24599,24604,24611,24613,24627,24646,
24653,24655,24667,24669,24683,24697,24709,24711,24730,24746,
24751,24758,24767,24781,24788,24793,24802,24807,24809,24814,
24821,24823,24835,24837,24842,24844,24851,24863,24865,24877,
24879,24884,24886,24891,24893,24907,24914,24919,24933,24935,
24949,24961,24963,24977,24982,24989,24991,25003,25017,25031,
25033,25045,25052,25054,25059,25061,25073,25082,25087,25089,
25094,25101,25108,25115,25117,25131,25138,25145,25157,25166,
25171,25173,25178,25187,25213,25222,25227,25229,25243,25255,
25257,25269,25271,25283,25292,25306,25313,25318,25325,25339,
25341,25348,25367,25369,25381,25383,25390,25397,25409,25411,
25423,25430,25439,25444,25451,25453,25474,25486,25495,25507,
25509,25514,25516,25523,25535,25537,25556,25563,25565,25570,
25577,25579,25591,25598,25619,25621,25633,25642,25661,25663,
25682,25684,25689,25691,25703,25717,25719,25726,25733,25745,
25747,25754,25759,25761,25775,25787,25796,25801,25817,25822,
25829,25838,25859,25873,25887,25892,25901,25906,25913,25927,
25934,25941,25943,25957,25964,25969,25971,25983,25985,25997,
25999,26006,26011,26018,26027,26041,26053,26067,26069,26074,
26081,26083,26090,26097,26111,26116,26123,26137,26139,26153,
26165,26167,26174,26179,26181,26186,26188,26193,26207,26209,
26223,26237,26242,26249,26251,26258,26263,26279,26284,26291,
26293,26305,26319,26321,26326,26333,26335,26342,26347,26349,
26354,26389,26396,26405,26417,26431,26438,26447,26459,26461,
26473,26482,26489,26501,26503,26515,26517,26522,26545,26557,
26566,26571,26573,26587,26594,26599,26601,26613,26615,26627,
26629,26636,26641,26657,26662,26669,26671,26678,26683,26692,
26697,26699,26711,26713,26725,26727,26734,26739,26753,26755,
26762,26769,26783,26795,26804,26823,26830,26837,26839,26851,
26853,26867,26879,26881,26893,26902,26907,26914,26921,26930,
26935,26942,26951,26963,26965,26977,26986,26991,26993,26998,
27021,27026,27033,27035,27049,27061,27070,27077,27089,27091,
27103,27110,27119,27124,27145,27147,27154,27159,27161,27175,
27182,27187,27194,27201,27203,27215,27217,27229,27238,27245,
27259,27266,27271,27273,27278,27292,27299,27301,27308,27322,
27327,27329,27334,27341,27343,27355,27357,27362,27364,27369,
27371,27385,27397,27399,27411,27413,27418,27425,27427,27439,
27441,27446,27453,27467,27476,27481,27483,27490,27497,27502,
27509,27518,27523,27530,27532,27537,27539,27551,27553,27565,
27581,27595,27602,27607,27609,27614,27623,27628,27635,27644,
27658,27663,27670,27679,27691,27707,27719,27721,27733,27747,
27749,27754,27763,27770,27789,27791,27796,27803,27817,27826,
27831,27845,27847,27854,27866,27868,27887,27901,27908,27910,
27917,27922,27929,27931,27938,27943,27957,27959,27964,27973,
27994,28001,28013,28022,28027,28029,28034,28057,28069,28071,
28076,28097,28099,28111,28113,28127,28139,28141,28153,28162,
28169,28174,28181,28183,28190,28195,28209,28211,28225,28237,
28239,28253,28265,28267,28279,28281,28286,28293,28295,28307,
28309,28316,28330,28342,28349,28351,28370,28393,28407,28412,
28414,28419,28426,28433,28442,28447,28461,28463,28477,28484,
28489,28491,28498,28503,28505,28510,28517,28519,28531,28533,
28538,28547,28559,28573,28601,28603,28610,28617,28629,28631,
28636,28643,28657,28673,28685,28687,28694,28699,28708,28713,
28715,28727,28729,28748,28757,28771,28778,28783,28790,28799,
28811,28813,28825,28827,28839,28841,28846,28862,28867,28869,
28874,28876,28881,28883,28895,28909,28916,28918,28923,28937,
28953,28958,28972,28979,28981,28988,28993,29009,29014,29021,
29023,29030,29035,29037,29063,29065,29077,29086,29091,29093,
29098,29105,29114,29119,29121,29126,29135,29147,29149,29161,
29163,29170,29177,29182,29189,29191,29217,29219,29231,29245,
29247,29254,29259,29266,29273,29275,29287,29301,29303,29317,
29324,29331,29338,29343,29345,29357,29359,29366,29371,29373,
29378,29387,29399,29401,29413,29422,29427,29429,29434,29441,
29443,29462,29476,29483,29485,29499,29506,29513,29518,29525,
29527,29534,29539,29553,29555,29567,29569,29581,29597,29611,
29623,29630,29639,29644,29651,29674,29681,29686,29693,29695,
29702,29707,29709,29721,29723,29735,29737,29758,29763,29765,
29777,29791,29793,29798,29819,29821,29828,29833,29847,29849,
29863,29903,29905,29917,29919,29924,29931,29933,29938,29947,
29959,29961,29966,29987,29989,29996,30001,30003,30010,30029,
30031,30038,30059,30071,30087,30092,30101,30106,30113,30115,
30122,30127,30148,30155,30157,30164,30169,30178,30183,30185,
30190,30197,30211,30239,30241,30253,30262,30269,30274,30281,
30283,30297,30309,30311,30323,30325,30332,30337,30339,30346,
30351,30365,30367,30374,30379,30386,30395,30409,30423,30428,
30437,30449,30451,30477,30484,30491,30493,30505,30507,30519,
30521,30526,30533,30542,30547,30549,30554,30556,30575,30577,
30596,30598,30603,30605,30610,30617,30619,30626,30631,30633,
30638,30647,30661,30673,30687,30689,30694,30701,30703,30715,
30717,30722,30724,30729,30731,30757,30759,30764,30766,30773,
30785,30787,30794,30799,30801,30813,30815,30829,30841,30857,
30869,30871,30878,30883,30890,30892,30897,30899,30911,30913,
30925,30934,30939,30941,30946,30967,30983,30995,31009,31011,
31039,31051,31053,31067,31079,31081,31093,31102,31107,31114,
31121,31123,31142,31149,31151,31156,31163,31165,31172,31177,
31193,31198,31205,31207,31214,31219,31221,31235,31247,31249,
31263,31268,31277,31282,31289,31298,31303,31319,31333,31345,
31354,31359,31361,31366,31373,31387,31389,31403,31415,31417,
31429,31431,31445,31459,31466,31471,31478,31487,31492,31501,
31508,31513,31522,31534,31541,31543,31555,31557,31569,31571,
31583,31585,31597,31599,31604,31606,31613,31618,31627,31634,
31641,31646,31653,31667,31669,31676,31683,31690,31709,31711,
31718,31723,31732,31739,31751,31765,31767,31774,31781,31786,
31793,31795,31802,31807,31814,31821,31823,31835,31849,31851,
31865,31870,31886,31891,31893,31907,31919,31921,31933,31942,
31961,31963,31975,31982,31989,31991,32003,32005,32017,32031,
32033,32047,32059,32061,32066,32068,32073,32075,32087,32089,
32101,32117,32122,32129,32138,32143,32159,32171,32173,32187,
32194,32199,32206,32213,32222,32229,32236,32241,32243,32255,
32257,32269,32271,32276,32278,32290,32297,32299,32311,32313,
32327,32339,32341,32348,32353,32367,32369,32374,32381,32397,
32404,32411,32423,32425,32437,32439,32444,32446,32458,32467,
32479,32486,32493,32507,32521,32530,32537,32549,32563,32570,
32577,32579,32593,32605,32607,32614,32621,32633,32635,32642,
32647,32649,32663,32668,32675,32684,32691,32698,32703,32710,
32717,32719,32726,32733,32738,32782,32787,32789,32794,32801,
32803,32815,32817,32822,32829,32831,32836,32843,32845,32866,
32871,32885,32887,32894,32901,32906,32927,32941,32948,32957,
32962,32969,32971,32983,32990,32997,32999,33011,33013,33025,
33027,33039,33041,33053,33062,33069,33074,33076,33081,33083,
33095,33097,33130,33139,33146,33151,33167,33172,33179,33181,
33188,33193,33207,33209,33214,33223,33230,33244,33249,33265,
33277,33279,33298,33305,33307,33314,33326,33347,33349,33361,
33377,33382,33389,33391,33398,33403,33412,33419,33431,33433,
33445,33447,33452,33461,33473,33482,33487,33494,33503,33508,
33515,33517,33529,33531,33543,33545,33557,33559,33571,33578,
33587,33599,33601,33613,33622,33627,33629,33641,33643,33662,
33671,33676,33685,33692,33697,33706,33711,33713,33718,33739,
33746,33753,33767,33769,33783,33788,33797,33802,33809,33811,
33818,33823,33837,33844,33851,33874,33881,33886,33893,33895,
33921,33923,33937,33949,33951,33958,33963,33965,33977,33979,
33986,33991,33998,34007,34019,34033,34042,34049,34054,34061,
34063,34070,34082,34084,34089,34091,34103,34105,34117,34131,
34145,34147,34154,34159,34161,34173,34175,34187,34189,34201,
34217,34231,34243,34252,34259,34273,34285,34287,34292,34301,
34313,34315,34322,34327,34329,34334,34341,34343,34355,34369,
34378,34383,34397,34406,34413,34418,34427,34439,34441,34453,
34462,34467,34469,34483,34490,34495,34497,34509,34511,34516,
34523,34525,34537,34546,34553,34558,34579,34581,34586,34588,
34607,34609,34621,34623,34630,34637,34642,34649,34651,34663,
34670,34677,34679,34693,34721,34733,34735,34747,34754,34756,
34761,34763,34789,34791,34796,34805,34817,34819,34831,34833,
34838,34847,34852,34859,34882,34901,34910,34915,34922,34924,
34929,34964,34966,34971,34978,34985,34987,34994,34999,35001,
35006,35013,35015,35027,35029,35041,35043,35057,35062,35069,
35071,35078,35083,35097,35099,35111,35132,35141,35146,35153,
35155,35162,35183,35195,35197,35209,35218,35223,35225,35239,
35246,35251,35253,35267,35279,35281,35302,35307,35309,35314,
35323,35330,35335,35337,35349,35356,35363,35377,35379,35393,
35407,35414,35419,35421,35426,35435,35447,35449,35461,35463,
35468,35470,35489,35491,35498,35517,35519,35531,35533,35545,
35566,35573,35575,35582,35587,35589,35601,35603,35617,35638,
35643,35645,35671,35678,35692,35701,35727,35729,35741,35743,
35755,35762,35764,35769,35771,35783,35797,35799,35804,35806,
35813,35818,35825,35827,35839,35846,35869,35876,35881,35897,
35909,35911,35918,35923,35930,35951,35953,35965,35974,35979,
35981,35986,35993,35995,36002,36007,36009,36021,36028,36035,
36037,36044,36063,36065,36070,36079,36086,36091,36093,36098,
36107,36119,36133,36147,36149,36154,36161,36170,36175,36177,
36182,36189,36191,36196,36217,36219,36233,36238,36247,36254,
36259,36266,36268,36275,36287,36289,36301,36303,36310,36317,
36329,36331,36338,36343,36357,36359,36364,36371,36373,36385,
36399,36401,36415,36422,36427,36429,36434,36436,36441,36443,
36455,36457,36469,36471,36483,36485,36497,36506,36513,36527,
36532,36539,36541,36548,36553,36574,36581,36583,36590,36597,
36602,36604,36609,36611,36623,36637,36644,36653,36658,36665,
36667,36681,36709,36721,36723,36730,36737,36742,36749,36758,
36770,36779,36791,36793,36807,36812,36814,36819,36821,36826,
36833,36847,36854,36861,36863,36877,36884,36889,36891,36898,
36903,36910,36919,36926,36931,36947,36961,36973,36987,36989,
37001,37003,37010,37022,37029,37031,37043,37057,37059,37073,
37078,37085,37087,37099,37106,37108,37127,37129,37143,37157,
37169,37171,37183,37190,37197,37199,37213,37225,37227,37234,
37239,37253,37255,37274,37276,37283,37295,37309,37311,37318,
37325,37330,37337,37339,37353,37358,37372,37379,37393,37402,
37409,37421,37423,37435,37437,37451,37463,37477,37484,37486,
37491,37493,37498,37507,37514,37519,37533,37535,37547,37549,
37561,37577,37589,37591,37603,37610,37612,37617,37619,37631,
37633,37645,37652,37659,37666,37673,37689,37694,37703,37715,
37717,37724,37731,37738,37745,37757,37759,37766,37771,37799,
37801,37813,37822,37834,37841,37857,37871,37885,37892,37897,
37899,37911,37913,37918,37939,37941,37946,37953,37955,37967,
37981,37983,37988,37997,38002,38009,38011,38018,38023,38030,
38037,38039,38044,38053,38065,38067,38074,38079,38093,38095,
38102,38107,38109,38123,38137,38149,38156,38158,38163,38177,
38179,38186,38219,38221,38242,38249,38261,38275,38277,38282,
38289,38291,38303,38305,38317,38319,38326,38331,38333,38345,
38347,38359,38366,38373,38387,38401,38422,38431,38438,38443,
38452,38457,38459,38471,38473,38487,38492,38494,38501,38513,
38515,38527,38534,38543,38557,38569,38578,38585,38611,38618,
38627,38639,38641,38653,38667,38669,38674,38681,38683,38697,
38702,38711,38716,38723,38725,38737,38746,38751,38758,38765,
38767,38774,38788,38793,38795,38807,38821,38823,38842,38849,
38851,38858,38863,38877,38879,38884,38891,38893,38914,38919,
38921,38926,38933,38942,38949,38954,38956,38963,38975,38977,
38996,39003,39017,39019,39031,39033,39038,39047,39061,39068,
39082,39089,39101,39103,39110,39115,39124,39129,39131,39145,
39157,39164,39166,39171,39178,39187,39194,39199,39201,39206,
39213,39227,39229,39241,39257,39269,39271,39283,39290,39297,
39311,39313,39327,39332,39341,39346,39362,39367,39369,39374,
39381,39383,39395,39397,39404,39409,39418,39423,39430,39439,
39451,39453,39467,39493,39502,39509,39514,39521,39523,39535,
39549,39551,39563,39577,39586,39593,39605,39607,39619,39626,
39628,39633,39635,39649,39661,39670,39677,39682,39691,39698,
39703,39719,39724,39731,39733,39745,39747,39761,39773,39782,
39787,39789,39796,39801,39803,39815,39829,39838,39857,39859,
39873,39887,39892,39899,39901,39922,39927,39929,39941,39943,
39955,39969,39971,39983,39997,39999,40011,40013,40025,40034,
40039,40046,40055,40067,40069,40081,40083,40097,40102,40109,
40111,40123,40130,40137,40151,40153,40167,40179,40181,40193,
40195,40202,40207,40214,40237,40244,40249,40251,40258,40263,
40265,40270,40277,40279,40286,40298,40307,40319,40321,40333,
40342,40347,40349,40354,40361,40382,40389,40396,40403,40405,
40412,40431,40433,40438,40445,40447,40459,40461,40466,40475,
40487,40489,40501,40510,40517,40522,40529,40531,40538,40543,
40557,40559,40564,40585,40594,40601,40606,40613,40615,40622,
40627,40636,40655,40657,40669,40671,40676,40685,40697,40699,
40706,40711,40718,40739,40741,40762,40769,40783,40790,40802,
40811,40823,40839,40844,40853,40867,40874,40879,40881,40886,
40895,40907,40909,40921,40923,40930,40949,40951,40958,40972,
40991,40993,41007,41012,41014,41033,41042,41047,41049,4

N=A+A 或是N=A+x+A，其中A 是一个回文拆分，x 是任意一个自然数，这两种也是回文拆分。举个例子，
7 的所有回文拆分有7,1+5+1,2+3+2,1+1+3+1+1,3+1+3,1+1+1+1+1+1+1。现在小s 想知道，一个正整数
N 的回文拆分到底有多少种。由于这个数字可能很大，小s 只需要你告诉她答案mod 1,000,000,007 的

palin.in
4
palin.out
4
palin.in
20
palin.out
2
60

20% 1<=N<=20
60% 1<=N<=1000
100% 1<=N<=100,000

var
f:array[0..300000]of int64;
i,j,n:longint;
begin
assign(input,'palin.in');reset(input);
assign(output,'palin.out');rewrite(output);
f[1]:=1;
f[2]:=2;
f[3]:=2;
for i:=4 to n do
begin
if (not odd(i)) then f[i]:=(f[i-2]+f[i div 2]) mod 1000000007
else f[i]:=f[i-1];
end;
writeln(f[n]);
close(input);close(output);
end.

span.in
4 5
1 2 3
1 3 5
1 4 6
2 4 6
3 4 7
span.out
1
span.in
2
5 10
1 2 9384
1 3 887
1 4 2778
1 5 6916
2 3 7794
2 4 8336
2 5 5387
3 4 493
3 5 6650
4 5 1422
span.out
1686

20% N<=10
100% 2<=N<=100,0<=M<=30

program span;
const
INF=20000000;
type
node=record
a,b,w:longint;
end;
var
e:array[0..3100] of node;
fa:array[0..110] of longint;
i,j,tot,n,m,ans,x,y,start:longint;
function min(a,b:longint):longint;
begin
if (a<b) then exit(a) else exit(b);
end;
procedure swap(var a,b:longint);
var
c:longint;
begin
c:=a;
a:=b;
b:=c;
end;
procedure sort(l,r:longint);
var
i,j,x:longint;
begin
i:=l;
j:=r;
x:=e[(l+r) shr 1].w;
repeat
while (e[i].w<x) do inc(i);
while (e[j].w>x) do dec(j);
if (i<=j) then
begin
swap(e[i].a,e[j].a);
swap(e[i].b,e[j].b);
swap(e[i].w,e[j].w);
inc(i);
dec(j);
end;
until i>j;
if (i<r) then sort(i,r);
if (l<j) then sort(l,j);
end;
function get(x:longint):longint;
begin
if (fa[x]=x) then exit(x);
fa[x]:=get(fa[x]);
exit(fa[x]);
end;
begin
assign(input,'span.in');reset(input);
assign(output,'span.out');rewrite(output);
for i:=1 to m do
begin
end;
sort(1,m);
ans:=INF;
for i:=1 to m-n+1 do
begin
for j:=1 to n do
fa[j]:=j;
tot:=0;
for j:=i to m do
begin
x:=get(e[j].a);
y:=get(e[j].b);
if (x<>y) then
begin
inc(tot);
fa[x]:=y;
if (tot=n-1) then ans:=min(ans,e[j].w-e[i].w);
end;
end;
end;
if (ans=INF) then writeln(-1) else
writeln(ans);
close(input);
close(output);
end.