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