### BITTIJONO (dt2k18) ###
# ok i know that's not a good answer. But it wurkz. And probably gives a few points
# lol main again :D
def main(n):
# just a random (mod'd, n-2) Fibonacci series to ease computation ;)
fib = [1, 3, 6, 11, 19, 32, 53, 87, 142, 231, 375, 608, 985, 1595, 2582, 4179, 6763, 10944,
17709, 28655, 46366, 75023, 121391, 196416, 317809, 514227, 832038, 1346267]
# just a random series :D
# i honestly apologize for this.
a = [0, 3, 2, 15, 4, 5, 8, 12, 13, 9, 10, 29, 27, 17, 25, 20, 18, 33, 21, 57, 40, 51, 34, 36, 44, 80, 38, 45, 41, 104, 72, 42, 88, 92, 100, 225, 70, 107, 76, 132, 105, 101, 73, 89, 84, 189, 82, 74, 161, 237, 142, 380, 85, 156, 209, 204, 145, 168, 185, 177, 217, 162, 205, 138, 164, 180, 148, 153, 146, 443, 178, 150, 154, 213, 273, 353, 181, 165, 169, 266, 369, 401, 328, 413, 324, 296, 170, 624, 276, 290, 274, 305, 313, 540, 292, 278, 409, 314, 282, 792, 373, 308, 300, 332, 337, 437, 294, 648, 306, 365, 532, 744, 405, 329, 361, 609, 297, 546, 345, 534, 340, 696, 580, 561, 538, 338, 330, 558, 298, 708, 616, 732, 793, 570, 664, 804, 556, 564, 604, 861, 550, 341, 668, 837, 566, 849, 562, 1274, 626, 612, 745, 588, 620, 1400, 593, 741, 709, 873, 697, 1070, 689, 1265, 805, 813, 674, 585, 614, 852, 821, 729, 554, 1268, 676, 717, 724, 660, 617, 1112, 596, 1304, 658, 1208, 722, 684, 586, 594, 1140, 1688, 602, 690, 598, 666, 1185, 618, 1122, 1757, 853, 1220, 1240, 1100, 1164, 1124, 1138, 1244, 725, 693, 677, 1673, 1180, 681, 1420, 1436, 1066, 2928, 1161, 1733, 1393, 1169, 1677, 1352, 1497, 2136, 1713, 1448, 1126, 3108, 1222, 1481, 1192, 1457, 682, 1589, 1396, 1715, 1233, 1298, 1108, 1421, 1201, 1442, 1162, 2232, 1098, 1337, 1684, 1106, 1372, 1316, 1210, 2316, 1114, 1460, 1110, 1394, 1188, 1172, 1306, 3171, 1258, 2328, 1225, 1130, 1170, 1388, 1452, 1433, 1332, 1493, 1236, 1397, 1426, 1196, 1707, 2640, 1174, 2268, 2284, 1361, 1242, 1178, 1234, 1202, 2150, 1709, 1330, 1190, 1701, 1685, 2626, 1226, 1705, 2844, 1461, 2736, 1453, 3153, 1317, 3180, 1621, 1445, 1353, 2829, 1449, 3789, 1321, 1385, 2456, 3513, 1429, 1193, 1381, 2502, 2138, 3432, 1369, 2754, 2257, 2802, 2252, 1364, 2210, 2508, 2417, 2376, 3149, 3240, 2344, 3483, 2617, 2154, 2234, 2673, 1362, 2805, 1354, 1322, 2212, 3219, 3161, 2322, 1194, 2664, 2449, 2472, 2194, 2721, 2420, 4316, 2228, 2964, 2353, 2850, 2282, 2481, 2908, 2505, 2612, 2676, 2326, 2220, 2198, 2652, 2260, 2490, 2230, 2700, 3749, 2202, 2522, 3273, 2330, 2916, 3445, 2226, 1365, 2514, 2266, 2214, 2258, 2610, 2374, 5264, 4294, 5873, 2468, 2262, 2404, 2484, 2356, 2250, 2348, 2412, 2981, 3435, 2506, 2868, 4998, 2892, 2668, 2601, 2452, 2793, 2641, 3501, 2342, 2457, 2476, 2358, 2728, 2385, 2764, 7241, 2450, 3411, 2354, 2757, 2482, 5960, 4260, 2745, 6253, 5552, 2866, 3369, 2737, 6233, 4242, 3405, 3221, 2406, 2470, 3381, 5698, 3237, 2458, 2889, 4420, 4556, 2698, 6041, 2602, 7016, 2377, 2853, 4840, 3285, 2893, 4268, 4986, 5729, 2218, 7475, 2761, 2409, 2857, 2724, 4308, 4796, 5032, 2649, 2665, 4634, 2708, 2772, 2473, 2661, 2740, 4802, 4374, 4262, 2713, 2388, 4977, 4850, 4314, 2706, 4306, 4529, 4398, 2634, 7065, 4874, 2642, 4721, 2732, 4310, 5848, 2346, 4564, 4298, 2386, 4538, 2378, 5924, 5161, 2394, 2410, 4712, 5793, 5066, 2738, 4466, 2390, 10992, 2666, 5537, 4696, 10689, 4824, 4430, 2474, 4562, 4396, 9480, 4660, 12372, 5653, 4490, 3413, 4460, 4828, 4724, 9256, 4532, 5497, 4700, 6547, 4952, 5356, 12393, 4390, 5528, 4884, 5228, 4428, 4406, 4554, 4748, 4500, 2901, 4662, 4433, 2773, 2709, 2725, 4913, 4534, 4658, 4524, 4706, 5017, 5042, 2729, 5909, 4498, 10044, 5257, 5516, 6421, 5573, 4266, 8358, 4530, 5993, 4900, 6824, 4722, 6548, 4708, 4454, 5961, 4964, 4684, 4838, 5682, 4745, 4972, 4502, 5448, 4922, 4518, 12201, 6481, 8484, 4506, 5861, 5593, 5669, 5800, 5018, 4890, 5444, 5544, 5288, 5521, 5561, 6859, 4841, 5773, 5513, 5713, 4817, 4776, 4916, 5209, 5396, 5673, 2730, 4812, 4940, 4908, 6989, 5749, 5492, 4945, 5225, 5353, 6509, 5394, 5033, 5317, 13425, 6873, 4436, 4681, 6857, 4785, 8838, 5464, 5282, 6441, 6965, 4710, 8526, 4650, 9105, 5586, 6581, 6745, 4394, 4770, 8622, 9254, 5705, 4746, 5210, 6477, 8556, 4434, 5468, 4426, 6809, 4842, 8808, 6501, 4442, 5796, 6569, 4458, 8628, 5284, 10440, 5268, 5540, 4438, 5474, 5556, 4937, 4969, 5780, 4809, 4772, 8756, 5354, 4692, 5273, 8596, 5321, 8650, 8940, 4756, 5300, 5737, 8742, 5721, 8820, 5476, 4820, 4522, 8796, 5733, 8856, 4905, 9753, 4953, 4682, 8594, 5804, 5332, 4754, 4690, 10896, 5529, 8814, 5292, 5420, 4948, 9078, 8626, 8550, 5589, 4826, 4698, 10476, 4780, 5522, 5554, 6827, 4818, 4694, 9098, 8802, 5452, 9528, 5274, 8598, 9377, 10098, 9142, 5330, 4758, 4970, 8860, 9009, 4714, 4946, 11041, 9132, 4786, 9606, 4954, 9108, 4762, 11874, 4810, 10041, 6829, 5426, 9058, 6869, 6837, 9138, 4774, 6821, 9356, 9330, 6741, 10818, 8996, 9297, 10657, 8934, 4906, 11460, 6825, 8910, 8849, 10506, 11617, 8982, 5845, 9060, 9436, 11586, 5557, 8532, 5805, 9444, 5413, 5813, 11500, 9258, 9038, 9126, 5797, 6485, 5781, 9624, 9569, 5285, 5449, 8490, 5541, 9681, 9110, 5801, 8872, 8913, 10786, 5417, 5545, 9114, 5289, 10725, 5481, 9594, 8530, 11145, 8522, 10425, 10010, 5717, 9676, 11817, 4777, 5525, 13453, 5477, 9361, 9780, 8554, 9036, 13753, 13905, 10402, 9612, 8534, 5465, 8746, 13173, 8806, 10473, 10636, 11592, 9884, 9318, 10609, 12585, 9766, 9798, 5460, 11688, 10730, 9585, 10346, 10536, 8866, 13521, 10936, 13971, 8842, 11337, 8998, 11112, 9826, 13125, 9062, 9414, 11624, 12957, 8890, 9384, 10388, 11076, 9926, 10404, 8618, 13221, 9512, 11124, 9865, 9540, 9778, 16790, 5458, 9873, 9842, 9300, 8878, 5450, 5418, 9576, 5290, 9828, 8788, 10386, 9937, 8868, 9425, 9492, 11929, 10521, 10057, 16994, 10633, 4778, 10420, 9804, 8852, 9393, 9836, 10713, 9649, 9354, 10988, 9588, 9506, 10545, 9490, 11865, 8884, 8778, 11468, 9378, 9809, 11877, 11180, 10980, 8786, 19988, 9769, 18017, 10972, 8850, 10073, 11028, 9130, 9690, 11042, 9306, 9521, 13977, 10708, 10452, 8794, 13929, 9302, 9402, 10868, 19844, 9634, 10068, 10025, 8790, 8876, 11700, 9682, 18824, 10844, 13017, 12889, 8886, 8914, 11106, 10658, 11154, 9508, 9564, 9380, 11346, 9364, 14997, 13157, 13101, 8810, 17174, 10090, 12948, 8918, 10458, 9914, 17252, 9322, 22604, 9866, 16730, 8882, 21296, 10610, 9801, 8858, 9450, 9830, 9636, 5461, 9417, 8906, 9066, 9652, 9396, 9929, 9042, 9530, 17825, 8870, 21890, 9674, 11628, 9050, 11673, 9034, 10596, 9542, 19334, 11465, 10548, 9892, 11481, 11417, 18872, 10540, 18326, 9572, 10821, 9046, 12972, 9428, 17450, 11666, 10866, 11564, 13995, 9388, 11469, 9002, 9876, 21457, 22241, 9620, 11589, 9524, 9366, 22338, 11541, 9398, 19508, 10897, 9516, 9644, 10644, 9833, 13611, 9881, 17816, 11060, 10860, 9946, 10572, 11177, 11436, 9370, 11601, 10409, 14037, 9434, 10668, 10985, 11052, 9938, 9618, 9394, 9426, 9650, 18008, 9548, 13677, 10961, 17978, 17206, 9900, 10642, 19076, 10546, 10920, 9382, 9510, 9553, 13605, 11861, 10956, 9430, 10674, 18822, 11349, 18036, 20633, 13651, 11157, 11029, 13485, 9802, 17510, 10949, 13641, 9418, 9810, 13477, 21032, 11701, 9522, 9638, 18506, 9622, 9906, 19209, 13737, 11693, 20876, 18252, 22376, 24921, 18698, 9818, 10533, 9626, 10929, 17044, 9882, 23848, 19412, 18514, 20804, 13645, 18038, 9574, 11685, 11557, 9894, 10825, 17576, 12973, 18785, 17076, 21026, 13525, 17108, 11689, 11565, 11593, 9834, 12965, 10914, 13013, 18278, 10537, 10569, 17704, 17042, 11113, 20933, 11081, 10890, 24981, 10794, 17974, 11625, 11561, 10410, 18840, 19217, 11669, 25292, 11413, 19652, 9545, 17768, 17809, 16982, 11597, 11109, 11045, 20177, 17322, 17684, 10601, 9513, 11429, 22034, 11573, 11445, 18886, 28109, 18636, 8874, 10969, 19532, 9641, 18020, 17490, 10953, 11609, 21416, 10661, 23234, 17002, 11097, 10916, 17570, 17046, 11049, 19132, 20330, 10585, 19313, 10841, 10665, 17110, 10857, 22993, 11604, 11477, 25928, 18124, 17498, 10900, 11061, 11092, 10836, 10964, 9897, 10580, 21956, 17494, 21458, 17752, 10932, 21049, 33588, 17098, 17594, 19612, 17882, 19012, 21176, 18993, 10905, 17062, 27992, 9556, 20828, 18580, 18980, 18756, 17258, 20049, 18596, 17826, 17234, 10898, 22856, 19128, 27251, 19078, 23240, 22761, 26825, 10826, 20948, 11602, 23285, 10538, 23336, 17700, 21620, 10834, 17756, 11090, 21320, 26968, 10578, 17514, 35298, 10924, 10962, 10570, 20834, 17238, 18722, 17710, 11082, 9386, 18260, 10586, 19601, 25797, 10602, 17194, 26309, 9554, 17642, 18612, 19529, 17554, 18833, 9514, 9546, 22441, 17588, 9578, 26405, 9562, 21704, 20649, 9642, 17778, 17690, 19780, 23201, 18106, 21080, 17722, 21218, 18058, 19913, 10930, 18737, 18282, 25241, 19048, 9558, 10954, 21188, 10858, 30059, 10666, 18776, 21288, 19889, 21921, 19160, 18604, 21428, 18582, 20900, 17620, 23852, 18865, 20180, 17764, 25913, 9898, 18266, 21220, 18710, 19032, 18644, 18889, 21212, 18724, 18614, 18250, 17558, 19930, 19172, 17772, 22613, 17590, 25397, 18586, 22421, 17716, 13653, 17812, 21644, 18262, 22985, 18132, 17846, 20148, 17708, 18780, 23132, 18996, 19730, 18874, 22745, 17562, 21386, 19665, 34356, 19060, 18068, 18610, 23180, 17626, 19874, 18100, 30035, 18714, 19292, 17586, 22925, 20121, 17618, 19036, 35736, 18598, 18650, 18982, 36378, 19218, 22700, 19540, 17810, 18642, 18746, 17740, 33498, 17574, 18218, 20073, 21266, 18138, 19298, 19084, 33462, 11605, 20057, 17622, 17702, 18066, 37002, 17745, 21770, 11093, 10965, 10901, 21305, 18130, 10917, 18646, 23138, 19804, 21362, 20052, 27557, 17610, 21029, 19530, 26789, 45508, 18092, 23917, 30053, 18634, 37041, 20914, 34662, 18102, 34152, 10921, 17714, 18852, 18788, 18826, 19538, 19042, 18740, 17830, 36129, 17814, 27473, 19642, 21284, 17994, 25685, 19810, 19850, 19308, 21092, 19270, 17066, 18796, 29333, 19222, 25949, 17818, 23465, 21649, 21068, 23140, 23177, 18070, 18122, 19258, 20042, 17766, 18098, 21129, 20777, 20050, 23372, 19770, 18890, 18010, 21356, 19174, 33882, 19620, 19058, 20809, 21137, 19782, 27413, 23340, 18074, 19044, 27365, 22161, 22892, 18006, 18836, 19812, 22805, 19081, 22130, 18726, 19226, 19860, 18086, 19020, 22373, 22225, 38625, 25269, 22085, 19089, 25253, 18742, 19142, 19657, 18026, 35752, 42849, 19609, 18860, 18985, 19052, 18769, 35958, 22932, 21977, 27313, 22220, 19636, 39384, 19252, 19562, 22053, 21800, 19764, 19025, 21828, 22184, 18738, 26453, 18834, 22124, 19369, 22937, 22860, 21905, 19756, 22361, 19858, 19244, 23733, 21317, 19281, 23237, 23157, 37512, 19153, 18866, 21196, 36450, 19668, 20825, 23892, 22709, 21324, 19112, 21292, 22097, 36238, 23225, 22930, 39201, 21780, 26921, 22201, 19148, 21189, 21329, 10922, 21413, 21972, 19628, 21937, 21713, 20820, 27821, 21177, 23765, 23217, 27245, 25749, 38820, 21417, 21689, 20905, 19793, 21708, 21065, 18790, 21737, 19302, 21794, 27315, 37620, 18838, 34074, 21681, 21605, 20137, 18854, 25893, 19238, 23401, 27053, 25765, 41316, 21642, 21578, 19674, 47673, 17748, 25781, 21034, 18842, 20778, 37410, 23202, 19121, 19866, 19610, 19666, 50025, 21666, 21848, 22741, 19250, 34004, 22178, 19762, 19634, 21154, 25769, 19017, 21809, 35176, 18761, 21733, 38370, 20818, 18602, 21130, 26021, 41380, 20810, 21298, 33942, 21970, 27341, 23373, 19046, 23341, 35688, 17578, 19622, 21817, 19106, 20826, 26285, 26025, 25961, 34478, 38724, 21226, 38466, 20842, 38280, 25813, 18986, 26964, 19082, 22089, 34650, 25933, 19658, 23257, 19178, 17746, 26261, 19273, 19130, 21796, 37833, 17706, 35700, 35188, 17738, 25957, 37257, 26005, 37698, 17770, 38001, 17754, 35748, 33970, 23204, 41266, 35985, 21081, 34002, 23380, 17834, 23349, 21209, 21321, 37425, 21097, 21353, 21193, 37800, 21156, 34452, 22228, 48300, 35432, 23129, 21076, 17750, 19785, 36264, 19881, 22889, 23188, 23252, 21285, 38076, 22861, 19145, 21874, 37992, 34006, 35028, 39521, 21140, 21898, 21962, 19108, 23141, 21349, 22949, 21418, 41700, 21657, 20906, 18772, 19817, 34102, 37809, 21705, 19241, 40009, 38328, 21204, 38802, 21172, 21650, 21721, 35766, 21684, 20138, 34450, 37146, 19092, 19028, 21145, 35118, 40537, 42900, 21289, 22169, 19156, 23186, 34514, 22121, 21337, 21860, 19284, 34098, 22105, 19124, 18090, 40134, 21138, 21074, 35380, 37818, 37489, 34476, 37642, 38994, 22162, 22226, 34198, 19625, 22117, 36564, 21868, 21908, 19801, 22100, 18730, 34518, 23122, 21716, 23212, 21332, 43234, 40626, 35026, 37218, 37282, 21812, 19090, 21932, 21082, 18770, 38690, 37704, 21676, 38754, 19018, 21164, 18762, 36114, 21804, 44850, 36049, 19796, 35602, 38004, 37190, 39492, 19026, 46125, 18778, 52584, 19306, 37794, 22357, 18794, 21973, 34506, 21781, 36258, 39121, 34482, 35246, 35142, 19116, 46569, 19282, 19154, 21906, 41628, 35924, 21938, 27307, 35730, 37172, 40140, 18774, 41820, 19290, 19034, 22866, 37164, 36394, 34458, 37220, 19274, 21354, 21098, 22194, 38130, 38200, 35382, 41785, 37602, 35978, 35172, 21330, 40284, 19030, 21170, 21714, 34470, 21682, 38088, 41321, 35406, 21841, 36498, 19882, 19094, 37228, 37284, 35252, 34410, 21322, 21194, 18858, 38049, 19794, 38628, 35180, 37986, 41906, 40074, 35630, 42732, 19122, 27989, 19818, 37812, 19786, 36132, 39236, 40098, 19050, 19802, 19146, 47709, 35654, 19754, 19098, 35922, 35606, 46929, 19242, 37596, 35734, 37158, 27309, 42210, 21810, 35274, 43540, 42852, 35662, 38040, 27477, 44193, 37468, 27317, 21706, 43092, 27285, 27221, 19110, 21290, 27301, 58029, 35558, 35442, 36554, 39768, 38084, 35220, 26965, 39060, 35110, 39852, 35428, 39660, 35930, 35148, 40250, 45333, 37268, 42204, 35534, 39186, 36530, 40218, 19626, 37446, 35126, 38028, 45788, 27305, 35254, 44748, 39313, 35610, 36154, 39828, 36004, 39336, 39482, 35244, 35473, 36426, 37666, 46308, 39305, 23381, 37430, 43497, 36166, 37302, 37969, 44385, 38488, 35436, 36506, 90704, 37292, 22229, 34132, 41754, 35122, 21653, 36074, 40026, 43361, 21797, 35218, 41640, 36518, 38682, 23253, 35409, 23221, 67730, 37034, 37650, 42449, 23189, 36442, 39468, 22197, 44268, 37474, 41298, 25941, 36204, 23125, 39729, 38516, 35250, 21669, 38241, 38353, 22181, 39113, 39345, 39476, 21833, 21157, 35946, 33962, 36438, 35665, 44298, 21925, 39369, 41306, 43617, 37298, 37746, 23209, 39705, 36148, 35496, 45269, 42474, 37730, 38700, 54349, 38154, 21801, 44085, 22185, 39516, 21673, 21929, 38492, 35532, 36140, 21161, 40082, 41772, 36274, 42540, 21865, 44625, 51749, 39204, 45881, 51549, 34130, 80609, 36052, 38826, 43913, 46197, 34090, 41514, 40268, 39084, 35222, 34122, 22869, 37476, 43889, 50325, 38630, 35238, 34154, 51525, 19113, 51381, 22101, 54429, 21909, 38025, 35686, 37452, 21861, 36012, 35638, 42396, 36172, 51573, 37286, 34218, 37961, 39330, 37606, 35622, 37732, 46449, 37513, 54981, 37654, 93218, 42652, 50541, 37274, 39750, 55085, 34134, 36022, 47949, 21849, 36177, 38033, 34986, 37484, 37740, 37798, 37521, 39194, 38694, 42353, 41610, 36134, 51753, 37690, 52404, 36262, 35634, 37457, 36150, 43468, 39522, 44761, 44169, 37574, 36246, 36058, 39378, 39266, 71138, 39226, 38598, 43978, 38706, 21844, 39474, 43114, 39090, 42922, 35994, 38257, 35430, 36050, 42594, 40154, 39282, 43556, 45525, 36250, 58725, 44456, 35490, 38537, 36018, 37658, 41778, 37990, 47817, 36146, 59049, 40618, 39078, 56137, 35370, 38545, 71048, 38216, 43461, 45676, 35466, 38450, 43332, 39706, 38514, 38729, 46521, 42073, 46248, 44356, 35562, 40114, 36054, 39332, 35514, 39538, 36006, 38609, 41577, 37585, 39306, 37544, 42729, 38500, 36198, 42068, 72785, 39524, 41556, 39268, 39348, 38086, 35754, 34474, 39849, 37684, 38118, 41636, 67898, 42344, 41673, 42565, 38184, 39220, 36042, 37580, 90404, 38212, 38604, 42596, 46548, 39500, 39756, 42857, 21842, 38312, 50901, 46709, 39276, 37708, 39114, 37676, 38289, 37204, 35502, 40138, 38508, 21834, 43989, 21802, 21674, 38248, 46164, 39532, 44724, 21162, 42825, 44308, 37713, 41833, 43653, 35156, 39465, 42161, 39657, 40265, 56025, 43816, 50853, 35492, 46284, 42181, 69914, 42122, 42417, 51889, 41652, 39505, 37449, 38164, 45417, 37972, 43401, 38345, 38481, 45868, 41625, 39316, 39633, 19114, 42066, 37553, 38097, 46181, 44322, 38356, 44697, 38321, 43449, 37162, 42693, 43481, 35412, 35476, 47529, 38441, 40233, 38740, 81209, 37478, 43914, 38092, 52821, 37418, 45993, 35540, 38697, 39206, 43716, 42265, 68174, 39340, 38178, 43681, 37686, 38065, 35508, 52661, 38577, 35668, 41769, 37670, 44649, 35114, 37734, 37202, 41562, 47509, 37962, 38026, 44265, 46309, 37194, 37538, 39249, 42289, 41817, 43748, 53961, 43321, 44217, 53924, 44337, 45745, 35154, 47444, 70748, 37514, 54579, 38330, 39081, 37210, 38634, 35146, 85544, 51821, 44229, 38762, 51789, 35474, 36522, 44209, 42402, 37226, 44628, 39218, 42297, 35402, 70106, 35162, 79280, 37562, 43476, 42836, 38193, 42793, 35178, 41812, 42450, 43954, 38562, 37610, 46428, 35410, 37206, 45973, 67988, 35546, 46701, 39601, 52005, 43636, 54093, 51557, 67916, 38738, 54489, 38354, 51621, 35690, 69044, 44261, 42276, 35158, 38586, 40105, 72458, 35500, 55701, 37978, 42132, 51929, 35538, 44324, 43794, 38074, 53913, 35666, 38538, 42658, 43890, 51913, 54873, 35510, 35418, 44468, 38730, 39850, 36180, 39497, 43833, 46244, 46500, 35674, 51876, 41650, 77540, 68782, 42858, 43922, 39753, 38236, 35658, 38180, 54885, 41626, 38502, 37705, 75530, 35414, 38166, 39334, 38601, 35542, 60069, 37460, 54069, 44114, 77738, 35242, 72326, 41674, 52557, 78120, 40362, 42218, 35478, 39658, 68756, 70774, 43362, 39562, 38052, 42404, 35670, 39322, 52581, 41810, 43218, 38036, 37290, 39610, 37524, 66922, 69926, 42164, 42420, 42266, 42201, 35506, 89180, 43378, 45897, 74946, 46281, 41818, 42378, 35434, 43812, 38308, 41802, 73290, 55125, 35530, 45657, 42826, 66986, 35482, 54645, 40298, 46260, 37588, 21845, 37556, 54549, 38258, 40266, 69286, 109880, 35626, 72392, 37994, 54597, 75204, 44196, 38122, 73052, 39241, 38346, 36178, 43884, 38170, 44388, 37450, 68714, 40234, 38202, 39769, 42660, 35494, 52437, 45925, 45669, 36202, 43428, 36170, 68300, 38548, 38034, 39625, 71786, 39721, 36186, 37522, 42708, 42196, 36138, 42538, 83321, 70254, 38214, 41770, 75560, 67990, 70538, 43444, 87608, 44441, 39588, 70756, 42156, 46508, 44757, 44501, 43308, 46388, 45780, 44233, 42348, 43285, 54609, 45748, 86393, 39764, 38244, 43372, 73058, 42644, 102569, 42388, 39273, 36182, 71828, 38618, 37716, 42676, 39513, 37466, 47829, 68454, 44340, 37594, 72296, 43634, 72536, 72408, 74150, 46549, 44178, 39572, 37548, 42284, 39636, 70194, 47781, 38252, 43620, 36010, 38292, 44725, 38100, 38546, 70418, 37462, 38610, 39508, 94628, 37586, 46482, 37558, 42585, 39604, 38484, 68940, 43173, 70764, 38196, 43333, 83081, 46165, 44709, 38060, 38316, 72250, 71450, 44357, 72596, 78225, 43665, 39337, 42309, 40106, 78404, 42202, 54699, 38188, 42597, 38572, 75686, 54571, 72626, 42580, 42642, 71826, 78248, 71284, 43845, 38038, 39786, 37526, 75464, 42194, 37590, 42706, 44364, 68902, 71054, 42418, 68198, 71308, 37482, 42316, 108707, 43945, 39570, 43417, 77618, 43852, 92984, 37738, 46290, 41641, 39762, 43436, 69014, 44204, 39252, 43601, 70922, 38290, 37554, 42668, 74594, 37714, 38322, 43345, 78578, 75313, 43857, 39770, 76112, 70258, 39498, 71146, 37530, 71260, 78116, 38042, 72938, 71034, 38106, 39754, 37722, 69018, 37578, 38474, 72308, 43729, 68330, 37706, 79409, 71116, 43410, 39634, 80018, 39596, 43314, 38482, 38550, 38098, 75290, 38066, 74348, 38578, 94421, 43688, 71594, 70446, 73106, 54421, 75377, 72148, 37542, 38225, 42570, 38182, 42186, 70042, 47445, 54701, 76850, 43442, 68522, 71286, 74642, 53845, 77042, 37718, 71972, 54965, 73004, 42290, 96089, 45746, 86864, 39514, 72230, 44242, 68966, 38054, 38490, 38554, 54573, 44117, 55977, 43925, 43797, 54949, 89780, 38102, 43749, 72850, 39210, 78106, 54933, 43717, 76166, 54601, 68810, 53909, 54453, 67924, 37674, 53941, 38310, 38566, 54693, 39250, 102809, 75628, 53925, 38294, 75425, 46805, 76700, 39722, 93644, 38194, 53973, 39242, 72548, 43705, 71462, 85596, 72098, 42650, 93506, 38090, 44469, 54569, 78026, 77073, 70550, 72916, 82793, 54697, 39258, 39626, 71246, 72598, 75368, 39274, 38298, 43301, 71834, 73126, 85556, 38506, 46773, 46517, 78440, 39578, 72518, 53929, 71474, 39530, 71222, 43826, 76193, 78660, 87728, 72246, 72602, 77254, 68180, 83028, 80084, 46757, 46509, 44234, 72470, 72348, 81257, 54605, 85265, 46741, 72998, 38246, 74066, 75850, 92513, 42602, 72290, 54869, 72146, 39590, 113453, 42277, 43593, 54677, 71858, 54485, 79121, 70312, 51885, 54629, 68276, 71218, 80666, 44453, 44325, 74650, 70862, 78424, 76952, 54101, 72050, 85737, 46761, 51797, 95093, 51893, 76328, 46409, 51861, 51925, 67922, 39338, 46245, 79692, 72854, 51877, 71846, 43682, 43305, 70348, 52053, 43337, 44457, 46261, 74090, 54617, 44361, 74548, 70886, 69972, 42153, 78756, 72422, 42313, 80498, 80242, 75974, 79668, 43881, 70824, 87986, 46505, 46377, 43658, 77993, 70980, 77480, 43562, 110297, 43178, 67946, 68170, 88673, 82642, 91544, 76561, 71372, 71080, 87572, 41642, 42405, 42281, 75380, 78564, 72014, 73062, 46677, 72858, 88148, 76876, 77036, 44393, 54612, 44329, 71336, 78556, 71894, 71016, 38217, 68314, 76754, 72882, 74417, 67926, 78452, 44437, 44181, 79084, 102953, 71988, 42345, 42409, 75866, 43877, 76721, 43813, 95429, 43369, 46485, 68458, 110009, 69930, 45717, 68268, 76154, 45749, 76322, 85228, 46437, 72268, 68306, 38185, 80492, 45733, 75356, 89506, 46293, 79201, 94877, 45781, 77642, 44389, 38313, 44197, 82610, 78730, 75914, 35498, 71249, 79170, 43737, 44341, 80180, 38569, 79412, 84849, 109961, 71124, 83225, 42661, 75164, 68442, 95537, 43721, 43365, 43429, 46425, 74854, 74402, 69970, 75953, 76681, 68426, 68182, 81065, 68010, 76730, 78118, 69962, 45737, 77393, 43684, 74378, 44377, 79004, 71508, 68948, 76908, 85073, 75420, 43353, 43817, 89369, 44201, 75980, 42329, 68246, 72084, 74534, 43433, 75302, 43609, 140592, 42665, 107921, 75334, 70730, 75121, 72401, 43625, 102761, 70282, 68438, 83497, 85100, 46420, 84458, 74154, 45909, 69994, 74426, 82794, 79430, 86929, 85541, 68274, 80276, 72118, 43668, 78684, 85148, 70450, 78740, 44245, 84722, 43604, 43860, 43348, 43413, 43732, 75080, 39593, 91589, 43621, 42324, 83641, 69974, 68250, 76172, 94897, 74546, 72550, 86585, 74950, 71000, 86449, 88625, 43700, 71990, 78130, 78617, 78745, 75362, 75690, 83108, 71530, 78770, 68394, 78434, 72502, 80300, 78985, 72017, 79458, 80204, 78706, 76706, 76530, 79721, 76188, 81242, 75882, 112985, 43673, 108389, 72486, 71030, 68262, 76337, 76266, 71330, 38228, 101225, 76746, 88241, 76072, 87320, 78921, 92996, 75048, 87842, 76842, 117593, 69034, 74324, 71122, 112235, 76324, 75962, 75558, 87077, 70318, 102821, 68946, 91049, 71506, 87173, 43666, 80561, 74404, 87752, 72114, 71354, 70842, 75401, 85545, 80810, 95380, 75314, 76422, 82730, 68970, 93773, 68938, 77513, 77224, 88226, 43594, 70742, 93261, 71306, 43306, 68954, 46418, 91925, 70308, 68906, 75153, 80306, 42154, 79217, 70228, 76052, 75924, 77201, 79410, 71498, 72369, 43602, 74388, 142314, 71004, 44370, 70948, 87305, 43346, 103700, 43858, 83618, 74961, 88517, 75364, 70934, 42322, 70058, 77124, 71270, 75028, 43338, 78436, 43692, 92313, 77096, 43730, 160152, 76612, 75473, 83364, 42282, 83314, 105128, 42314, 109001, 84900, 89765, 74956, 80546, 95433, 70820, 42346, 76136, 37546, 91793, 73044, 42330, 76401, 78758, 43370, 85433, 74452, 78662, 84340, 85721, 42410, 83594, 72618, 75593, 68778, 78473, 76708, 101705, 76050, 38226, 70570, 72086, 84202, 92009, 70356, 72038, 70324, 75185, 72102, 88340, 76066, 78650, 72354, 83402, 87588, 38058, 71076, 79436, 38218, 86852, 38186, 85385, 71332, 38250, 38314, 75026, 78444, 84584, 74386, 89516, 38234, 85352, 71092, 101525, 88792, 91529, 71026, 79046, 38570, 143130, 72090, 83156, 78246, 79172, 72330, 80426, 70890, 108341, 78121, 102989, 71050, 104147, 77076, 83300, 93780, 70226, 70938, 107684, 70290, 77492, 85425, 75956, 77172, 70970, 75345, 74330, 72234, 43698, 83802, 84716, 76968, 71210, 92760, 79700, 84676, 70802, 78618, 76148, 86724, 84641, 38230, 85577, 70836, 43722, 77242, 43818, 84874, 43434, 71316, 120491, 71466, 83786, 79657, 42666, 74842, 70982, 113323, 75194, 74326, 88985, 85668, 84260, 75226, 85268, 74458, 80585, 74412, 77090, 75057, 76010, 76081, 90953, 91845, 83498, 70234, 76682, 73042, 70484, 84708, 85364, 74838, 78569, 70362, 76484, 80724, 79124, 77074, 71012, 74938, 112217, 73066, 77522, 74422, 70316, 76120, 39594, 70990, 74450, 79281, 73034, 86452, 88436, 92452, 84908, 95017, 78545, 73050, 153057, 70230, 75170, 71386, 76376, 78504, 80201, 91689, 77144, 70354, 78932, 70326, 112229, 80169, 152928, 88620, 90836, 73002, 92621, 76516, 88946, 71020, 78185, 76716, 70868, 107737, 71060, 86620, 72356, 74346, 84632, 75604, 74390, 71094, 83636, 80473, 137508, 83122, 76508, 71314, 79052, 71850, 120173, 54613, 71378, 78636, 77105, 87180, 70964, 74454, 87266, 70828, 71252, 72532, 103241, 86872, 139890, 75988, 71084, 74916, 86348, 76692, 112469, 70294, 76244, 75030, 74900, 78673, 70358, 79698, 80564, 75222, 93074, 70956, 80468, 76884, 70250, 74418, 91988, 79522, 76340, 109363, 86474, 72340, 103013, 70806, 79706, 71340, 72404, 80233, 164697, 74394, 70838, 75426, 103205, 70506, 89300, 75930, 140364, 76905, 88532, 71382, 119381, 71350, 70322, 85189, 76124, 86353, 74858, 76218, 83540, 86668, 138084, 70482, 104141, 74442, 111401, 104100, 87260, 84793, 185889, 80722, 70298, 113317, 84761, 77148, 75626, 76593, 84620, 74602, 80042, 75450, 87668, 71058, 76562, 76380, 70346, 78409, 70490, 86425, 71090, 79266, 83666, 74406, 76658, 75402, 84434, 70474, 87692, 76326, 119477, 70810, 78164, 75106, 111893, 83146, 70874, 91810, 76058, 75954, 80714, 75337, 70988, 74898, 76250, 78249, 87362, 86802, 72554, 72874, 77078, 77236, 70310, 75366, 136818, 71242, 74570, 137806, 75602, 80217, 79433, 70866, 75188, 70834, 72338, 78630, 137394, 46421, 72020, 86626, 146742, 71250, 134826, 75066, 71318, 75994, 75146, 70486, 178824, 86418, 72530, 71346, 80594, 70993, 76358, 70950, 76130, 75465, 44373, 77194, 137586, 43861, 43605, 43669, 75986, 86937, 155304, 77386, 78938, 76986, 72266, 43685, 162258, 72538, 154572, 77466, 85412, 78498, 74582, 77394, 79196, 75078, 91721, 70822, 142452, 80212, 84578, 76146, 84836, 72522, 87500, 85074, 70442, 72274, 91865, 87708, 84530, 70870, 71258, 77478, 91490, 71322, 138390, 72364, 84404, 104041, 91556, 89298, 76580, 120165, 83354, 75606, 86597, 74538, 171657, 93045, 75428, 136780, 165321, 75108, 91337, 88530, 71078, 88626, 80474, 76644, 43689, 74964, 88418, 92596, 77114, 71062, 85682, 71334, 77402, 72534, 91316, 70962, 93557, 71254, 75476, 75306, 105140, 83634, 79658, 76444, 86930, 70858, 74924, 78162, 167154, 79012, 117077, 86820, 77126, 72282, 76652, 88434, 79268, 104020, 83546, 76338, 76964, 72406, 75116, 102741, 71978, 86628, 156042, 138394, 90962, 75978, 71066, 76170, 175068, 76132, 79508, 76566, 77156, 84426, 95381, 68266, 161970, 91812, 87452, 75060, 91853, 71274, 77204, 76084, 78170, 80586, 88997, 74934, 72278, 136660, 84293, 72342, 87185, 75444, 88274, 76602, 87650, 72010, 140742, 88690, 166425, 78186, 76076, 111915, 139980, 75052, 77228, 77418, 136038, 72490, 95561, 71014, 88484, 75180, 79130, 77164, 89381, 108843, 79082, 76140, 72026, 72370, 88901, 80490, 84137, 78697, 152208, 72042, 136482, 78954, 80210, 79578, 79001, 79513, 152826, 72394, 109931, 76518, 86345, 84300, 144330, 88500, 79049, 88420, 85226, 78537, 74906, 79465, 89417, 78441, 91796, 85396, 78500, 72346, 87689, 142202, 141864, 72298, 141480, 79449, 157578, 78994, 75482, 74970, 149649, 76234, 79028, 92341, 84377, 80218, 151398, 109285, 76388, 76980, 80234, 72022, 150096, 79570, 109253, 79506, 76946, 84396, 87881, 76570, 74930, 88876, 84521, 75348, 84305, 74962, 75410, 75154, 77234, 85209, 142248, 83241, 134442, 92569, 87368, 72358, 92753, 89449, 92972, 75186, 140916, 78484, 155985, 75084, 92588, 84805, 76364, 87909, 87761, 88809, 84788, 84901, 85172, 76180, 164970, 87621, 76433, 85138, 85610, 85098, 156396, 76486, 157281, 87652, 140433, 84274, 79532, 72106, 159348, 79212, 142056, 84370, 74918, 111909, 142476, 83305, 76070, 88657, 112277, 101205, 78548, 76108, 84905, 75046, 136566, 90709, 83369, 78516, 75089, 76396, 158985, 76329, 144984, 76596, 142290, 87513, 74966, 91794, 107669, 79060, 85292, 79276, 75062, 78633, 156456, 79156, 85394, 75478, 140892, 78250, 157209, 78489, 145233, 76713, 111917, 76204, 84689, 76620, 77132, 144524, 162201, 94893, 145722, 87364, 92876, 86737, 155274, 76369, 91538, 87720, 86696, 76113, 78410, 109203, 79148, 77481, 109739, 135844, 112037, 84648, 89237, 88780, 88853, 76588, 136278, 76972, 94901, 86836, 74954, 86373, 175032, 109989, 78482, 109861, 87845, 86853, 90773, 87897, 75338, 107685, 136662, 77137, 143988, 88396, 135594, 84684, 109259, 90805, 79562, 88492, 151098, 142732, 76178, 75058, 107957, 86361, 76082, 75346, 88805, 79434, 143910, 75174, 88229, 78676, 159276, 83289, 172500, 77094, 75158, 85164, 135828, 88773, 79538, 79282, 86828, 76950, 79442, 75466, 139962, 75414, 144216, 107821, 136806, 148180, 111977, 107859, 184872, 87633, 111785, 85669, 144849, 75442, 157368, 88401, 84677, 76210, 150945, 84261, 87497, 86725, 78554, 141158, 137046, 76492, 143082, 144940, 87737, 85329, 166449, 86949, 107849, 78426, 88466, 43690, 149292, 86356, 77018, 88882, 77210, 78508, 140082, 75354, 140616, 157256, 87473, 86713, 87593, 153836, 144948, 79066, 79514, 79002, 172968, 88233, 101717, 150484, 91730, 95061, 167592, 79450, 92849, 78546, 86441, 75418, 144162, 143942, 85673, 77010, 75110, 76954, 152784, 87225, 76646, 77106, 145716, 87412, 140898, 79185, 79058, 87244, 158520, 87729, 141708, 88753, 79142, 79026, 75350, 87273, 153873, 108853, 166584, 89301, 86705, 76978, 111317, 109413, 109235, 136298, 103085, 84657, 135762, 75430, 137574, 93609, 108905, 76582, 87314, 87141, 145014, 107881, 93485, 80553, 165738, 85146, 145206, 92461, 85202, 107733, 103061, 137890, 150192, 84786, 149046, 103717, 136650, 103093, 142242, 109357, 78698, 141892, 150300, 76134, 109733, 77158, 150801, 103077, 179634, 84553, 85298, 85170, 144966, 76182, 109877, 70996, 136338, 150490, 154086, 109273, 88937, 84138, 157008, 148904, 78674, 76198, 83114, 76966, 79466, 146230, 92834, 78442, 153990, 76465, 140850, 141860, 103763, 109257, 157233, 76594, 103589, 108901, 108965, 136852, 136518, 87202, 108197, 156070, 79154, 87384, 104117, 78514, 90965, 78682, 136020, 88738, 142008, 103605, 86690, 93001, 87122, 109401, 109220, 76186, 158676, 78666, 156588, 144242, 89426, 84642, 88277, 103081, 141636, 79258, 86354, 77002, 86933, 104101, 87890, 151078, 76361, 93333, 87269, 79050, 86666, 78538, 148074, 86346, 210669, 75081, 83282, 74410, 138666, 140564, 87458, 136526, 86834, 88714, 166281, 84522, 154152, 109161, 157458, 88357, 218211, 83242, 150936, 108201, 145836, 143762, 87506, 92749, 142737, 83274, 157089, 105301, 153354, 88869, 154017, 93541, 154920, 84714, 151842, 76390, 76073, 70314, 83306, 109204, 109781, 76105, 84809, 83290, 152634, 76450, 148182, 92965, 136404, 109140, 91301, 105133, 157380, 91573, 86378, 108949, 93365, 148754, 92597, 137902, 109157, 84906, 190857, 136630, 152880, 92469, 141672, 83370, 155178, 91317, 168360, 140876, 105173, 169073, 103253, 105141, 145041, 75946, 155241, 92521, 77225, 136364, 157548, 76426, 77129, 105109, 153522, 76330, 138570, 140578, 103757, 93529, 105125, 76522, 136620, 76714, 175941, 138586, 140562, 142244, 70994, 87753, 157770, 85285, 206115, 87388, 271202, 76474, 103637, 141602, 87332, 88921, 181572, 140450, 84773, 109209, 70826, 85413, 103829, 138538, 88793, 136042, 92873, 77482, 103781, 70986, 145842, 70954, 135858, 158956, 104021, 88393, 71018, 146774, 161388, 71082, 88361, 88873, 148566, 84313, 93017, 71002, 143718, 136018, 152628, 92581, 142566, 86617, 170361, 84697, 135834, 77161, 158049, 77097, 148134, 85321, 92969, 105129, 158940, 142438, 91433, 85417, 93524, 84393, 138582, 71338, 166596, 84681, 86633, 87204, 154854, 93397, 151857, 86889, 86729, 88740, 169569, 91861, 103769, 86692, 149073, 92761, 87188, 139994, 137940, 92505, 149832, 136594, 177420, 140632, 84644, 152252, 92777, 142810, 86612, 88885, 136626, 142708, 87764, 91561, 143028, 91497, 143766, 148306, 153330, 87460, 84308, 70998, 162153, 141928, 84569, 149690, 79529, 151976, 142050, 84825, 92981, 86821, 91349, 93012, 91829, 156524, 85289, 84585, 153705, 84777, 87476, 88665, 152538, 159914, 92756, 76489, 168690, 142198, 149994, 88681, 87410, 144070, 141546, 86676, 154008, 92773, 153282, 136402, 146058, 136370, 88724, 91813, 144708, 88788, 152100, 92565, 87434, 92500, 86885, 87498, 142218, 76452, 92852, 84564, 79145, 79273, 140706, 142262, 142020, 136786, 144282, 85674, 141882, 144785, 136854, 87193, 85157, 140654, 91493, 76585, 154968, 88660, 75092, 87732, 91541, 142610, 157137, 88756, 178569, 79017, 170085, 79209, 138090, 86740, 151770, 142802, 150138, 148772, 86708, 84820, 92825, 76969, 145236, 140462, 85349, 84660, 135978, 139990, 137874, 87186, 159273, 136358, 87257, 141140, 88421, 152465, 91817, 87220, 154440, 141484, 191289, 80554, 174345, 150344, 86681, 142052, 150474, 150200, 141462, 88729, 76436, 167386, 91481, 76116, 150150, 159394, 86825, 140452, 140580, 76372, 136794, 84633, 154929, 139954, 137946, 136858, 76628, 76500, 148266, 92818, 142044, 85161, 86873, 176708, 84266, 141034, 88409, 140758, 156570, 141686, 152433, 87657, 144660, 87396, 136614, 77140, 85337, 141524, 141966, 156809, 154857, 86674, 144852, 76468, 87641, 136598, 72362, 149864, 168354, 88722, 91733, 88914, 150897, 142228, 140718, 136870, 207684, 142114, 171426, 149332, 84626, 136394, 223665, 84306, 161058, 137900, 166674, 140590, 149778, 168776, 140394, 151766, 144468, 154234, 88469, 91476, 87698, 143030, 154296, 87762, 84554, 78505, 155226, 166258, 153690, 140138, 87653, 145258, 87404, 141466, 152760, 87444, 144756, 169672, 79193, 243025, 136602, 88404, 161610, 74922, 144204, 88650, 157236, 86868, 141660, 87252, 142932, 157276, 141162, 92844, 219924, 84562, 84314, 152330, 144588, 153494, 153222, 144674, 153777, 177713, 177417, 136810, 168552, 140522, 84842, 84330, 170169, 87348, 165033, 137818, 88658, 76434, 150216, 87468, 137514, 169777, 88748, 140122, 155994, 75090, 153288, 137942, 152646, 86700, 87212, 150452, 87449, 140708, 142098, 142684, 161418, 136550, 149178, 84652, 153210, 76074, 95573, 142498, 140658, 76362, 75050, 84690, 142194, 151994, 177777, 75082, 144858, 146068, 149928, 79188, 170532, 76650, 86738, 154708, 153393, 144826, 141138, 75114, 137814, 76506, 153762, 137546, 141786, 137878, 75098, 140602, 161073, 142178, 145242, 144458, 76370, 76114, 148938, 158330, 149094, 142756, 148806, 154729, 89429, 75178, 152841, 141146, 142410, 151906, 87893, 160681, 87125, 143026, 87317, 76626, 76106, 141964, 186084, 140746, 140118, 158392, 142998, 169202, 142794, 137578, 169272, 137906, 202164, 159113, 76460, 154994, 77138, 145226, 148692, 76498, 166692, 146282, 150312, 153314, 167529, 87442, 141666, 151178, 141894, 137930, 76634, 76122, 143700, 87474, 141522, 109227, 168609, 159080, 148836, 148652, 77162, 144466, 187170, 76138, 168330, 75094, 150921, 77130, 169605, 76618, 151878, 137882, 152865, 142690, 87626, 87754, 183369, 91474, 152424, 77146, 141942, 76378, 145578, 86634, 151338, 152026, 182100, 141682, 209205, 87372, 85418, 144182, 169296, 77098, 169668, 87634, 153924, 149654, 140964, 88402, 183204, 87730, 160089, 140500, 88754, 144230, 210549, 144166, 158532, 86866, 160329, 156322, 154698, 146066, 216153, 85330, 152388, 146266, 148662, 143914, 76118, 141638, 142116]
if n <= 5000:
return bin(a[n-1])[2:]
# finding a lower limit
# lets start the raw, computionally intensive brainfuck (i mean that language)
# this looks like it could be done with a C for
i = 0
while True:
b = bin(i)[2:]
res = tester(b)
if res == n:
return b
i += 1
### TEST AREA BEGINS ###
# this function tests the string (and decrements it by 1 as "" isnt consireded as a subseq by spec)
# dont even try to understand this, me does not understand it either (or so i say ( ͡° ͜ʖ ͡°))
def tester(a, verbosity=0):
# technical styff
n = len(a)
last = {}
dp = {}
dp[-1] = 1 # we haz to haz this start value
# O(n) iteration over errytin'
for i in range(n):
if verbosity > 2: print("\nCHAR", a[i], "at", i)
dp[i] = 2*dp[i-1]
if a[i] in last:
if verbosity > 2: print("before at pos", last[a[i]], "({}-{})".format(dp[i], dp[last[a[i]]]))
dp[i] -= dp[last[a[i]]]
last[a[i]] = i - 1
if verbosity > 2:
print("dp:", dp[i])
print("last:", last[a[i]])
# substract the starting value from result
result = dp[n-1] - dp[-1]
# lastly, remove the oil well used in calculi before printing debug info
del(dp[-1])
# end result debug info
if verbosity > 1:
print("\n### RESULT ###")
print("str:", a)
print("len:", repr(n))
print("distinct chars:", len(last))
print("last:", repr(last))
print("distinct:", repr(dp))
print("result:", result)
if verbosity == 1:
print(result)
return result
# a simple loop around tester()
# looks very understandable :D
def loop(verbosity=3):
while True:
t = input("> ")
if t == "": break
tester(t, verbosity)
# an advanced loop around tester()
def mass(n):
q = {}
for i in range(n):
r = tester(bin(i)[2:])
if r not in q:
q[r] = []
q[r].append(i)
# clean them
q = {i: clean(j) for i, j in q.items()}
return q
# test cleansing func
def clean(a):
# first: take just the shortest
e = [bin(i)[2:] for i in a]
r = len(min(e, key=len))
a = [i for i in e if len(i) == r]
# second: clear repetitive answers
# thats some heavily modified for loop here
i = 0
while True:
if len(a) <= i:
break
# pop reversed copies
if a[i][::-1] != a[i] and a[i][::-1] in a:
a.pop(i)
continue
i += 1
return a
### TEST AREA ENDS ###
# lets module thihs
if __name__ == 'niam'[::-1].join(['_'*2]*2):
print(main(int(input())))
# an empty line in end of script cuz why not?