diff --git a/16/1.py b/16/1.py new file mode 100644 index 0000000..8b647d1 --- /dev/null +++ b/16/1.py @@ -0,0 +1,53 @@ +with open("input") as f: + content = [x.strip() for x in f] + +def parse_rule(rule): + name, rest = rule.split(": ") + rule1, rule2 = rest.split(" or ") + rules = [] + for i in rule1, rule2: + mi, ma = i.split("-") + rules.append((int(mi), int(ma))) + + return name, rules + +def validate_rule(rule, value): + validates = False + for r in rule: + mi, ma = r + if value >= mi and value <= ma: + validates = True + return validates + +part = 0 +rules = {} +othertickets = [] +myticket = [] +for c in content: + if not c: + part += 1 + continue + if part == 0: # parsing rules + name, rule = parse_rule(c) + rules[name] = rule + if part == 1: # parsing your ticket + if c.startswith("your ticket"): + continue + myticket = [int(x) for x in c.split(",")] + if part == 2: # parsing other tickets + if c.startswith("nearby tickets"): + continue + othertickets.append([int(x) for x in c.split(",")]) + +total = 0 +for ticket in othertickets: + for value in ticket: + validates = False + for __, rule in rules.items(): + if validate_rule(rule, value): + validates = True + break + if not validates: + total += value + +print(total) diff --git a/16/2.py b/16/2.py new file mode 100644 index 0000000..c8a3057 --- /dev/null +++ b/16/2.py @@ -0,0 +1,93 @@ +from collections import OrderedDict + +with open("input") as f: + content = [x.strip() for x in f] + +def parse_rule(rule): + name, rest = rule.split(": ") + rule1, rule2 = rest.split(" or ") + rules = [] + for i in rule1, rule2: + mi, ma = i.split("-") + rules.append((int(mi), int(ma))) + + return name, rules + +def validate_rule(rule, value): + validates = False + for r in rule: + mi, ma = r + if value >= mi and value <= ma: + validates = True + return validates + + +def validate_ticket(rules, ticket): + for value in ticket: + validates = False + for __, rule in rules.items(): + if validate_rule(rule, value): + validates = True + break + if not validates: + return False + + return True + +part = 0 +rules = OrderedDict() +othertickets = [] +myticket = [] +for c in content: + if not c: + part += 1 + continue + if part == 0: # parsing rules + name, rule = parse_rule(c) + rules[name] = rule + if part == 1: # parsing your ticket + if c.startswith("your ticket"): + continue + myticket = [int(x) for x in c.split(",")] + if part == 2: # parsing other tickets + if c.startswith("nearby tickets"): + continue + othertickets.append([int(x) for x in c.split(",")]) + +newtickets = [] +newtickets.append(myticket) +for ticket in othertickets: + if validate_ticket(rules, ticket): + newtickets.append(ticket) + +possible_mappings = OrderedDict() +for field in range(0, len(myticket)): + for rulename, rule in rules.items(): + validates = True + for ticket in newtickets: + if not validate_rule(rule, ticket[field]): + validates = False + if validates: + if rulename not in possible_mappings: + possible_mappings[rulename] = [] + possible_mappings[rulename].append(field) + +mappings_lengths = [len(x) for __, x in possible_mappings.items()] +mappings_names = list(possible_mappings.keys()) + +final_mapping = OrderedDict() +already_assigned = [] +for length in sorted(mappings_lengths): + mapping_index = mappings_lengths.index(length) + rule_name = mappings_names[mapping_index] + pos_maps = possible_mappings[rule_name] + definitive_maps = list(filter(lambda x: x not in already_assigned, pos_maps)) + already_assigned.extend(definitive_maps) + final_mapping[rule_name] = definitive_maps[0] + +total = 1 +for rulename, fieldno in final_mapping.items(): + if rulename.startswith("departure"): + total *= myticket[fieldno] + +print(total) diff --git a/16/einput b/16/einput new file mode 100644 index 0000000..fe34e40 --- /dev/null +++ b/16/einput @@ -0,0 +1,12 @@ +class: 1-3 or 5-7 +row: 6-11 or 33-44 +seat: 13-40 or 45-50 + +your ticket: +7,1,14 + +nearby tickets: +7,3,47 +40,4,50 +55,2,20 +38,6,12 diff --git a/16/einput2 b/16/einput2 new file mode 100644 index 0000000..b48bf37 --- /dev/null +++ b/16/einput2 @@ -0,0 +1,11 @@ +class: 0-1 or 4-19 +row: 0-5 or 8-19 +seat: 0-13 or 16-19 + +your ticket: +11,12,13 + +nearby tickets: +3,9,18 +15,1,5 +5,14,9 diff --git a/16/input b/16/input new file mode 100644 index 0000000..2b3e193 --- /dev/null +++ b/16/input @@ -0,0 +1,268 @@ +departure location: 45-309 or 320-962 +departure station: 27-873 or 895-952 +departure platform: 45-675 or 687-962 +departure track: 42-142 or 164-962 +departure date: 38-433 or 447-963 +departure time: 39-703 or 709-952 +arrival location: 34-362 or 383-963 +arrival station: 26-921 or 934-954 +arrival platform: 38-456 or 480-968 +arrival track: 42-295 or 310-956 +class: 29-544 or 550-950 +duration: 44-725 or 749-963 +price: 37-494 or 509-957 +route: 25-170 or 179-966 +row: 32-789 or 795-955 +seat: 29-98 or 122-967 +train: 45-403 or 418-956 +type: 36-81 or 92-959 +wagon: 25-686 or 692-955 +zone: 37-338 or 353-960 + +your ticket: +79,193,53,97,137,179,131,73,191,139,197,181,67,71,211,199,167,61,59,127 + +nearby tickets: +520,360,862,762,851,550,896,507,812,510,896,936,653,629,287,481,718,840,489,850 +12,605,204,396,449,357,661,766,765,903,170,491,215,597,698,356,66,941,362,749 +132,482,797,522,855,664,904,515,799,329,78,802,909,214,637,175,555,431,825,944 +220,872,817,630,642,270,767,211,534,203,674,250,899,808,450,273,834,648,690,836 +486,69,439,60,841,723,229,672,283,184,872,357,907,196,214,512,238,57,214,338 +286,586,355,487,785,271,209,739,538,700,755,870,400,565,216,822,242,523,418,628 +359,771,137,72,276,722,259,618,342,565,140,694,74,447,819,639,237,565,668,808 +757,766,846,555,847,99,899,520,864,224,560,213,839,574,322,651,944,486,805,328 +511,516,537,665,946,124,490,166,68,280,401,208,701,275,818,877,385,385,856,766 +605,509,262,941,872,390,786,75,703,432,383,654,513,828,586,337,114,798,217,697 +164,693,62,672,753,248,208,567,56,54,947,238,125,544,562,273,415,96,579,663 +566,480,768,294,490,628,749,130,670,710,484,523,261,121,656,807,387,56,644,652 +130,873,272,181,994,292,530,122,556,397,761,451,431,766,456,900,179,401,485,856 +777,292,916,325,419,853,274,775,699,726,915,556,860,854,630,430,543,289,920,142 +68,481,898,916,197,126,672,488,807,587,481,55,625,661,696,108,330,596,271,77 +787,916,787,767,206,626,900,454,195,767,231,70,827,338,530,276,268,817,15,694 +140,484,361,511,518,700,184,800,484,583,983,905,789,913,536,858,327,858,448,399 +428,337,946,638,250,901,423,812,658,270,328,397,720,426,231,873,812,345,199,245 +96,556,811,692,489,590,578,436,560,97,722,844,943,92,618,385,292,772,634,826 +623,697,556,664,781,328,602,555,635,934,516,65,253,703,435,228,670,391,332,905 +589,805,825,578,325,204,332,682,535,536,225,920,294,279,140,698,905,62,827,213 +192,661,495,323,394,186,512,64,862,723,400,754,701,789,870,693,818,913,390,383 +784,530,234,699,227,74,196,827,980,801,836,567,720,273,644,599,383,587,480,613 +384,525,687,566,841,72,829,776,908,267,327,450,652,940,908,696,914,289,830,868 +819,633,12,280,774,400,873,623,566,580,98,768,59,799,93,170,593,210,283,262 +269,261,750,133,601,433,662,908,430,635,69,869,330,607,253,588,773,563,685,803 +673,838,630,504,427,768,643,422,633,335,510,816,594,624,895,567,335,857,607,240 +869,524,541,246,765,591,650,429,692,643,658,335,361,846,871,610,716,574,337,348 +212,254,540,225,141,912,528,806,947,855,209,596,242,613,77,219,291,263,167,172 +651,68,127,581,629,570,220,487,135,773,669,638,452,236,723,185,495,418,525,64 +711,618,609,266,263,753,68,391,132,771,124,573,944,870,92,829,731,710,627,70 +542,613,65,189,225,799,543,229,394,18,566,798,203,227,825,396,817,51,661,513 +422,283,949,941,647,806,197,533,721,418,198,239,326,724,872,920,570,268,443,599 +97,166,849,60,484,184,570,181,59,513,847,609,699,613,859,554,915,907,103,636 +855,529,779,140,633,424,614,524,535,454,660,848,918,657,701,737,355,695,218,615 +556,845,749,334,805,835,850,64,517,615,697,531,360,544,843,949,985,944,570,617 +426,858,566,491,232,130,832,60,760,134,315,185,658,861,624,864,696,557,136,450 +337,218,660,669,915,937,642,901,630,564,803,420,394,863,73,778,178,935,943,75 +838,383,796,185,183,513,627,820,214,850,611,0,909,640,666,597,237,337,870,862 +990,557,897,719,821,652,809,943,551,839,767,52,941,59,246,211,674,604,428,919 +396,860,635,627,248,213,218,839,325,573,62,755,822,621,387,517,686,835,655,626 +134,754,563,615,330,715,507,126,844,293,622,916,566,936,521,714,77,693,64,606 +451,836,918,241,717,289,76,758,274,658,56,812,591,705,268,208,274,910,359,393 +430,490,277,871,702,872,659,577,943,575,452,987,247,846,573,601,818,449,169,169 +190,943,484,62,573,593,122,756,589,327,57,294,230,717,618,438,164,65,625,636 +55,213,622,525,898,696,721,815,398,538,747,433,247,782,694,481,811,807,426,588 +527,392,491,660,664,359,590,355,356,755,949,765,261,550,868,688,670,605,277,291 +422,873,219,750,126,16,759,226,669,293,629,402,242,833,840,212,528,901,641,535 +358,494,201,391,141,271,276,562,185,418,799,762,714,765,626,97,519,881,126,262 +509,59,612,58,447,806,572,403,222,266,242,565,203,354,398,212,284,274,158,919 +480,588,186,292,558,657,590,361,825,757,773,630,95,839,521,496,493,605,236,231 +815,13,221,601,765,72,186,203,231,834,98,869,279,945,193,934,98,809,433,78 +895,289,904,695,487,206,187,671,63,628,237,572,990,271,124,531,71,572,421,941 +896,814,357,338,450,756,788,247,207,948,403,358,788,132,330,454,619,416,897,225 +843,767,848,196,205,764,553,452,785,828,627,120,944,393,562,524,910,354,658,254 +329,830,921,354,96,771,896,355,638,195,206,241,491,701,456,908,754,688,226,97 +718,611,268,421,282,908,625,115,713,580,833,355,67,836,51,758,565,78,356,758 +453,713,527,527,742,557,661,657,779,206,632,563,712,580,801,226,257,131,179,328 +847,580,140,633,852,636,284,81,809,623,703,353,977,383,912,140,810,73,256,533 +815,432,627,222,175,623,844,211,577,815,494,845,493,651,433,583,844,540,544,808 +517,655,448,532,711,865,181,245,833,135,194,939,784,385,507,431,135,582,217,659 +599,691,871,54,356,195,253,421,719,872,516,602,418,716,221,577,637,77,356,166 +813,187,655,279,100,651,50,610,709,419,575,184,74,571,58,521,725,783,277,131 +307,646,824,524,761,650,859,842,851,95,54,238,718,514,223,921,389,751,614,51 +624,710,243,669,623,396,247,353,778,60,562,19,398,275,68,219,125,384,325,179 +607,224,602,211,640,845,94,581,802,855,830,817,993,486,867,761,808,756,542,606 +248,219,594,764,826,718,808,853,853,251,491,640,947,719,345,912,141,813,124,585 +438,219,948,535,551,257,561,51,94,486,138,725,862,329,584,79,789,96,749,521 +233,835,392,386,624,608,840,758,721,337,897,243,583,945,196,810,663,795,764,497 +212,200,403,194,51,207,330,352,868,821,809,823,786,896,51,865,451,267,385,586 +689,488,756,558,262,777,659,725,651,819,798,641,214,841,329,266,358,276,583,353 +262,70,279,871,813,455,868,387,606,515,137,863,799,655,823,914,805,634,75,163 +275,390,672,560,862,420,943,224,941,202,81,293,869,74,252,815,595,674,124,745 +855,750,758,568,596,630,862,187,949,724,16,229,750,123,127,78,333,572,519,593 +321,620,396,428,865,72,238,200,661,555,230,560,759,741,579,859,797,620,428,353 +731,72,623,433,419,276,566,92,418,56,202,559,842,188,532,530,669,268,725,275 +535,69,452,238,230,95,820,756,534,127,327,403,245,122,256,78,649,457,65,95 +775,346,919,557,526,818,248,755,483,543,328,781,654,636,203,788,630,938,624,398 +187,910,248,696,604,421,274,668,430,100,724,324,220,696,525,67,774,851,800,216 +830,263,519,825,633,362,845,945,816,911,803,216,247,662,725,419,659,88,535,869 +786,601,421,360,656,247,634,317,720,575,194,642,916,54,269,866,538,647,533,540 +189,354,932,867,590,274,692,807,487,183,202,858,813,754,570,518,631,57,717,280 +860,811,78,645,659,202,419,125,241,530,78,613,135,607,418,158,599,712,722,269 +452,535,797,626,54,939,861,182,770,517,130,349,770,61,673,639,797,938,265,125 +320,628,601,528,498,70,579,805,532,455,72,238,128,243,386,222,552,751,663,240 +649,126,522,287,482,948,725,943,207,543,601,7,645,268,618,846,565,142,248,758 +781,218,175,698,559,125,290,616,662,217,60,934,183,636,836,716,712,136,200,759 +825,386,335,427,276,124,606,224,539,652,903,863,165,786,783,946,486,4,656,401 +346,621,256,50,456,596,761,723,854,939,279,290,587,403,568,764,388,239,139,647 +582,766,521,227,488,820,722,420,54,225,700,96,397,182,532,600,512,23,915,796 +607,98,206,541,180,248,248,751,61,783,295,509,509,310,671,627,584,128,392,238 +262,917,680,812,861,619,288,594,75,552,846,521,917,141,490,697,456,482,78,226 +269,659,409,422,388,573,53,862,811,812,613,287,134,591,902,754,711,204,580,230 +488,660,547,223,362,488,763,862,903,393,68,761,702,336,798,701,555,489,337,223 +289,181,103,654,419,385,915,287,849,669,803,938,649,749,703,920,657,634,493,631 +807,786,779,803,908,637,909,550,804,825,537,921,516,76,192,723,670,329,666,310 +829,205,800,901,191,231,324,257,361,629,847,841,839,827,295,716,608,508,240,804 +921,493,289,516,662,572,394,863,170,868,701,823,863,646,936,619,65,742,227,395 +167,223,846,777,53,202,608,639,488,169,822,59,295,837,696,426,355,819,10,939 +530,730,510,403,428,717,753,643,797,750,835,224,65,867,599,226,279,779,431,655 +920,184,550,648,200,289,386,142,589,655,909,62,326,189,68,322,534,303,593,70 +629,321,986,294,329,834,394,796,696,418,589,764,639,917,402,573,76,827,98,639 +840,919,494,623,148,669,675,865,393,799,542,604,913,636,400,781,915,539,795,628 +885,361,628,657,789,190,57,55,418,663,418,664,605,273,562,869,904,200,131,421 +506,781,452,586,543,863,563,167,127,784,788,330,131,841,700,810,329,601,424,600 +283,214,785,699,902,486,449,945,63,176,284,135,831,855,615,624,270,647,187,597 +857,60,309,846,598,512,165,222,57,271,871,949,66,574,289,672,819,838,282,650 +807,483,204,913,423,902,699,614,426,934,585,905,323,224,142,454,639,686,215,652 +395,142,252,916,229,829,579,604,203,335,646,335,278,60,771,201,788,633,707,255 +816,754,642,58,197,819,777,837,56,501,327,200,94,211,850,212,541,214,270,616 +907,589,51,139,256,489,645,486,221,785,825,615,595,826,391,785,65,706,824,77 +161,843,774,248,868,181,799,585,855,898,769,749,833,250,482,283,718,641,695,554 +184,615,668,205,206,291,485,234,551,628,170,918,74,867,203,993,820,559,98,529 +209,72,759,450,358,266,183,595,778,690,425,815,942,139,530,515,241,193,611,692 +214,830,572,204,327,188,360,767,486,672,871,422,774,337,317,62,72,605,286,577 +812,225,209,699,18,95,801,646,590,196,839,266,265,516,607,659,489,835,292,640 +830,486,850,761,649,819,786,338,542,490,585,712,895,693,516,285,194,782,763,439 +571,278,816,822,383,502,97,453,325,660,844,201,785,852,765,943,336,218,78,391 +50,529,530,239,386,62,81,217,837,402,804,557,618,166,252,339,804,185,321,141 +258,828,651,935,591,387,750,95,597,671,919,688,169,623,142,581,864,567,521,895 +275,803,826,568,236,287,512,698,428,631,180,452,725,713,278,555,724,540,167,676 +800,267,794,322,359,825,336,872,66,806,362,715,724,902,264,362,92,355,165,242 +567,9,278,592,562,761,385,773,908,641,938,723,72,663,125,947,250,127,765,597 +871,52,399,829,936,573,975,824,575,295,221,513,656,422,584,359,903,522,845,321 +589,141,385,95,717,590,513,152,52,259,270,169,190,331,494,902,895,770,455,944 +617,802,532,166,629,384,763,332,452,240,696,617,213,677,715,264,670,573,639,796 +941,402,856,282,660,667,710,124,92,899,538,603,700,760,122,261,909,135,994,754 +117,798,202,53,254,763,672,427,56,648,421,261,617,701,493,96,323,789,127,538 +538,782,83,193,490,865,572,422,139,816,783,337,180,262,127,806,210,236,675,776 +288,575,331,698,137,741,696,564,354,604,639,644,220,844,670,511,211,561,254,852 +353,329,420,360,769,851,335,616,697,454,615,203,823,194,688,493,255,909,222,563 +353,523,328,401,576,580,356,945,527,768,184,174,187,857,655,603,447,332,292,774 +716,583,254,720,343,822,63,624,484,419,336,128,850,835,124,848,619,65,760,425 +846,488,645,808,81,584,588,773,898,261,142,844,260,274,558,233,446,256,166,650 +280,596,424,384,600,493,641,188,426,530,395,326,581,832,658,934,559,122,792,640 +529,243,667,719,614,97,139,695,201,240,797,641,207,856,97,315,670,715,52,388 +433,763,668,57,318,229,614,617,212,402,750,335,510,631,257,227,132,612,248,899 +325,286,276,400,709,625,510,97,945,512,836,184,136,643,664,896,68,59,89,763 +195,759,828,244,827,194,339,644,271,906,663,357,483,166,580,201,218,819,553,827 +800,697,934,762,509,939,208,635,134,668,626,243,810,666,214,138,94,267,978,519 +585,428,450,563,629,905,387,867,911,51,807,500,280,418,575,539,80,610,225,843 +426,542,850,778,214,124,943,687,76,863,631,251,170,601,644,759,902,702,673,810 +562,335,96,77,541,492,122,254,615,759,646,602,490,753,50,236,203,260,319,761 +519,600,349,354,401,629,820,556,605,332,386,190,805,840,832,940,385,221,228,394 +261,914,858,235,673,243,403,174,280,803,667,672,597,840,52,456,394,94,253,582 +98,134,800,493,796,139,329,168,453,527,838,896,167,337,391,51,800,663,410,578 +132,945,215,519,823,326,295,655,710,280,326,181,214,639,516,427,512,138,932,717 +633,233,570,600,939,584,942,639,934,514,402,61,696,609,383,393,604,976,142,872 +423,71,654,553,587,168,702,674,909,398,764,737,123,223,616,620,594,491,589,244 +253,63,765,333,862,539,447,658,54,342,515,921,400,388,666,386,936,712,725,536 +602,326,564,184,326,640,589,429,525,675,769,692,582,544,949,904,163,760,621,764 +626,605,900,550,781,777,524,284,167,843,320,534,820,644,521,683,904,77,262,756 +614,386,705,789,569,640,900,122,194,92,582,830,60,556,839,532,488,196,750,796 +141,394,623,453,512,763,1,531,133,322,565,713,867,288,812,223,941,225,605,283 +631,558,726,533,132,542,134,96,591,52,601,258,613,694,74,225,801,836,519,644 +860,268,224,450,648,722,808,55,897,390,554,619,619,358,641,64,552,574,499,96 +480,396,878,492,565,873,523,901,844,669,901,901,532,518,322,697,275,550,756,426 +705,263,611,856,335,234,81,860,625,207,421,696,223,265,643,198,290,229,514,179 +676,626,492,263,246,221,355,395,857,665,853,832,570,134,361,450,659,823,909,666 +860,499,210,720,131,698,588,820,76,164,187,848,858,564,128,81,633,418,403,386 +199,634,825,179,787,220,336,912,544,601,502,898,80,639,293,425,388,788,186,484 +780,784,318,700,198,711,908,94,454,596,575,254,543,845,588,402,389,246,834,131 +943,674,170,78,850,722,820,449,838,639,910,532,53,447,775,714,514,451,171,577 +357,784,635,197,524,585,914,262,277,209,530,11,199,277,186,905,675,456,828,487 +310,286,268,54,899,617,229,491,186,865,179,427,66,603,328,869,551,331,601,823 +220,917,430,620,940,765,541,573,768,803,115,79,757,773,637,652,484,395,765,482 +136,558,657,762,670,907,574,336,588,604,489,764,211,353,329,839,723,724,781,301 +170,665,194,232,899,235,620,596,997,574,576,766,230,770,919,193,638,215,267,897 +901,207,647,618,639,532,896,911,212,589,335,80,226,554,5,657,944,644,122,232 +272,810,212,135,51,571,895,272,584,293,152,242,555,762,514,639,872,562,594,261 +820,659,621,223,673,488,492,387,182,258,634,630,256,203,54,636,898,219,349,596 +529,280,321,50,520,918,258,517,758,854,607,755,388,989,550,944,123,866,525,641 +621,271,915,598,484,621,260,525,647,166,201,328,985,289,725,921,78,263,837,712 +618,168,477,525,796,649,138,534,542,872,661,252,122,841,254,869,917,278,264,600 +520,482,522,797,556,321,632,329,454,247,448,785,868,162,58,781,619,324,59,79 +195,619,835,803,418,205,585,261,360,294,324,269,361,357,258,218,864,442,724,202 +816,232,721,220,658,821,184,816,694,393,384,69,237,638,840,712,699,1,807,359 +840,519,615,870,257,946,243,807,335,97,255,317,451,575,329,603,803,533,823,325 +236,612,821,455,592,936,218,321,97,797,264,594,62,691,634,359,200,216,796,610 +752,570,801,214,185,494,818,863,936,573,521,563,222,985,170,606,247,860,214,126 +612,667,776,581,699,718,906,389,254,335,949,614,861,95,615,652,128,790,455,939 +756,635,522,811,526,419,828,799,534,664,873,389,338,430,124,199,512,284,576,704 +752,138,666,131,864,660,223,586,212,623,234,700,632,297,611,92,768,620,751,491 +283,334,848,70,239,199,760,63,867,320,934,543,237,267,433,76,839,314,671,220 +189,820,401,605,597,71,938,859,799,268,550,669,844,4,671,79,68,667,721,614 +700,716,556,909,512,418,226,581,403,422,349,800,946,275,872,133,761,526,673,693 +1,284,513,769,754,197,642,243,62,215,51,935,633,563,714,400,601,183,565,360 +940,758,701,132,94,53,265,577,166,512,618,259,566,920,779,771,889,384,424,358 +175,816,857,129,625,867,362,400,780,609,534,762,136,537,694,200,72,207,568,209 +220,16,769,836,97,863,200,128,609,947,916,168,839,257,661,122,66,651,60,575 +395,98,675,344,660,627,139,80,942,139,401,659,292,194,329,334,70,63,693,906 +97,166,153,806,81,551,840,399,767,773,556,639,358,822,523,788,516,137,865,328 +216,797,386,219,543,199,70,842,766,938,801,841,268,169,272,713,487,143,127,54 +654,361,853,712,131,185,663,813,556,321,796,552,53,817,733,524,400,78,77,577 +451,845,432,657,70,140,768,403,420,822,279,628,648,501,655,199,358,532,828,395 +671,197,196,420,821,3,603,223,900,902,216,209,622,850,482,92,198,218,419,50 +456,843,219,781,909,604,583,582,865,937,274,518,71,876,480,166,226,801,72,184 +855,594,644,715,247,340,287,654,214,530,723,901,169,480,722,192,656,552,540,900 +785,93,588,665,840,282,58,228,243,92,269,592,786,634,853,256,687,655,634,839 +774,870,289,629,620,209,6,58,490,607,246,717,429,819,941,520,693,831,620,76 +57,526,72,288,701,944,356,266,252,934,900,660,133,614,485,362,312,949,451,816 +572,385,762,243,835,940,543,390,835,605,534,769,212,283,68,755,805,206,726,227 +908,526,823,126,215,204,807,762,760,480,871,835,702,202,751,71,704,641,804,509 +255,225,65,921,481,74,755,713,186,285,98,132,258,445,821,831,58,433,76,220 +927,249,491,421,491,241,78,754,565,606,320,697,484,215,710,634,284,420,577,513 +554,561,486,289,943,520,429,532,262,582,426,614,360,801,627,387,491,926,934,840 +710,60,758,769,937,905,709,258,250,921,418,710,332,648,334,330,331,551,845,883 +203,566,208,422,915,821,645,646,524,769,620,386,656,902,850,576,939,115,803,238 +259,455,224,693,781,21,217,946,577,232,295,525,617,532,432,749,841,67,323,262 +576,136,419,58,773,229,323,523,941,571,975,280,170,52,596,137,816,801,259,835 +565,388,535,578,285,849,824,258,842,661,847,580,766,173,583,180,324,944,838,781 +187,579,57,71,138,692,656,237,419,388,940,323,532,58,776,754,764,934,725,689 +494,665,283,595,798,689,600,262,568,901,483,206,609,602,851,808,220,905,126,573 +322,455,614,454,449,245,231,798,628,851,701,418,571,260,71,138,84,522,167,337 +571,721,719,698,533,78,494,716,283,564,764,22,197,267,550,936,197,763,828,595 +291,718,899,912,691,514,519,286,522,261,524,74,53,125,328,252,825,274,692,655 +214,217,912,79,219,192,858,289,165,522,360,583,563,671,877,780,230,520,906,642 +448,852,544,749,766,133,837,821,556,358,514,898,286,225,519,285,325,801,875,782 +259,215,834,644,605,123,642,833,235,840,803,452,395,419,576,704,513,724,170,422 +819,454,360,325,623,72,828,567,542,849,66,65,543,722,292,328,306,56,231,533 +701,542,638,53,78,353,611,453,400,285,593,284,511,914,155,554,645,486,259,643 +603,544,521,600,871,632,697,835,327,74,823,601,185,60,800,493,825,359,304,830 +665,230,122,843,489,906,747,124,193,718,224,725,613,139,561,270,448,854,611,641 +241,711,132,641,902,837,659,596,945,802,419,94,542,613,178,239,632,659,92,853 +82,230,628,51,511,418,185,938,872,385,631,402,849,838,136,455,518,323,181,612 +713,334,605,562,250,290,783,540,713,433,58,426,418,721,639,511,248,173,934,786 +494,637,192,92,237,722,615,77,208,581,383,15,524,897,336,637,869,509,393,164 +326,571,423,664,800,667,531,216,663,660,841,264,603,873,941,521,636,984,522,769 +904,72,872,779,847,835,383,807,138,662,335,20,643,942,902,624,432,835,327,452 +209,199,541,219,569,54,421,826,944,249,587,663,627,245,454,618,345,798,260,859 +693,391,993,355,264,401,516,73,184,860,488,819,847,286,946,857,275,562,139,293 +592,781,776,812,218,812,780,240,916,325,688,700,528,669,673,620,55,905,779,96 +168,279,851,619,421,701,213,510,74,715,442,756,138,222,391,628,233,353,552,215 +289,845,182,701,775,400,667,429,287,721,531,833,896,347,514,93,248,861,637,621 +946,525,21,819,203,286,866,749,287,599,783,787,846,845,448,389,387,527,777,62 +406,716,510,765,842,920,637,74,388,224,403,243,205,852,243,869,134,532,98,386 +763,860,587,805,329,717,596,127,673,134,527,865,819,409,335,58,75,715,565,556 +183,870,399,0,398,943,289,863,668,717,332,639,763,66,909,832,765,543,856,217 +54,225,185,428,769,664,757,236,845,613,938,453,52,700,217,915,94,224,451,107 +909,946,586,896,718,284,981,921,591,359,867,531,671,268,644,914,618,481,642,710 +325,290,489,776,839,710,596,187,711,530,171,623,821,664,842,201,811,454,657,247 +638,220,331,209,656,123,67,384,649,135,260,943,611,585,677,581,553,797,538,334 +249,384,532,780,571,456,908,80,566,58,543,261,53,253,105,725,725,188,782,512