有趣算法-堆排序学习整理

    最近,对数据结构比较迷,利用业余的时间看了些文档,发现中文文档比较难理解,参考了些外文文档,总结一下,希望大家能看的明白,堆排序的简单实现.


解析:

1. 最大堆:根结点的键值是所有堆结点键值中最大者的堆.

2. 最小堆:根结点的键值是所有堆结点键值中最小者的堆.

3. 上述两种堆插入操作: 只需要将节点插在二叉树的最后一个叶子结点位置,然后比较它对它父亲节点的大小,如果大则停止;如果小则交换位置,然后对父亲节点递归该过程直至根节点。复杂度为O(log(n))

4. 存储二叉堆:一般用数组来表示。如果根节点在数组中的位置是1,第n个位置的子节点分别在2n和 2n+1。因此,第1个位置的子节点在2和3,第2个位置的子节点在4和5。以此类推。这种基于1的数组存储方式便于寻找父节点和子节点。

概述:

1. 将原始需排序的数据定义为origins[]

2. 定义两个下标ori、tri,ori为origins[]数组中元素下标,tri为将要构建的完全二叉树trs(本例子按最大堆建树)的下标.(ps:下文中的堆和树是同一样东西)

3. 从ori=0开始,向trs输入元素
        建立节点Node时,检查该输入元素origins[ori]是否存在父亲节点,如果存在,则进行判断是否满足最大堆条件,不满足进行递归判断,满足就接着输入origins[ori+1]

4. 生成最大堆trs后,进行排序.
    4-i)将生成的trs存储(见:本文解析中的二叉堆存储)ns[]中
    4-ii)将数组ns[]的第一个元素即(当前树的根元素)与数组ns[]最后的一个元素交换,并且输出根元素(当前最大元素),且从树中删除该节点,ns[]也删除改元素.
    4-iii)处理(4-ii)置换后的当前根元素,按最大堆原则,将该元素放到适当位置
    4-iv)重复执行(4-ii)直到树和数组ns[]只剩下一个元素.


例子:

有趣算法-堆排序学习整理_第1张图片

注:此图出于https://en.wikipedia.org/wiki/Heapsort
    说实话,没有这幅gif,感觉我应该对堆排序还是迷迷糊糊,在这感谢维基百科,希望对大家有帮助.


代码实现:

#coding:utf8
def get_parent_id(id):
    '获取父亲节点'
    if id < 1:
        return -1
    return (id - 1) // 2

def swap(nums, pid,cid):
    '交换'
    temp = nums[pid]
    nums[pid] = nums[cid]
    nums[cid] = temp

def shift_up(nums, pid, cid):
    '从下至上判断是否符合最大堆'
    if nums[pid] < nums[cid]:
        print 'pid:%d, pdata:%d, 与 cid:%d, cdata:%d 交换' % (pid,nums[pid],cid,nums[cid])
        #交换
        swap(nums, pid, cid)
        #递归判断
        gpid = get_parent_id(pid)
        if gpid == -1:
            return True
        else:
            return shift_up(nums, gpid, pid)
    else:
        return True

def shift_down(nums,id):
    '从上到下判断是否符合最大堆'
    length = len(nums)
    if id == (length - 1):
        return True
    lid = id * 2 + 1
    rid = id * 2 + 2
    #具有两个节点的情况
    if lid <= (length - 2):
        #取出最大的节点换上去
        if nums[rid] > nums[lid]:
            temp_id = rid
            if nums[temp_id] > nums[id]:
                swap(nums, id, temp_id)
                #递归检查
                return shift_down(nums, temp_id)
            else:
                return True
        else:
            temp_id = lid
            if nums[temp_id] > nums[id]:    
                swap(nums, id, temp_id)
                #递归检查
                return shift_down(nums, temp_id)
            else:
                return True
    #只有一个节点的情况
    if lid == (length -1):
        if nums[lid] > nums[id]:
            temp_id = lid
            swap(nums, id, temp_id)
            #递归检查
            return shift_down(nums, temp_id)
        else:
            return True 

def build_max_heap(nums):
    '构建最大堆'
    max_heap = []
    index = 0
    #构建最大堆
    for n in nums:
        max_heap.append(nums[index])
        #获取父亲节点
        pid = get_parent_id(index)
        print '第%d次,pid: %d,cid %d'%(index, pid, index)
        if pid != -1:
            shift_up(max_heap, pid, index)
        index += 1
    return max_heap

def heap_sort(nums):
    '堆排序'
    result = []
    #第一步:建立最大堆
    max_heap = build_max_heap(nums)
    #第二步:首尾互换
    while len(max_heap) > 1:
        tail_id = len(max_heap) - 1
        swap(max_heap, 0, tail_id)
        result.append(max_heap[tail_id])
        del max_heap[tail_id]
        shift_down(max_heap, 0)
    result += max_heap 
    print max_heap
    return result

代码测试:


'''
    测试部分
'''
def test(nums):
    for i in range(len(nums)-1):
        if(nums[i] < nums[i + 1]):
            print '检验不合格'
            print '第%d个:%d < 第%d个:%d' % (i, nums[i], i + 1, nums[i + 1])
            return
    print '检验通过'

nums = [9475,5157,8919,94,770,8260,3567,8002,2575,8560,1341,5297,8195,62,9833,413,7274,5065,8523,4140,5281,8582,8515,3645,4742,5093,6515,7518,7754,4600,618,8879,7306,5987,5741,3062,3145,7824,8114,795,8396,8317,9867,4517,7612,4175,9962,8635,790,6198,6504,9619,4526,2931,6365,4266,6784,2304,9778,2366,3739,9990,6758,5844,7644,6513,1948,7340,6074,6639,7072,4887,6253,6752,7831,9959,2822,4664,6324,1699,620,4367,7018,9248,4847,3055,6938,6690,8298,1303,14,4120,4741,5544,5717,8730,7597,8601,6535,5306,2388,3133,1906,349,9732,358,2746,1805,4295,241,6620,9532,4526,4632,3862,71,8786,6082,3848,3175,4214,5938,5948,6738,8829,1457,2081,4133,9325,8416,4234,5118,6193,823,8159,5552,8809,9620,3871,8475,4121,6240,3560,8613,1893,2171,1622,3484,9736,5597,7610,2861,3935,6018,6202,3577,2816,2941,6681,8744,2919,4032,5541,6002,2196,186,986,6410,8476,4251,6252,8795,4010,2580,2808,5067,4285,7787,6138,1260,173,2107,5934,4115,9417,7860,5595,5512,3129,6985,3312,6781,4296,5347,1060,5078,848,2037,9586,3578,5498,8233,4002,602,7684,7615,3880,3164,3874,1990,9803,2078,532,1178,9107,1172,4041,9018,8528,1201,1391,3036,8732,2383,3629,314,8994,6720,2442,3271,5007,83,2022,4927,1236,663,9447,622,450,7338,1993,3810,7933,3925,5447,5108,1538,4594,1395,2882,6914,4173,8092,2367,9963,4757,1013,296,5892,7317,6541,9327,3869,5012,326,9947,985,2972,2437,1973,3140,6518,3032,1785,5475,6585,4963,2984,7606,2309,7371,18,5275,2400,5126,3241,7617,1181,3713,2887,7837,795,8744,3253,698,7098,6324,3309,7927,695,8720,4451,7631,4987,1230,4506,265,979,1165,375,1104,574,6155,2243,7328,8861,2635,1624,6868,2048,5570,8748,5263,7335,5277,2302,4370,1046,8419,5443,1935,9068,9282,9154,3732,3213,1217,3907,6391,722,1652,9664,4178,9710,4475,3654,2577,4653,2825,2095,2112,3393,4245,710,3481,7648,3377,1957,934,7441,7677,64,6666,2731,5931,8109,2598,6588,7710,5529,2866,8941,8590,8628,6163,9672,212,1772,3091,6319,1114,4882,237,7678,1544,2888,7029,7866,2254,8668,1331,9301,9013,3763,840,4477,184,755,2165,1767,5386,6657,1387,1657,9566,4292,2691,8262,2892,5626,3033,5650,3220,2075,7363,2277,418,8982,4963,7715,6528,4030,6827,6851,3134,8959,2085,5966,9884,8906,7377,7041,9106,8040,2303,3167,266,9539,7111,8401,4463,5667,4777,6602,3605,7938,920,7475,4673,3751,5109,3923,3683,5809,9423,6775,565,6652,7652,5458,6022,2785,5446,8737,7783,953,334,7911,1962,3720,7384,6310,5829,8847,8694,2489,9075,3231,3314,5893,2830,5006,9625,8889,7642,5726,3247,1409,3276,3765,8112,9596,9332,3008,5389,7266,217,6159,6076,8173,5636,6778,9617,2520,8625,2117,1812,7321,231,3754,8339,9945,4532,6499,8666,9193,2356,1350,3279,6874,9924,1297,7309,7407,9260,3726,7142,8728,3032,3469,9077,2100,5023,2981,9369,1673,9423,5469,8851,4632,434,2096,2956,2707,3096,6262,3489,2740,8055,2288,1625,1664,1041,4501,804,531,1015,5544,2656,3833,5009,4885,8799,8592,8969,2798,7546,2849,5014,7581,9962,8709,3997,7018,8274,2272,9685,8678,458,3826,5547,9737,5937,5980,1009,8637,9036,9928,2605,4041,159,5750,598,3257,9481,5178,4861,6963,5575,8784,7820,2473,9519,2326,2267,9034,7429,7002,6986,5565,4904,885,531,2802,5749,7853,3312,3057,3340,9231,651,8072,6096,4868,1272,4886,3275,7828,1165,8429,9472,9521,3005,8339,8833,8417,3833,604,6406,689,2405,9757,6736,5316,343,7511,9906,4933,8898,4876,7771,1255,7195,3725,4888,1511,9649,9373,3075,786,1553,1950,7591,7310,106,266,4561,9429,4856,7333,9082,9224,1701,3742,7784,9418,7484,52,4960,2554,9774,8929,5247,6591,6360,4072,3694,9962,5519,1291,2234,7683,7966,1398,9193,1643,6735,4756,6089,9379,2537,1894,4682,8519,8607,2278,1634,6404,7465,8377,231,6707,5405,6378,8125,648,630,8850,8160,8662,4152,3979,7436,5719,2659,6346,809,6793,9244,4757,9313,7193,1540,7628,3160,222,6766,3966,608,4260,4900,3422,6279,9977,6340,3930,1428,7537,4634,8629,6939,716,8910,6935,7090,9987,5143,1419,7928,9207,6094,5229,5796,4838,8900,3349,5043,4588,6410,282,4273,8122,2999,78,1766,301,3320,9267,1496,8673,1827,8160,584,6947,2872,8867,1276,2158,230,7110,362,4679,1069,9397,8735,8157,2172,1716,2007,9556,6524,9302,4029,4863,6107,1470,3041,4150,9378,7811,1490,8494,399,2704,5617,2789,3343,8457,4201,5015,2437,4345,6293,2719,2322,6341,2041,2946,4100,7849,2507,2328,3663,6001,1753,4097,4867,8022,4978,9131,864,3681,2019,1828,7409,368,3286,5059,7541,6883,4894,6170,4267,2768,7921,3225,3817,8770,8819,5095,8457,4044,3331,4441,1898,1440,3850,6108,6652,105,8594,9518,9208,1474,960,3681,707,5467,9491,8185,9988,72,7422,7292,6641,1714,8420,7405,9406,9289,6327,4793,3903,9602,9155,9279,263,8308,5477,3923,4658,3179,1280,3092,4592,1634,8620,6760,2280,9681,7322,5633,67,1815,6390,9175,8084,3691,7648,3358,870,6093,1146,6008,8351,5779,7928,8439,173,7132,9838,5196,6068,8572,2797,671,7121,687,4500,288,6327,7126,5816,9001,2442,8108,6692,6201,4280,8655,5143,1065,3672,9207,4502,7710,8184,9826,8003,3232,7005,8096,5671,4607,5372,1240,5733,7653,4331,5196,35,6598,4780,7638,5096,4142,3531,6334,9792,8452,2133,1397,2734,3577,3822,2817,4867,4378,2717,9817,6376,1425,1705,2955,6782,8889,1484,7571,9441,4565,1025,7788,6126,9015,1912,9935,8673,3859,1199,8024,9637,7317,4891,4185,266,4603,5292,3222,4254,2118,2492,4837,6880,547,6978,7181,1893,5168,3026,5821,1842,719,8311,7229,4228,9702,1565,7708,1356,5083,8388,9098,8400,6048,9965,5737,8264,8398,292,5791,6677,9051,9508,5037,237,5541,4701,4948,5688,9057,3326,8361,61,3707,3386,6878,260,9990,5939,6526,5793,1199,1405,7562,653,3773,52,7944,8178,2579,8291,7990,3773,7050,6692,2653,7075,4347,326,5441,1232,7293,8188,866,7823,6395,6347,3589,1429,6942,3920,3297,4498,1740,2169,9488,7132,625,833,7232,9769,7508,830,3719,3058,7986,8024,4801,939,1959,461,2185,1834,6758,3830,9887,1952,540,2699,5706,4080,5882,6269,1542,5721,7978,3835,9277,593,5265,174,2217,1630,7181,4529,873,7106,5633,7598,237,6849,4758,6936,7495,5137,549,2227,2969,1946,3973,4769,8927,2736,2721,9227,727,5801,9023,6005,6228,9372,1473,3867,5479,7451,2908,7368,2337,120,1691,4497,2225,5509,7933,6974,54,9338,4724,3358,6823,5566,2771,9027,6913,9927,143,7418,1868,5675,9746,8808,5470,5098,882,6181,4612,3163,4052,429,1846,371,3993,9429,4482,4723,8269,380,8834,5662,5782,8621,7111,9280,1263,5492,1354,413,8945,5596,9665,2911,7229,2613,3974,7037,4803,4722,996,2821,9030,5634,8348,5791,1337,6472,5223,8847,1362,154,1806,381,4454,592,4246,6550,3181,1426,2715,507,5542,6692,1081,8378,200,7710,2991,6958,9290,4485,5847,8266,3677,2073,6130,2800,4832,3203,4082,1359,2442,7942,800,405,7990,5653,6048,9189,5905,7086,4354,8698,5288,4576,9249,1062,9168,5524,3775,8033,9324,9952,2036,305,2479,9800,5222,2828,3860,3130,3565,4592,5546,4898,3377,1502,279,9786,8452,5391,8619,8357,9790,2626,2656,830,7065,9743,9263,6879,8964,2226,1153,835,774,7407,2988,7798,4740,2157,7465,4002,380,2410,5269,4700,2356,304,7803,3375,3466,5565,9190,3252,2135,8096,9153,3425,7204,8762,976,5085,7648,1661,9370,924,3120,6666,2489,7696,2885,7611,4316,1032,8244,3431,4898,2450,727,1103,4341,9734,3679,3914,1381,634,2571,5723,6206,7080,7456,5028,9697,8618,9747,8571,9711,990,8437,1582,301,5728,8290,5283,4992,8446,7998,8059,144,2639,6431,883,4542,2189,4855,7999,4682,2814,6794,4123,3936,6923,1938,4638,3210,6562,5987,5168,3268,914,3040,6566,6747,1887,4736,4,5093,621,7378,2233,7070,8065,7225,7188,2518,6489,9479,9959,6272,2805,1347,7936,101,2720,9498,7960,312,4511,8911,8727,8274,9272,7417,7334,7670,3879,353,9694,2798,9549,7729,8668,4036,9325,2467,5579,2264,6205,1739,3093,6544,3405,1449,2214,5034,2275,8750,1411,8698,4076,2483,1942,1212,9482,732,9554,1427,90,7305,6415,3231,8337,8673,5094,1579,7189,5352,3224,3463,5723,8764,4197,791,6511,2523,2801,5258,6065,77,2068,6083,1671,1015,6379,4217,1786,7091,2224,3951,9923,2004,2203,9866,408,3878,1162,9847,5588,4574,4108,1001,8764,4175,1795,1511,2763,7275,4520,6011,6312,3315,8749,3598,8018,7963,6936,2921,9161,4228,9902,5676,8348,3232,8702,4307,6477,3789,3259,6335,6763,8953,9145,4235,5684,7656,8205,3655,3082,6826,6006,2333,2606,1187,8287,7986,5182,1918,7547,5172,8852,6439,8767,2695,455,9274,2291,6045,32,5233,3934,4457,2788,7008,2751,7833,2323,9913,2336,7112,1839,8336,8171,8899,83,927,1979,9722,5028,4048,7789,3184,1716,196,6394,3355,5306,5233,4615,401,4503,8156,5023,6436,6317,9263,3013,3378,1768,6802,9467,7292,2587,5349,4924,2291,2903,3237,7614,1546,7787,9910,7614,4398,3737,9323,1450,871,6433,553,4117,7783,964,8021,1319,9855,7500,1178,4626,1123,885,8076,1230,2036,501,981,5788,4964,5168,1473,6564,8526,9519,1831,2302,4031,2755,8608,7541,4740,2253,2030,3370,7644,5384,9790,2667,6776,3365,3056,1402,3820,6297,2978,5458,7983,8512,1191,8994,5068,7117,9721,2433,9293,845,8054,3670,1315,8215,9199,2070,4170,9726,4065,9297,4835,3506,7145,7470,452,1645,8535,4721,6611,8317,717,9215,9847,5784,8194,4975,9997,8223,9088,4770,4025,5830,9600,2020,2987,8039,8022,5315,9038,7844,9031,5624,68,4570,4215,3814,6047,8647,7412,9086,1854,2153,8927,9289,4424,6093,3144,1813,4192,4855,826,8863,2216,4101,9655,5303,5984,6191,724,4124,2774,2596,921,441,6259,7313,2481,5270,7378,3875,7736,920,6615,8880,2114,4946,9568,9460,1435,9185,2036,5588,1021,6756,2770,5710,76,2452,8346,8200,8855,3853,2420,9704,9557,6779,1630,2489,963,3239,2568,4214,9751,7699,1914,1065,4775,4565,6242,316,4968,3631,2034,3358,9205,6332,4145,9272,9001,1866,3348,8890,2883,48,2746,8037,5373,9694,8619,1179,206,7633,1150,6458,1644,6217,2711,5780,8676,3870,7111,8677,4851,9008,7050,5107,1532,6027,2278,877,4597,2973,4510,4782,7291,243,1644,5145,8596,6083,9184,5105,2582,5049,9768,1595,8294,3824,2437,8353,4696,4613,194,9174,9263,1663,1210,8445,4219,4697,4272,4796,7547,2532,1966,247,1056,8452,1661,6644,6439,9989,3106,768,2749,2516,2474,9445,9831,4641,534,3088,1157,701,3015,4203,399,4722,6865,4991,5181,5565,5570,982,8366,2571,6410,6915,3385,7865,8465,999,8098,2851,8060,9781,5929,8734,1117,1303,7920,2604,5641,4308,5201,6065,9774,471,2285,2541,4701,93,9316,5213,4446,1101,7774,3698,5157,613,5648,9786,4681,6832,6891,6728,600,816,6041,1176,5900,1985,7887,1108,8392,2437,6252,2256,80,2952,9783,6572,595,5917,3371,8604,817,438,1901,1041,980,9679,397,1769,3907,8710,7436,9863,4939,7405,7649,6573,6250,4760,3641,6816,3343,9276,6189,8281,2107,6240,1267,8233,2266,3242,7877,837,6329,6825,4516,4456,7793,6116,9145,8387,9084,8962,3411,8300,7389,7907,555,7602,180,4951,6968,4489,4117,7160,3466,5917,6920,5646,53,4360,3577,3591,1794,3369,2877,9203,2643,5739,7552,8300,2307,4678,968,1586,4884,1021,3037,560,8406,1812,4443,6734,8432,6416,841,2315,1494,5704,6884,8502,5772,3959,1756,9708,1790,7034,1154,9493,6776,2212,7557,2067,1672,4979,9834,4648,536,8543,9527,8062,2365,2524,9581,6691,6990,2163,8638,6952,7694,4294,1695,3782,6915,8067,2467,6888,5058,2316,9893,6241,9756,53,2407,2043,8234,5872,6329,7553,3073,9042,4710,7733,7654,7761,2364,2134,2634,9736,5353,9452,7716,6310,6975,6487,9946,8348,6939,47,7188,128,5164,8028,774,4587,4439,6754,8131,2425,6911,8310,7407,4477,8866,191,2040,8060,4628,2139,6262,1639,6474,8775,5872,8641,4342,3002,1385,6685,7496,7116,5720,4636,5208,6924,6299,695,9990,4019,542,5632,5585,4625,9101,8155,3571,5894,1594,2397,9925,4424,298,4783,2211,5550,8768,5519,8004,6929,1920,6558,5551,390,3046,859,4209,4353,5858,6876,8865,6523,7510,4322,2507,5672,1345,5866,5762,2735,981,71,1201,9414,727,5965,6169,3475,2537,7364,3390,8655,5267,9123,9783,1313,4350,7570,5301,4891,3320,501,6681,9234,6770,5023,5241,4476,6623,7577,8276,2969,8117,7695,2238,6491,699,4711,6996,5061,7773,338,2721,7047,2032,1544,4988,7943,7291,6419,7288,2463,8778,7527,700,9354,5635,6314,2852,595,9079,7819,284,2764,7558,8580,4892,7163,9837,2570,144,1736,8022,1941,8297,7359,8500,2233,7828,5400,7156,3206,1531,370,9872,1116,2038,8715,9225,3097,2867,4950,198,5145,9752,9362,7630,1346,1734,8654,6205,2703,2478,6629,4402,9043,6118,4291,6003,753,5671,459,5645,92,7265,3317,6213,8140,2084,5131,4320,5776,9226,6674,7139,6211,5509,4590,8577,4056,5581,757,9257,5238,2808,8344,8851,3180,4597,5450,4400,7141,2793,7476,5356,2145,5839,865,9540,5869,5146,1127,8736,5616,8329,2328,5018,3448,1723,5524,3530,5388,4398,1732,9536,7268,8911,4433,2398,5925,1925,3431,2026,5787,7985,3808,4262,7143,4994,4909,1936,940,9521,3256,2768,4638,9321,384,1724,2688,7619,1852,6075,7791,5268,3448,8576,2075,2849,8584,3102,3421,7649,8218,7666,5950,9874,6964,7037,3655,6375,397,9241,5990,9658,9958,1705,9702,4150,5116,5785,6382,2315,3281,6499,8925,5081,4691,8456,6924,3652,1798,856,5150,7436,799,9343,9315,8262,9147,2543,7145,5393,5499,5744,6975,5880,4494,9238,3839,9642,8454,5561,6749,8265,3334,9249,2640,475,7226,1229,5531,2680,1577,5767,3466,4806,1007,8865,537,6270,5073,9309,5573,639,3726,5531,785,6371,5671,782,6683,2650,5567,7924,2394,8961,8453,1889,677,5406,3898,5318,6310,9110,133,9730,8124,3997,8225,9019,225,997,4950,5802,5609,2159,8209,5594,9651,8495,9650,3400,3245,2146,7897,1545,1689,6542,616,4830,2272,145,9064,8201,8461,1682,8947,4676,9695,2511,7528,9645,2569,2370,9540,1373,2620,2642,8740,1129,9866,8148,7440,1147,8529,3073,3968,3952,1003,9020,5363,5007,3635,8398,627,9264,9514,5458,8214,879,5991,7682,4399,4160,7263,7640,6210,5474,4029,2736,4664,8567,7557,18,5758,5538,9390,9053,7554,2769,4283,7899,2300,3003,7473,3619,6926,3544,9699,4091,4104,7594,9583,2556,6988,7678,4637,5461,5919,3987,6909,3900,9156,9688,283,7313,7217,8429,1664,5601,6014,3758,1367,1461,3920,5022,1010,9872,3199,1530,5316,5070,895,4058,7476,9674,8432,2649,6716,4945,1854,9556,6124,149,160,2532,3160,7808,927,3224,6007,1387,5183,9619,4136,7260,4736,3069,7428,9535,5649,3133,4577,3238,2246,1851,4327,2031,2198,85,2200,8900,7908,1440,6569,2165,9367,9223,2992,9876,5101,3649,2951,1899,5927,2635,9328,8238,1473,6504,3127,9247,9129,517,1221,7001,7837,180,8295,2938,1181,153,9145,7891,7770,1877,3920,942,1242,7405,7739,1242,4188,7500,6194,5697,7621,134,4478,9877,4136,1615,892,180,6289,441,4789,2451,4041,645,4987,2165,3525,9996,2725,6306,8331,1559,6195,2563,3254,4544,4373,2806,6188,4077,1563,973,1104,756,909,740,642,5239,8128,9201,7906,8809,4335,6533,4932,444,2800,792,3951,4495,4230,1367,6695,8095,1199,5482,9162,4478,4913,1837,8726,5666,4211,3651,6753,968,3941,476,9059,6590,275,8141,8616,9396,5002,9922,4365,1187,4531,1100,4948,8076,9498,6349,4291,7298,1151,5283,6642,305,9345,5527,518,5622,6042,9967,7037,9535,3956,4733,2927,2841,4500,7784,6526,1714,5471,2127,3374,5109,2615,5579,8182,4746,1545,2764,5061,4584,7726,9055,2507,7904,3048,4366,4618,9687,7957,5376,580,9341,5404,1633,8315,2652,6092,6770,8493,1860,1332,2670,6923,4363,9157,5087,4273,5601,8558,9342,4588,8825,2607,6350,7856,8718,3489,997,3919,5335,2095,1832,407,661,287,4166,1616,6489,5989,2673,4499,8910,1622,1806,9451,1767,20,7568,8901,7217,5412,7827,149,1539,3935,887,7110,3560,8878,9921,632,3028,8164,9125,7064,6701,295,2136,8790,820,4078,2866,9437,8068,4437,7297,281,5672,4792,8771,8521,755,8367,7094,8424,4322,8524,7735,8968,3305,5904,2890,1837,7609,9319,7954,8272,1967,9121,3254,3114,3311,2290,8643,7835,6817,2140,5151,9216,9488,5265,6387,8862,2654,2326,8063,8786,695,2936,5117,9816,6755,2314,6938,1805,626,6161,5944,7471,7846,1773,5403,3082,7213,100,2418,8537,5726,6494,7116,8351,1274,1137,1791,3472,8057,4422,1393,9156,7248,1668,8538,2146,311,1342,403,8043,4902,7894,6375,6298,5748,1034,3779,2755,9869,6434,2817,9685,964,2650,9846,8029,2657,8603,5252,40,8414,1113,4528,7189,6096,9828,1993,1058,9651,5097,4599,6356,597,482,8715,8457,2998,1925,8968,6606,5414,3083,3370,350,6328,5947,8020,3409,8831,4419,1580,7634,1886,7319,175,2597,7500,9773,9773,3393,2773,9524,2382,35,5583,8665,4811,3026,3178,2969,722,9953,1799,6647,3055,8729,7133,3213,335,1733,4664,618,3289,7333,5787,5505,7166,6581,4694,2802,5016,4261,8386,8173,9284,6760,1387,8420,9675,2757,7785,7954,1855,1922,333,4922,8226,8995,6215,7691,7620,5968,2211,1637,881,2536,8358,5157,9798,8242,2983,4966,9354,1757,6241,485,1674,8432,3665,5795,6542,1239,6766,7297,1701,3070,8142,5284,1659,8980,1838,4563,2284,9972,2300,8653,2728,9871,6509,7209,1852,5980,5864,2532,9272,4548,5614,1443,9045,4638,2162,4076,2655,7654,8361,2269,2339,6069,8338,9908,1455,1845,4373,7631,8091,9967,6398,1102,8783,5912,8500,805,5450,1203,138,6911,6758,1979,2444,836,8901,738,8776,4256,5262,6467,4072,3021,5373,1199,5114,8622,1925,1380,9555,9864,9578,9800,2618,4304,2579,8484,6850,2874,6004,9161,6224,8892,6835,7984,5498,7060,8464,6331,492,2235,9936,7781,5024,5163,7118,1172,8536,3711,2291,1092,2122,5895,471,3965,1388,8307,7922,4130,661,6373,3555,9939,8100,1636,3899,4722,4655,3001,7841,5559,6097,5020,5964,2641,9046,2868,6674,6810,8917,2902,2565,4635,5978,9882,1590,1613,9516,4569,2012,5831,5027,1307,52,4848,2416,3999,4765,7115,227,9769,8273,2499,5933,3554,8163,5577,7625,4802,2067,390,6810,876,3936,70,4543,3127,327,7848,4375,9133,5451,6775,7305,4961,4608,1852,7270,6544,7192,1018,3144,1474,6034,6278,1035,4560,5308,8969,6872,7786,3371,4826,4451,4830,2166,7840,4337,248,146,9162,2445,1360,3116,6855,6310,8514,1220,9261,4536,7977,4389,49,9779,8261,7629,7572,1744,9603,2381,832,9844,2018,5846,981,4596,5835,5579,4966,4442,7903,1179,280,5685,7799,8581,9185,6696,124,2500,7321,8574,4760,6988,8432,8365,714,8888,3714,4809,5437,7059,5206,4166,6668,7465,1062,5289,1888,1614,2798,6890,8295,1018,7618,2065,1818,3922,8573,528,5283,2977,3682,6042,9118,9345,3352,9917,5930,1352,7392,6079,2616,80,4865,6254,7351,1890,6689,7754,7847,3866,8563,2053,3733,3654,338,2636,1689,9315,4582,2513,8787,4343,1120,7223,1984,8479,7291,5705,6450,7330,4883,3144,5118,8071,7979,917,3698,7732,1810,6386,5442,8251,3826,7320,1029,5163,8616,8911,2524,5002,4040,5641,9918,1287,8342,6044,457,9600,1281,7515,8676,2356,3512,9804,7773,352,5246,2544,9668,1091,7735,4963,7092,9473,5520,5717,2225,5214,6109,6367,8391,2443,6982,5964,2897,1282,1977,2823,9656,9835,5292,6177,2762,1521,7424,3621,4221,6330,7572,6984,6546,9277,6777,3127,2195,715,4585,3954,9288,8815,7069,9426,9923,351,4656,8982,3167,7267,1611,2164,4858,8213,6990,8042,3283,8190,1340,3041,7236,4982,1617,7885,810,9581,9970,5882,3096,4905,9652,912,8862,4859,8092,6718,1943,355,5261,757,8831,8277,3750,8323,474,6239,6231,4288,3427,3319,7302,6633,6854,4679,5208,5326,8258,2299,4680,4871,6290,636,6361,6646,9781,8509,2132,791,2328,6575,5975,1865,9250,4260,5477,5740,3117,753,6745,9082,582,9447,8977,9423,8206,1122,4879,6561,3118,3319,5792,7253,1338,6191,1176,5802,3075,9104,3542,7547,1769,2373,7134,7747,5687,6601,1402,4994,2820,1673,4962,5291,3094,9618,5417,3626,1561,5743,63,6317,9833,2258,6227,1211,1536,9245,9264,1297,8459,8605,3357,7770,5047,9927,790,7888,6957,5472,7266,6798,7589,1982,6843,7426,984,1015,227,9065,3626,2785,4178,9530,577,6191,2629,2197,6387,4369,7345,1312,995,8053,5648,8657,1179,8356,9706,3099,329,845,7441,8701,1522,3788,2729,9828,8756,9412,1582,7409,4701,5694,6541,2209,689,6440,953,830,5152,7208,7410,8884,1797,106,3258,7129,5468,3498,57,9442,6091,7085,3082,5704,6607,1253,3806,5032,9632,3106,2057,9650,8840,2013,8863,7299,3510,5189,2532,9222,8888,7912,6592,8761,3423,7932,8477,6293,8896,3595,772,5821,3235,4176,7553,8535,753,7788,2718,698,800,9054,4920,2159,1097,2255,4127,3259,4541,9747,9102,9495,7504,9757,5406,2755,9889,4076,7952,7042,2868,6878,2268,9334,425,8325,6328,3684,9850,6434,3490,8444,3286,6969,349,3086,805,8013,3745,5520,8625,5238,7556,3821,6405,4763,5495,5123,7822,4003,60,8130,9326,7981,4191,6815,1989,6286,5662,6970,6958,829,7367,344,1420,6929,4355,3543,8147,4240,3239,5722,5613,831,224,1784,5453,5483,2537,4398,5891,7222,5816,2194,7365,6181,4728,432,166,6430,9422,3525,363,5034,4806,2933,9759,1697,3379,3026,5311,2734,5656,403,3364,2529,5170,1253,7863,4802,9590,6365,8370,5795,8023,5452,4627,5667,647,8610,8140,9474,9169,2586,6156,9020,6247,2709,7353,857,3332,7487,534,1198,9754,6603,8182,828,6877,5733,3301,5556,1955,4209,4729,9406,7655,933,2068,444,4326,8067,233,9965,9933,2086,6311,1137,903,6051,9357,6085,1562,7753,9577,6437,2284,6768,5697,9872,4996,2738,6620,4543,5671,9494,4761,9703,8009,5134,3437,8546,183,7072,4661,1064,9950,9206,8483,2111,5318,3697,4992,3636,6762,9988,3555,1676,7532,8967,5058,5319,4191,6919,5114,9243,4825,6954,6424,415,2271,4628,9665,6938,3593,7100,3647,2140,4442,36,8547,4465,2501,950,6430,3906,5797,1666,224,6801,441,9208,7494,8771,2770,805,8715,653,5637,8047,9343,6273,6311,3688,1230,4724,2970,6620,4473,975,8868,8510,6489,1988,8063,6258,119,6765,8626,5765,4284,7499,1496,166,8023,2761,7783,3013,4310,1013,6348,8250,1592,3689,8539,243,3363,9259,1942,5228,2596,4105,8271,1633,2471,3435,2205,625,7108,8709,951,6184,5416,4001,289,1038,5800,3726,7468,3231,8843,9410,1832,1420,101,8879,9003,1887,8462,1629,2800,9675,6821,6712,2174,9665,9950,5026,2590,6675,3635,300,6016,6005,1692,6938,8232,5984,1494,2804,8084,4837,5542,9755,2882,4170,4657,8574,5675,3587,4253,218,6824,3646,3806,1493,9015,9874,5120,0,9288,5755,7933,227,6452,9585,8848,9929,7881,5180,8709,8559,907,3815,9399,7051,7129,6964,5431,2041,6719,101,4816,7916,6918,9479,8709,9746,2867,5714,5704,1653,3443,9381,609,8414,7643,8466,82,2031,452,1627,1912,2709,2184,9645,487,801,3640,1239,2016,4460,2378,9994,8242,4375,5036,8736,2839,7125,3341,7188,3186,8731,5939,1698,532,3430,9463,8986,2764,7647,3883,54,2340,2309,7590,2090,3220,7122,4511,4289,9303,1215,3813,9543,6584,6331,238,156,1555,8880,6094,1471,3829,9634,5961,660,7783,9220,1180,2063,2234,2273,5900,6574,3451,7543,5002,4188,9904,8255,1044,5128,8244,7086,989,7164,3280,4405,7376,2862,7739,4495,2301,7236,7817,2065,2545,1905,9568,3826,8412,2342,2377,3991,5770,4569,6360,1864,6084,8343,5438,4102,8856,7478,6381,3095,3836,2245,5623,389,6747,4783,2250,8308,9097,5782,8545,3439,6622,7567,2906,5394,8800,6464,5901,8921,1717,7105,4941,8097,3417,1968,6509,4578,2498,4513,1538,6917,3113,7876,2554,8616,9750,2600,4513,1327,5624,7641,7601,2267,4607,8499,4419,7480,5342,8327,2974,4247,8664,4575,100,539,3524,865,3134,4740,4186,805,8511,919,8069,4659,4414,7393,1995,4554,5202,5060,4934,8604,2192,6583,4993,6430,9374,7310,7628,6436,9826,6558,7728,1864,9423,6031,9095,5922,3962,1698,738,5164,8376,2394,4108,3356,2355,8465,8055,9638,8993,5573,9441,9638,5430,143,273,8626,5285,1715,1851,9652,2815,7119,3519,7747,2791,588,6444,2049,4743,4953,418,609,6222,1490,1293,1453,196,2090,7439,839,4962,5146,2470,2526,217,9256,5711,264,5884,6936,9501,9924,6358,2432,3226,2288,8361,6913,4415,1256,7926,9662,1456,4810,7179,4155,3085,7467,8356,2373,7366,1665,5277,1897,6097,5513,146,4884,4045,1078,8540,2333,4208,6803,4953,3076,7214,2271,9961,7957,1286,22,4098,3811,8937,6567,4043,8129,200,2849,2708,7017,5069,6749,2105,5143,5580,8035,5562,3266,4396,7927,2876,9704,8696,9829,5435,5320,1790,3899,3820,200,2832,3862,6742,5373,953,3816,2424,3754,4043,5977,4140,2926,1810,6097,3709,5000,2945,9857,8844,7109,6051,3449,7848,5809,3673,6417,8804,8675,9540,7481,6206,2930,5903,7392,1034,4795,5172,6807,5489,6819,1272,7917,6572,3082,5791,285,6171,1080,1022,5850,9436,8293,6080,5996,4072,6802,9950,5844,705,1688,7479,5930,3068,9017,2175,9829,8128,5010,9983,7498,4237,55,2082,8922,3196,4880,4653,898,3776,2131,7384,2920,5658,1359,1757,6845,4561,4997,3730,8728,1438,3140,993,4939,1609,355,8270,8271,7820,7465,8566,6148,2864,7224,4282,302,139,7040,2522,4416,9683,2811,1786,5760,875,6895,4770,3045,5851,9115,2335,3793,6118,5306,1004,8489,2630,6837,8633,9603,591,6947,3038,5951,1878,270,6149,5451,3977,3644,928,6006,106,4494,7079,3778,9321,172,1998,9114,5295,2004,4242,966,1303,4966,6521,2133,1307,8490,8190,8352,6940,7976,8570,263,8302,7416,5930,4407,6130,5972,7045,5583,124,7612,5148,7043,4941,188,4859,9055,1361,5393,2095,5300,382,2058,9152,405,1072,4842,7697,5055,854,8753,5771,3513,3387,6092,3541,2770,6471,7653,6983,6709,5378,116,2915,7866,3422,5939,7399,5352,4066,3003,4383,7088,7975,4751,8998,854,7621,465,6964,126,2279,3860,6131,58,3059,7247,1211,4922,4429,9213,3527,9413,5503,9817,1714,6553,5500,9431,8813,577,3597,9722,9713,6005,4175,8415,3689,2601,1966,7042,2551,5544,7064,9758,2126,1549,8250,9693,4668,9133,6332,5808,3631,573,8254,4861,4569,5068,1988,8549,5648,3314,5458,8990,1815,4809,4504,8342,7067,5915,3250,2963,7413,3925,6775,9524,2407,4199,2053,2484,2196,3951,5440,6299,317,8960,8212,1539,7688,7839,2770,3367,7228,4113,1235,1709,6432,2715,7079,7400,3878,716,3411,1956,5902,75,1220,621,7455,9075,4453,4464,7022,1175,1685,6391,6450,8265,8828,8820,6181,8351,6510,2496,9537,2800,5705,1971,7398,2185,6105,1511,9323,4598,7836,6916,6050,1184,4575,6759,2133,3846,5364,5920,6351,6796,592,8777,9556,8293,706,2716,6667,5015,2164,3142,4638,9224,237,9075,3362,9756,2447,8702,6727,7521,4832,9262,3486,1132,57,6805,3622,1405,1317,328,4691,1297,3225,2117,7578,4765,5270,175,143,1603,3308,9569,2847,5320,5213,9081,941,2503,4257,6268,709,2575,5115,8718,5197,754,6275,2418,8300,685,3019,6403,1995,5007,5872,1968,2418,8806,6146,3200,2928,9402,9895,4847,7668,3750,9817,39,6851,4350,6202,8286,505,4890,3529,6817,142,5383,5011,1493,2763,3068,6794,1524,9295,5728,8391,4347,4826,2908,4626,6246,3736,8663,2456,6520,6750,4991,2228,4666,959,7592,9860,9159,5244,7068,635,9402,1484,8170,6816,6574,9240,8641,9194,3840,3767,3252,5940,2182,3193,8690,1144,1188,4437,7712,6093,1922,8482,7531,5774,6465,6680,7606,2686,6703,5138,7890,2266,706,5518,5154,7759,6105,5475,5088,4039,3232,2710,923,4656,7865,3558,7162,2855,6760,3324,3020,4408,2553,590,5851,7555,4058,2694,3181,8369,2325,7377,5585,3670,3600,8580,9666,2541,9221,2609,3286,4887,4810,6148,7674,9098,2784,9088,2321,5200,5156,5354,4266,9975,6419,1686,502,4213,4459,3021,1319,9114,7313,7095,2625,8258,5411,6342,3499,9278,5074,9789,3394,9885,6766,5928,2077,4200,7497,7437,9929,7797,632,5756,6392,3672,2142,5097,1866,9186,7587,6277,4619,2723,9772,25,8820,5436,1548,9673,1820,3040,7665,7266,155,8067,7017,462,8668,5539,700,3220,5404,7107,2356,7104,5028,7901,8568,9843,6093,6396,6244,4914,9006,4291,3171,6995,4023,6051,1659,8320,3495,1527,8382,5331,4256,8535,5403,5446,2977,1034,4149,8912,5784,1078,228,2425,3141,3325,4629,9159,7263,8511,5659,1894,7482,9431,6705,7531,4761,3350,3444,5200,3560,8304,9354,1586,557,1530,3434,8153,1929,490,9191,5762,7627,8292,8811,9786,2430,4767,8869,6165,1624,9280,9152,4355,1987,4138,6883,9626,7723,6385,3751,424,3371,1455,7564,5770,8586,2458,1413,7598,3630,4039,8442,935,1365,2065,8811,3984,8857,8433,7331,6255,4554,5650,231,5641,2457,5352,1061,6854,1996,6940,1124,2430,1613,9984,265,3722,3210,3394,9611,5271,7716,6761,4435,477,8417,8537,8233,512,5739,8826,9239,6717,462,9215,4555,7642,7538,1594,9893,1574,585,6285,1546,6147,5189,3791,8465,4059,2759,5604,4321,1658,766,2691,4075,545,6929,1756,504,5547,1560,5921,6063,1196,6780,4275,3459,4868,9847,2541,5058,3991,3155,1352,7023,4400,9274,4220,6392,9712,1899,5758,8073,6353,7908,3110,4278,6182,6099,1143,8560,7957,32,1150,9341,7987,451,4079,3837,1215,3690,2659,7880,773,7109,7175,2874,5684,1846,5063,9902,9091,4003,789,2338,1470,5721,9397,2247,662,6996,9220,318,689,40,4849,6091,9681,6278,4816,4610,7688,4777,1730,1098,5810,463,4363,3947,2940,6626,9072,5517,2884,9050,6240,8241,3365,6886,9848,2015,307,4308,8044,7919,3377,2309,2888,9357,6716,8741,5789,9200,4912,4049,5615,7191,2448,6153,2627,2365,4666,1617,1827,8007,3557,9657,5173,1766,9711,247,6044,4381,1427,9491,7542,4317,5286,7897,734,3789,2969,5674,8205,7877,1080,4901,5089,1703,9915,8449,9585,1403,7306,881,8266,6152,6872,7545,9603,5604,7333,9166,3235,1759,5553,7204,5875,2548,7457,9813,4037,7157,2052,3097,2221,3643,56,6370,7089,740,9,9385,4571,7863,8939,3033,7607,2602,2615,486,3339,3887,2975,1078,7285,8242,7940,2834,1518,2629,3895,8277,5101,4741,9831,6744,7781,9685,3793,9210,9584,267,110,5414,8717,5045,9492,8737,5311,5304,5861,2772,2247,9349,1379,5676,4326,7310,4997,571,7729,4115,894,3493,2588,397,3145,4649,1194,4131,3038,5205,8951,9362,8250,4076,3181,6693,3772,1271,8967,9409,5867,4269,8806,2094,4566,2636,5284,7342,3684,9997,2572,1220,6656,4033,181,4255,7537,6575,2274,2481,4519,1560,9911,4315,963,9347,2051,1581,2371,8291,1302,7841,3273,2329,9052,5967,646,9524,24,8845,9053,9462,7042,6631,7266,4407,9925,5346,69,7022,8772,9842,1478,3018,9427,3651,936,21,6235,7203,2027,6094,7253,4624,8179,757,9836,8480,1710,4093,4926,3203,8535,7027,5394,1975,3034,2158,2020,2173,7441,4820,6599,3248,7104,6396,7460,4843,5157,3201,3229,3630,6793,3669,856,5834,9742,3426,8716,6373,9061,6172,4022,3539,6297,2606,6387,6057,6207,2177,6114,3274,8768,9337,6344,1369,30,4745,3435,518,3207,2793,809,8459,1850,7186,8963,4254,4781,438,6962,318,9945,1355,1400,6675,2504,5407,8226,8294,5883,8420,4394,5175,2303,5871,7220,2937,8352,6642,8727,1767,8475,9116,1802,6444,5033,4860,7851,3253,8133,8201,2439,3982,332,3804,3822,2663,4721,7117,5693,5118,6422,4405,1505,5732,9719,2282,5645,3437,6894,9054,1633,5403,7751,4849,9868,282,450,7528,8381,7410,9575,4071,1940,4384,8113,4656,199,8758,3466,1201,3714,6250,650,7656,1392,3254,5098,5710,5495,244,5866,5360,6203,4486,3728,9704,6272,44,3301,4056,5630,2164,2656,675,7854,9208,1008,747,5740,3005,4425,5410,1981,45,7580,4778,3372,4612,8817,8155,8099,3865,9148,9734,617,142,793,7676,816,9250,8594,7893,5993,6381,2915,1573,4985,5183,251,792,192,9414,1565,4993,7770,5698,2668,8548,1958,4906,4250,616,1266,1038,9966,2442,5627,7823,6182,8875,1361,2997,2218,2442,4562,9255,9605,6796,2960,6395,7690,4988,7708,424,455,223,1026,3511,3917,3032,5848,7030,4058,5841,7118,4137,6537,9244,1117,1961,9105,7586,2651,5318,6200,3130,1095,5899,6597,4690,4756,2185,7308,4713,3699,8337,8483,1911,408,1984,5555,4686,8233,563,4274,6904,3893,5112,8498,9873,2682,442,9304,7379,2387,9240,2205,2565,1555,558,7954,1088,2116,4089,3858,4223,9104,993,4942,1043,2785,4118,9347,7570,4398,5039,2007,685,7322,4397,8586,434,9328,4111,3104,7023,3149,221,8888,9106,6322,1798,2215,8059,8942,8523,5866,8568,7496,8591,3341,4295,6917,842,2253,8603,1642,8157,6897,4492,704,3859,796,3070,8775,1554,4039,7268,7287,8757,7819,3147,9749,1246,8153,8593,2223,9130,7922,7740,4196,6193,3552,9649,8634,7464,6175,2448,7349,6933,3273,7913,4222,4393,9369,422,6433,6067,7131,3219,6807,821,779,4831,7535,7285,8286,8672,2079,3423,3871,9292,5235,279,8429,8853,6290,308,5766,1634,3873,7502,716,9322,3870,4370,4235,9927,6509,2759,2208,3701,3093,5861,3447,6944,5814,9267,9527,9131,9550,3074,1765,1165,5526,7481,6247,8281,6957,5789,8148,4569,5104,7029,6902,1461,6621,1259,5067,6874,5179,8315,1072,7203,9484,8019,9248,7290,3657,9362,6739,5069,9406,5030,1547,3532,9537,1805,3908,8500,2487,453,4951,3373,6568,6537,430,7231,5597,1074,6498,1511,8533,4409,9231,7405,3362,803,8434,2664,1515,6982,690,6585,2865,7251,3589,3868,8754,4944,4576,8549,9960,3216,2003,3656,7622,6858,6526,6491,7910,1665,1694,4297,2486,2915,9651,7438,5703,2848,8954,8811,2380,7276,6882,5682,9363,5488,6705,4854,3363,7419,9679,7642,7822,478,9430,8389,6133,4728,9096,7254,799,3520,827,722,7869,3406,5811,8318,2400,5946,2902,2939,6276,6920,2968,4560,9483,614,9818,7916,6061,2673,1832,7907,1345,3454,3275,778,9081,9396,9473,136,3074,989,3394,8558,6574,1863,7437,3288,8292,6036,7737,3074,6879,1690,5827,3672,4400,2991,4883,9382,6867,4555,6277,9319,2954,7231,2155,9168,2565,954,8991,5650,1307,4763,5253,3881,2793,5756,5884,5315,2866,9382,3753,3823,4183,4762,872,2227,9526,7649,357,5041,2521,3919,5750,1116,2782,3338,8311,7614,1237,4023,4100,9767,5595,5812,3879,8505,3768,4196,526,9301,7533,1435,6129,7717,6767,6543,2433,4605,7043,8463,1466,4171,4366,6289,8879,6874,8168,2766,6810,4535,8254,4828,7713,3794,2169,2599,7816,236,9005,1914,3735,8302,9260,3296,4650,5619,1943,6052,2012,956,826,4456,213,8828,5772,6491,4698,3001,7386,6980,7025,254,8017,2484,9283,5044,6086,389,6715,8408,723,141,7817,9290,8230,2971,4600,7745,5343,7481,1748,7236,1245,1795,8386,4029,5423,6017,6453,970,3157,5103,2516,8641,6502,3145,1421,6139,7935,4732,2822,612,5115,2534,660,3028,1961,8586,5674,1522,8979,3593,2056,6575,8492,5000,3253,4462,4629,1452,6615,5593,7981,6716,6181,3984,4622,1438,4607,7056,245,9128,4642,9388,4629,9420,5592,4089,3598,4058,7546,9351,224,1548,2333,3127,3627,7593,7724,8515,3952,8039,6800,1456,923,6852,4807,5958,6654,1045,1181,5919,1927,1417,9570,743,5715,3629,6864,3649,8027,1773,8987,865,1515,6915,8166,1473,5564,3349,5571,2579,7794,8672,7798,4898,2813,9288,650,921,1791,6760,2063,5086,4438,3822,3923,3230,1293,393,5238,4877,9,6028,6854,1924,6458,6003,9465,1144,6899,8493,4058,2520,5587,6188,4694,2988,9098,9813,8178,2707,8655,2266,2144,6947,4265,7937,8170,4072,4769,2205,398,8798,8589,3406,5866,1289,6806,3795,6681,4346,4736,7987,7980,346,9979,5954,3222,6716,434,78,9720,4661,9540,2659,7139,4862,9002,6416,6021,9710,1252,3302,3859,8253,568,1974,1733,6508,1160,1562,925,8194,6524,9410,3353,5283,1293,3301,1937,4194,4508,5777,6210,6667,9904,5896,1820,3065,9239,1189,5053,295,3913,5644,9090,5832,5748,7870,5655,2041,6894,6946,1034,7026,2754,9785,8421,6054,7683,9662,7502,1106,6316,7865,3266,4323,3565,9563,4634,1112,6261,7594,804,6751,1232,475,6176,3872,3779,5383,7748,1220,1329,3982,4621,2959,8457,2494,7263,4085,347,3318,205,4165,117,6107,3315,2310,9202,403,5552,9729,2395,5916,699,2103,9974,2508,5039,5269,2035,720,2669,9259,4011,4500,5991,6128,7626,5116,9916,5267,1688,6804,439,8927,4144,3165,4113,5622,6369,1190,3998,8471,6921,8708,5799,3836,60,8557,9948,14,1709,4930,2648,3832,1952,7818,8746,4652,6823,3847,4286,7641,5361,5780,1890,2631,1866,1877,6440,9972,1805,7586,632,2537,9390,5521,1626,3800,2799,4851,208,6228,9314,306,7650,3264,5031,3037,7810,4551,1851,7318,143,3090,8926,3810,1527,5365,6657,8351,7100,4061,9540,6334,8150,9357,4346,9882,784,6001,5978,1808,2320,6754,4880,4628,5139,1378,9596,5502,8750,3892,8409,8723,9139,6341,7575,5388,5314,864,6236,8275,3038,6739,8363,8705,3155,638,3262,7154,1719,4276,5967,4507,452,667,9081,1716,4753,2934,8274,4729,4921,6969,2963,3955,3086,3554,783,2869,7188,6754,1435,646,2097,6753,56,4230,7610,529,5199,9351,1547,6651,6041,7411,8135,8079,2381,3821,9473,9502,2892,2796,1203,6393,7832,7488,6269,7636,4041,1626,6392,3064,5804,9589,3800,6964,4855,4677,7556,7710,3448,4274,8371,6049,5747,4599,7357,7898,346,9350,5787,2048,1003,9484,7593,2736,1592,5122,2419,7129,5097,8712,9071,5986,1211,2131,9408,9220,4313,6304,9676,2895,8474,8994,9682,3613,2134,1438,1889,9376,1630,1769,7128,8996,8978,7968,3206,791,9420,3712,1654,1245,7964,2864,9068,2023,7503,5253,1404,9108,5503,5544,2271,4617,2380,4481,5140,22,329,7543,7267,1635,8834,4839,8874,7675,5755,8260,8917,4313,1779,3118,5377,4566,7292,6140,7815,153,3408,7524,5388,2933,1288,2999,797,7940,858,7660,2129,917,6049,3123,8740,5520,6250,3069,63,7179,5556,9992,9892,9541,6851,4268,525,2545,6399,7065,1390,3506,1539,708,5974,2685,4483,6913,2751,6110,9318,5021,6368,3520,3165,6698,6332,6058,9542,7293,8972,7623,7391,1334,2500,820,1955,9313,1344,5093,34,1480,84,1012,8394,9299,8651,5439,4421,2464,2729,61,1493,3297,1259,9187,6780,3455,4828,3134,4376,7056,7581,7102,4920,2093,9757,282,1237,2621,1200,2047,7258,4269,6433,2187,7672,9799,6150,5484,3873,154,5898,5968,9035,5553,2828,6718,7678,8548,5691,9991,338,6535,3230,847,224,2679,7768,3725,1855,5142,8517,9076,9712,2687,2373,5833,832,7735,1626,6380,6279,1942,3684,8482,9398,2508,9577,3655,6119,1788,8290,6988,5517,809,7318,5034,2250,6702,1626,8206,5023,7842,8751,3777,2191,8253,7622,2767,466,4958,2078,8232,6597,7015,6718,4063,7720,8452,7379,6934,9299,7575,6834,6180,9203,3379,3989,228,2455,637,6986,103,528,6979,4759,5267,5207,2735,8725,9338,2937,7727,8915,4227,6541,3593,7796,8194,9335,5664,823,7159,9078,4217,542,6816,6829,8977,626,2554,7541,1162,4709,3641,4693,6020,3253,9896,4111,9761,528,6790,1270,3814,6038,4865,3183,7920,2485,1437,5296,1747,5986,255,8432,3300,7515,6385,9760,3287,470,3142,4124,6786,4092,7775,3379,9415,5377,3694,6772,4069,8084,7640,396,9138,1973,2550,4519,8423,98,2217,3999,7993,3706,2570,3030,3062,7870,1351,6939,5542,9111,3271,4551,6244,9140,5317,4809,4871,6122,8978,2083,7620,3538,8149,4252,7855,4560,4742,1352,4969,9358,4110,692,2924,605,7223,9578,7240,5268,1893,2702,4449,2230,5595,5799,1591,6396,6232,7458,9083,6820,7708,3649,768,9961,9456,4397,7882,4592,8412,976,6401,8836,9759,7720,2791,1668,8697,4752,3319,7527,1427,536,9795,6024,1313,5398,1622,3388,5328,5271,3919,9793,290,4960,397,5395,4944,2406,735,5128,9821,8359,1458,4698,2265,4521,553,4406,9945,1426,1834,2621,3311,3152,995,670,6329,6071,8086,6092,2231,356,4367,1048,5338,7167,1075,5130,563,1482,550,2982,1631,814,3013,3260,3425,3729,833,3757,2904,9657,884,437,6080,1530,9278,7218,46,579,6717,9879,5302,4140,9110,1198,5926,9007,8425,3029,6382,6677,3494,9289,1591,9901,1975,6689,4111,3127,9607,7110,3605,591,6945,231,1630,5138,7765,4125,7257,4978,8679,3747,4199,813,9596,2744,7863,9452,3299,347,6043,6737,7336,7738,8720,2006,5839,7793,1743,4733,7749,2481,5962,8094,9642,2332,3984,9896,264,9310,1091,3312,9820,9002,9119,8402,9601,6377,4245,9438,2837,6281,2485,7405,5273,8806,8132,4593,9893,2379,3904,6744,4178,8648,6610,8284,9059,6410,2083,9762,8721,3056,7836,5995,8920,5474,8660,3861,6109,3365,9729,2155,7065,3431,1334,1875,1725,7532,3631,1575,1775,5903,2156,5306,8575,704,8902,1980,6451,1301,2344,3870,6827,4527,7698,7636,4600,3985,9127,8269,4612,5305,8565,3739,9697,9902,8737,5606,4101,5634,3220,3926,4196,1587,4209,9121,3461,7796,5679,6592,8422,1967,8900,3002,3833,6889,8221,2077,4392,3765,6570,3611,8396,7974,1746,604,134,6329,5663,6840,7267,3187,5947,3688,1373,3444,9454,4746,9001,6881,222,6449,675,9485,5472,7549,6570,2801,4176,3926,998,6908,3170,2135,1811,1036,7798,4491,8752,6776,7609,1606,54,2083,9417,8418,3452,8400,5893,5707,927,5357,813,6301,741,5447,6124,9369,1890,9326,9736,1758,377,3831,8015,5661,7391,998,6722,7816,424,3682,7599,4782,2915,2112,2894,2471,6736,5280,5352,1386,3280,1999,6190,969,7590,241,3976,7429,608,9547,4426,6061,6441,8763,5553,1014,1580,4693,4451,4372,1030,1573,5336,3297,5370,5394,3586,9130,2321,3129,1217,1289,3772,8068,2296,5056,6497,5475,1873,8273,9765,3732,522,4175,7401,3606,8674,3640,6901,7858,7929,1289,9485,6804,7062,9705,4897,8762,8830,594,4294,6593,5272,2114,6537,2094,2090,8396,3244,6850,3486,7262,9688,509,8950,4322,3710,6225,7930,1636,7517,1832,5198,1172,2214,3959,3314,5926,6356,7686,4890,8586,3497,9537,1976,8877,5837,1877,4163,8934,760,8080,930,1835,9609,6223,7831,728,4527,9612,6567,5956,1311,5571,9510,4730,4412,8316,2520,376,7868,4196,4768,113,6050,7001,7830,8469,6491,8011,4411,4663,1916,9935,6463,1238,4546,615,3904,8177,2893,8995,2463,203,4225,2828,8969,3753,9744,5960,3264,198,7162,4927,2927,5896,8054,8014,2929,6293,3504,9423,6286,1028,1155,7773,3614,1408,5986,1428,2321,4343,2674,1187,8947,4790,2896,7722,8412,2969,6336,9746,2445,5317,191,2195,7830,1460,1896,2758,9694,721,2894,2641,9395,6901,766,1664,5259,1427,6470,7180,3433,6590,9440,226,9253,2982,1685,1543,2075,6848,468,7016,971,1032,9292,6000,7600,2018,4453,3433,7842,6138,3900,4539,8102,9954,6074,3747,1924,1249,3935,7696,7319,3635,8582,1988,5554,5851,4804,5410,5225,3632,5922,6412,4074,5992,832,2909,9545,6150,5591,2911,1227,1738,5421,2322,5902,1282,2955,4069,7488,3481,9124,6120,9365,7733,7546,5694,5317,7821,772,5206,4406,997,1051,9196,8864,7870,7907,8446,1506,8759,2618,7092,6542,8072,7883,2113,6577,9337,2611,503,5669,4939,4812,6798,7848,8282,8528,7368,6976,6495,8412,53,1393,9210,3517,1840,5139,63,7142,7216,9811,8820,831,6548,2704,9458,4356,7514,5508,1247,8365,2998,520,4476,6150,8452,4895,6357,3101,6032,5342,270,7159,3057,8058,7676,1135,5271,5908,9272,1335,4968,756,9374,3066,1355,5259,8460,4835,330,3932,5249,565,5182,7886,2010,1121,9391,2928,3331,6278,9175,615,7594,4017,2760,8243,3624,8614,8517,9759,600,1556,8472,4612,8976,2825,5857,2175,5691,4594,4597,1853,9479,2163,6905,85,9648,9165,3214,6438,2368,9901,8926,239,3864,7697,4538,7678,2840,917,5908,7768,9283,6746,935,9963,6107,6909,9599,7573,5193,6071,4451,9410,7770,8507,7962,7861,5275,9104,7598,5991,7938,9335,3481,1298,5613,2207,5352,8135,1161,8644,6572,3106,2226,2336,7985,649,2744,2481,2840,156,366,6163,685,9887,7161,4385,4837,3717,309,7978,7673,8152,8494,3866,6392,4657,9689,8760,9618,2676,8446,5714,402,5082,9636,9469,9759,756,3347,4424,5582,7761,605,2341,4242,9731,8523,3810,5041,6009,2396,7974,5132,5432,6507,307,8174,2863,8302,9969,7362,2523,5178,7409,8826,8776,7308,3376,8159,6014,8479,1245,1047,7758,2688,6341,1246,2389,2790,3840,6001,7462,8185,2217,689,3682,4219,8486,3297,416,9909,8566,5033,1245,1513,1928,3954,5312,8946,9289,4051,1909,4319,765,3341,8952,3288,2239,5545,8824,1569,8420,6098,12,6705,8692,6601,4027,4971,1319,2915,7578,5441,7265,3285,3183,9358,8680,4031,7056,2909,7547,2482,5132,7686,4080,6856,3415,9125,4127,9375,8348,4586,2839,2658,4326,7104,7290,2209,3909,1620,2540,1984,6426,2753,4495,2098,8116,3510,4970,3771,9691,2883,7478,9785,2614,9932,4875,5488,2002,1345,5494,834,8773,1713,9196,8656,765,5705,2872,5373,3793,7731,1145,2817,9814,3945,7496,3691,7190,4759,2280,1960,439,2058,7083,4750,9903,7398,3292,4397,4434,5519,4023,2142,9202,2925,3911,4706,6,7956,1876,6316,3722,4666,5870,5238,1113,3953,8122,6766,70,1367,6941,3580,8364,9595,4806,6173,6796,4026,1911,2927,2924,1712,1854,5049,1343,3533,493,1936,2375,8039,7814,2948,360,8932,2531,2296,2252,8661,6852,5180,1774,497,2036,2711,4156,6764,7285,4626,55,3320,8789,1705,5240,9429,9710,1996,5706,1814,14,7523,3524,7813,128,8096,9348,3501,5257,5277,1926,5877,2811,8125,4123,7849,3466,3585,2210,5950,9995,45,7153,7166,8682,4697,4596,2342,9427,1457,7159,5176,7713,3422,4378,8485,7519,2803,6634,4529,5071,765,3711,6813,866,4374,2503,175,3403,6756,6232,6496,607,549,4629,7771,4391,2673,919,4700,5985,2064,3822,8736,4744,6809,2763,1628,3883,5135,263,4743,5448,5313,5830,9701,5980,8066,454,9080,8840,6952,5721,4415,796,6075,4341,75,7644,6075,1232,8036,8551,3033,9691,9385,4142,9350,5685,3449,8068,5828,2117,7468,4814,5324,9626,5732,4547,2496,477,3861,6098,1607,3140,8909,2282,787,1866,4515,818,5405,5872,9874,3877,5930,2199,5468,8151,8949,6269,9973,708,3449,3663,5244,4963,9441,5812,4613,7607,2509,2829,426,7337,9825,7061,817,5847,5723,1852,2221,8885,5468,6026,878,2645,2690,9106,6805,4881,8467,7562,7055,8209,2050,8953,7912,5471,5629,5941,569,8756,2611,2265,2305,5639,4598,255,8389,4165,3580,3223,1090,529,6097,5769,4297,3068,351,2917,6781,3161,7522,3647,2257,3462,5080,6130,5552,5779,8201,9715,2353,4105,6594,4980,9128,3577,1468,1213,3426,6507,9485,5917,7906,7451,8569,8920,2879,5031,126,891,8530,4841,3716,124,8249,7715,4229,7947,274,6500,1033,1136,6682,8211,1930,9553,3410,8247,6695,2955,8247,3181,4347,8652,6119,6489,1959,1836,7904,7290,1097,3044,1937,1569,900,6583,245,6570,4366,6613,9464,1531,1845,4839,4851,785,3532,4297,604,3340,2495,4447,9340,2251,7427,1487,3346,8107,851,7656,6152,9356,6704,9582,7889,3584,427,7548,4382,1538,3398,874,8693,6916,1305,1989,582,8302,8191,8077,7458,3757,3170,7360,3345,4667,2204,9805,5925,3858,9175,7924,2466,4900,4298,2607,3468,8855,7235,7441,2745,6523,6203,9608,1664,3050,8027,235,717,4992,3531,8708,2740,582,6205,551,4854,6856,1881,8784,7510,7381,1892,1113,3543,8949,5420,8589,3902,4837,2695,2841,5790,823,7993,6314,8584,376,5057,7894,307,746,5741,8780,199,7936,9986,3338,6165,8333,2134,6868,3220,5997,3449,9537,2184,8341,1012,5774,2773,9828,9089,2237,4937,9521,5795,6460,7791,8110,8278,9174,1266,5970,2186,2817,4713,498,5298,4401,6777,1966,9658,3787,4308,5219,7874,9539,5344,8508,2126,6046,1672,4493,8827,4135,2959,6425,1102,9501,9161,3222,2949,4191,8252,2310,9767,5479,9555,9310,8031,5744,85,5286,6729,8786,6240,337,4676,5369,5271,5887,2858,2252,2656,162,9223,1522,6956,6422,4888,8171,5918,3274,3787,7224,2719,2026,9022,1568,4909,825,7020,2874,2749,5201,5384,4870,9431,3497,6879,4098,7523,6185,9239,6808,1621,2787,1020,6245,3464,6119,6836,7115,2166,990,1080,1691,8519,2773,7286,8473,479,2808,791,1679,1211,9270,5614,328,445,7667,4514,2541,7692,2955,8634,5533,2695,6598,9421,797,6093,9787,9681,7139,9388,8464,1419,1928,3643,9920,2588,89,6241,3357,5033,6154,1944,5030,1910,2134,2359,2803,9024,403,184,8653,3604,1620,3072,4659,1323,1122,2465,2573,2215,2818,6889,6335,3346,1974,7792,8073,7858,9936,250,641,6673,9114,191,1560,3369,2230,3657,4768,2247,6787,6791,412,5381,9082,4978,5461,2188,1691,1691,9400,9805,1924,8606,1603,2780,1009,8170,5547,3106,7576,9260,5879,6652,7675,9933,5799,6569,2187,1006,5671,9082,805,2721,6920,5120,1982,9074,7471,5649,5802,2403,4778,7862,3324,3168,8586,2779,7923,6028,1504,4959,7079,7666,4098,2681,9437,146,5167,9995,3537,756,9817,1333,2495,2713,8307,7224,6506,2801,3381,8123,2899,6562,2817,370,3450,5837,5548,703,6906,6353,7514,8109,4774,198,4422,2652,2529,2465,1524,1949,7366,9801,5407,5826,2951,1207,3641,9715,6129,7811,2258,3610,1007,2627,6745,4513,2974,424,6090,4926,9052,7867,812,4524,8644,6496,3637,3788,723,3727,3589,6806,5683,8694,9119,3997,3896,2621,1921,3491,2888,3405,1731,2959,279,3629,7818,1279,7554,3488,7261,5083,9200,9125,9355,5398,1540,4169,1340,6933,8826,9891,2740,2914,2604,4064,9508,1558,5892,3954,8225,5593,3813,1808,8325,1104,8707,9861,770,5911,1183,7390,2703,336,2996,9796,4413,7313,5009,3994,7305,7776,560,983,5479,1883,5797,4352,8900,3385,1140,1161,269,5737,2660,4120,8729,6851,9524,9160,2879,5538,3116,4319,20,7753,2839,1571,8922,2675,9590,5031,3846,8867,702,5191,751,3644,3620,2290,8386,9566,8792,4844,6167,285,6114,2897,7589,9613,7184,368,3178,427,4438,641,3762,7376,6406,5533,8748,5379,9490,8314,5322,7417,1634,1427,3280,3478,4259,2980,3097,1054,7657,4364,7687,8175,3033,9508,7120,7716,3022,9030,3057,3903,5544,1110,4156,9754,1536,7662,2947,4376,7889,6879,506,8076,861,5383,883,7171,2398,2311,3453,9083,6845,1554,9692,2627,2045,4201,3329,4890,5601,716,9672,2234,8711,3489,8043,5444,7958,8883,2700,2682,5194,9448,4872,9165,4045,5625,1883,546,7188,3367,9103,1172,969,9953,7501,9441,3308,5546,8039,1979,7953,4418,8040,1702,8926,8212,7609,9366,1638,9368,2531,9838,2290,9261,3977,4766,5365,5146,7930,4758,5141,9973,1070,2303,7283,2071,7004,1642,3627,5325,3022,5149,2605,2853,1737,1321,110,9197,483,1510,8947,6595,3595,1912,4847,9557,2345,8224,549,6618,4762,6693,8256,1490,6013,7406,5460,1936,5335,3206,653,7873,1539,8491,1604,9047,7525,2516,8935,7638,7826,7262,5392,8445,4856,660,8414,6450,6571,2295,4149,5174,7965,6488,668,3154,6022,7553,1173,5843,2939,6453,517,3612,8274,5853,2047,6388,7599,7253,6623,78,1724,6944,7295,1874,7054,3548,6673,3628,3761,287,429,7545,1539,5782,2405,5160,6269,1808,6314,3121,8121,9224,40,621,6756,1271,7096,9880,1974,6986,4136,986,2314,2506,3916,4089,2508,3846,7333,7651,8667,2150,6103,720,3968,1389,1507,3527,5247,1518,8620,8184,7181,5722,3906,2035,2594,8919,3733,4586,112,9683,1667,7019,4258,6681,3511,9943,6441,6156,2087,1549,747,9069,5496,1972,9565,8351,9323,4431,4779,6668,9026,6224,2884,7941,4215,1457,3217,1764,1800,4737,2106,8760,9173,261,8427,9001,8263,3973,3404,7116,5066,6122,2381,8468,9502,220,3907,9683,1783,7428,8874,1624,9292,4809,9075,7564,7458,1845,7062,1125,812,4110,527,8183,668,2716,8230,2666,2954,2012,2605,503,1829,6676,937,4486,8415,6329,1229,5612,1194,6557,2882,1581,6619,1141,1800,1939,7317,2863,1680,3440,53,7424,4280,123,6286,5197,8485,7504,9320,2131,6540,4333,4606,8479,432,8745,1813,353,4172,4765,3175,8710,5891,4193,6591,4907,4384,3125,5701,6890,8833,5483,2690,5557,7296,6768,1966,9098,6512,7723,4292,2633,3192,7604,9016,7183,7641,7307,4072,4248,3529,310,3652,4660,3290,6489,9648,7664,3423,5813,1484,7676,520,9816,2463,5991,4551,2955,5471,5308,5953,5850,5040,6692,5923,7226,5847,1214,3234,8930,1116,2117,5534,3169,8208,8178,4144,1476,8081,6844,7453,1162,405,4571,78,3822,7197,7720,2432,487,2621,2228,1557,4014,4003,8177,111,938,8896,2980,7707,7661,5748,1168,4571,7364,2376,9189,5622,1963,9478,17,8825,2859,3635,273,6943,5621,8664,2897,2037,198,2615,7852,9630,275,8904,2496,6762,7246,4972,5668,9479,442,1810,3873,3533,530,3221,4033,8449,9818,7426,7751,6970,474,1923,6767,9319,6593,6850,2805,3447,3698,3531,8067,1740,7443,2664,8494,1843,8533,7399,3580,7241,2334,670,5718,4989,7072,6354,9107,7321,8814,4847,358,8994,599,8413,8047,7842,6524,5489,4265,5619,4503,8334,5371,386,593,5512,5407,4533,9522,803,6778,7462,7924,7629,3063,2495,1869,1735,4993,954,320,6692,7914,7463,8007,3117,4088,4969,844,5627,5544,8197,5967,53,4558,564,6255,6009,4414,2151,4610,1815,635,5994,1720,9273,3805,8460,2797,9833,4045,2627,2647,9060,7448,6116,2218,5947,8091,3835,9632,1083,7279,9571,8703,4385,9958,3239,7169,738,290,8837,3837,7260,6932,2226,4984,6658,4133,2300,900,70,6893,7830,4213,4365,7946,9249,1200,2965,4745,331,2428,5267,1223,8287,9095,8801,2436,440,9832,581,105,2106,7051,8895,6473,8950,634,8024,1474,8422,7032,372,196,8777,9732,7516,2662,3241,9477,5711,4119,4180,7950,7821,3076,304,3749,480,4165,2441,5525,7209,2704,9571,9531,8738,3173,8868,5682,4456,3234,3871,1782,9112,6392,1837,1476,8999,8649,2550,1359,157,5996,9452,2162,3229,6542,7970,6972,1301,5446,6109,9718,1998,1910,6074,5987,992,9276,336,7857,5029,8828,62,5470,3288,4916,628,6189,62,8791,4170,3519,9293,2131,8451,5581,1514,510,102,3003,2220,2287,4008,5671,6659,5980,904,5362,2234,8868,3647,3835,2519,8698,1092,1382,2432,3027,2523,8368,8621,1723,9436,3437,138,4980,655,316,8641,4993,5681,8571,2726,5588,7644,62,3346,2389,2781,2058,9490,8483,1992,7483,3124,5873,4153,1337,552,7960,9854,8629,5820,8296,7323,3151,422,254,6956,4115,3236,6495,7237,214,7966,5092,1531,4683,5833,920,120,1224,2759,2256,5851,5524,2926,6348,9034,8785,2966,2827,3804,2188,945,6507,6801,2894,6681,3758,1268,8884,7872,1058,4122,2213,8674,2757,2498,1709,9205,9188,6799,7744,7418,7863,5566,5903,1514,4705,828,3701,567,2992,9433,2392,7854,2390,348,2897,2927,769,116,5395,4512,1272,630,4600,5626,6010,470,7795,7493,187,2816,4506,7933,4630,7330,4868,4419,6329,980,3645,3726,9808,1477,9210,8387,7849,3259,7989,6173,4560,7500,5091,1517,2468,7063,8318,4906,921,2625,3160,8803,4858,2604,3496,2993,9300,3028,8782,6538,6826,9168,776,4110,508,8265,973,7814,3181,8686,1465,7673,1352,5031,8914,6594,9483,4916,2078,5762,3751,5200,9557,5192,9659,3334,4766,9273,4872,7728,24,2980,5448,8425,6571,2110,2862,9558,3695,6567,1080,8000,743,2505,7227,9228,9078,4486,6614,4052,4066,8162,1359,1559,6778,7942,6794,7369,5003,2160,2350,7684,7138,3391,9946,8677,1048,3310,7269]
nums = heap_sort(nums)
test(nums)

你可能感兴趣的:(有趣算法)