Browse Source

Solved part1

Piotr Czajkowski 3 years ago
parent
commit
496217a089
2 changed files with 300 additions and 6 deletions
  1. 36 6
      day16/day16.go
  2. 264 0
      day16/input.txt

+ 36 - 6
day16/day16.go

@@ -19,22 +19,28 @@ var rules []rule
 
 func readRule(line string) {
 	var newRule rule
-	n, err := fmt.Sscanf(line, "%s %d-%d or %d-%d\n", &newRule.name, &newRule.firstSegment[0], &newRule.firstSegment[1], &newRule.secondSegment[0], &newRule.secondSegment[1])
-	if err != nil || n != 5 {
+	parts := strings.Split(line, ":")
+	if len(parts) != 2 {
+		log.Fatalf("Invalid line: %s", line)
+	}
+
+	newRule.name = parts[0]
+	n, err := fmt.Sscanf(parts[1], "%d-%d or %d-%d\n", &newRule.firstSegment[0], &newRule.firstSegment[1], &newRule.secondSegment[0], &newRule.secondSegment[1])
+	if err != nil || n != 4 {
 		log.Fatalf("Error scanning '%s': %s", line, err)
 	}
 
 	rules = append(rules, newRule)
 }
 
-type ticket []int64
+type ticket []int
 
 var tickets []ticket
 
 func readTicket(line string) {
 	var newTicket ticket
 	for _, item := range strings.Split(line, ",") {
-		field, err := strconv.ParseInt(item, 10, 32)
+		field, err := strconv.Atoi(item)
 		if err != nil {
 			log.Fatalf("Error parsing field from %s: %s", item, err)
 		}
@@ -70,6 +76,31 @@ func readFile(file *os.File) {
 	}
 }
 
+func checkAllRulesOnField(field int) bool {
+	for _, currentRule := range rules {
+		if (field >= currentRule.firstSegment[0] && field <= currentRule.firstSegment[1]) || (field >= currentRule.secondSegment[0] && field <= currentRule.secondSegment[1]) {
+			return true
+		}
+	}
+
+	return false
+}
+
+func sumBad() int {
+	numberOfTickets := len(tickets)
+	sum := 0
+
+	for i := 1; i < numberOfTickets; i++ {
+		for _, field := range tickets[i] {
+			if !checkAllRulesOnField(field) {
+				sum += field
+			}
+		}
+	}
+
+	return sum
+}
+
 func main() {
 	if len(os.Args) < 2 {
 		log.Fatal("You need to specify a file!")
@@ -87,6 +118,5 @@ func main() {
 		log.Fatalf("Failed to close file: %s", err)
 	}
 
-	fmt.Println(rules)
-	fmt.Println(tickets)
+	fmt.Println("Part1:", sumBad())
 }

+ 264 - 0
day16/input.txt

@@ -0,0 +1,264 @@
+departure location: 45-535 or 550-961
+departure station: 45-278 or 294-974
+departure platform: 46-121 or 138-965
+departure track: 38-149 or 173-949
+departure date: 34-223 or 248-957
+departure time: 32-64 or 79-952
+arrival location: 49-879 or 905-968
+arrival station: 47-306 or 323-973
+arrival platform: 46-823 or 834-971
+arrival track: 30-464 or 486-963
+class: 40-350 or 372-965
+duration: 47-414 or 423-950
+price: 45-507 or 526-956
+route: 42-779 or 799-970
+row: 26-865 or 872-955
+seat: 43-724 or 739-970
+train: 25-914 or 926-958
+type: 33-205 or 218-965
+wagon: 43-101 or 118-951
+zone: 45-844 or 858-970
+
+your ticket:
+173,191,61,199,101,179,257,79,193,223,139,97,83,197,251,53,89,149,181,59
+
+nearby tickets:
+949,764,551,379,767,144,556,835,638,591,653,872,198,825,690,527,260,396,873,333
+438,627,99,622,408,671,695,561,695,121,706,144,55,985,566,706,255,595,680,407
+879,876,665,928,874,436,766,328,620,267,995,54,430,503,86,936,489,305,64,688
+613,812,756,258,341,765,91,551,859,379,447,842,148,501,293,766,93,532,939,406
+349,340,670,248,813,557,249,949,506,656,100,19,204,409,944,659,777,843,712,801
+438,52,529,556,672,115,570,633,820,770,603,837,260,251,723,621,381,182,494,431
+948,673,202,330,552,258,406,184,177,239,774,185,638,386,834,608,835,636,805,92
+573,643,267,378,178,821,442,141,872,826,565,626,667,860,405,610,407,688,705,695
+818,724,446,459,145,373,859,346,702,441,446,753,320,426,664,177,619,712,739,342
+607,499,226,80,719,682,556,486,346,221,597,936,573,84,760,671,395,413,454,768
+743,504,830,195,413,698,93,375,565,695,947,636,602,681,436,265,614,604,632,706
+463,353,944,569,175,535,616,452,141,621,84,335,302,275,550,438,173,617,843,645
+685,400,777,752,839,86,180,754,231,450,342,341,440,57,271,202,494,591,223,707
+838,147,937,451,96,265,488,345,334,871,767,450,340,576,816,335,143,445,339,379
+502,566,121,743,99,909,876,265,204,799,566,387,672,102,713,559,773,770,571,609
+428,712,575,759,708,272,629,862,569,856,402,82,424,837,336,643,841,944,603,436
+273,987,944,534,862,943,267,741,562,327,193,838,822,933,860,933,459,811,622,383
+423,937,320,374,801,942,490,257,646,724,558,507,198,601,713,719,667,260,585,948
+404,679,328,916,688,615,345,688,556,146,452,306,89,742,808,141,816,85,938,457
+180,335,648,810,119,202,393,268,921,177,92,462,605,615,248,599,394,303,269,599
+941,261,695,643,381,830,753,705,84,694,305,61,556,256,599,653,388,566,626,759
+148,340,708,139,625,680,713,695,583,356,182,457,458,95,841,496,591,347,392,670
+534,434,615,686,348,621,832,275,380,667,811,590,389,585,528,652,862,617,778,535
+81,653,435,681,584,455,261,928,121,863,263,807,599,593,691,320,495,329,879,380
+739,632,692,639,702,94,274,910,707,758,196,934,490,189,169,333,807,396,448,719
+590,588,570,617,910,928,304,663,531,470,203,505,277,669,841,593,668,693,338,671
+938,259,221,406,579,390,619,327,824,601,502,529,573,912,930,396,940,139,501,819
+633,326,149,590,618,581,583,195,755,678,746,717,527,326,557,775,330,518,807,192
+438,722,427,758,324,251,757,753,297,300,438,304,588,633,254,823,835,766,977,195
+335,430,937,298,266,258,331,551,747,644,575,120,373,629,652,583,777,131,804,941
+427,663,220,864,378,80,945,695,7,584,679,375,566,176,300,631,932,558,639,681
+577,644,678,146,396,443,94,488,670,691,260,931,834,755,577,395,420,94,57,664
+660,574,799,666,748,858,393,603,120,391,561,138,631,578,463,344,382,747,699,102
+676,866,348,927,187,452,615,943,52,752,749,707,699,615,840,563,653,271,844,223
+573,453,587,838,260,802,768,303,382,817,429,486,586,184,502,156,486,486,816,203
+433,285,809,588,756,504,121,598,265,273,666,769,799,405,218,189,221,191,681,712
+612,63,678,529,775,684,531,838,617,572,555,386,628,272,765,603,23,393,743,753
+775,704,877,81,597,529,579,699,527,662,652,456,801,863,94,335,679,820,415,714
+714,306,176,652,492,446,325,580,647,149,554,708,504,327,624,245,702,506,843,756
+173,294,877,499,714,200,253,808,661,664,14,879,146,533,693,527,424,660,274,204
+564,434,116,585,801,617,764,860,376,185,639,698,863,620,753,253,253,182,93,491
+685,559,336,773,906,568,936,270,938,397,95,264,95,119,266,21,250,709,528,591
+174,57,400,298,350,799,139,603,686,586,601,663,527,248,560,613,838,742,698,225
+335,275,260,293,142,266,611,685,400,840,337,584,276,770,698,191,665,668,685,50
+706,97,296,848,85,63,600,191,120,490,905,776,581,435,265,530,602,61,596,646
+327,663,656,436,773,760,255,609,655,452,439,490,254,939,327,815,600,235,507,811
+334,58,143,417,630,455,454,390,327,339,906,494,739,188,260,842,298,740,680,662
+398,346,388,443,680,563,666,666,438,764,559,926,909,948,437,72,493,809,397,381
+176,272,305,197,346,610,179,253,506,413,174,506,647,689,338,570,873,929,317,820
+553,946,409,562,258,398,187,429,819,104,909,571,534,266,739,258,643,60,601,379
+678,905,187,870,253,184,489,414,690,184,175,741,197,626,388,204,612,637,219,259
+346,665,800,614,94,264,658,811,374,640,666,295,449,976,563,696,695,675,527,694
+821,387,760,379,635,251,51,911,54,543,710,808,453,873,746,326,258,306,411,764
+186,487,378,937,559,575,382,931,664,697,534,576,715,940,984,628,409,651,676,665
+502,393,59,176,760,326,106,378,96,573,344,174,652,294,650,703,402,297,185,52
+834,433,613,554,764,839,493,752,185,254,388,83,769,621,623,17,607,330,529,690
+818,21,649,258,186,258,775,449,454,912,61,603,578,578,410,603,770,254,535,269
+757,615,389,650,749,630,560,257,269,822,412,740,759,941,59,835,522,462,494,531
+570,764,174,296,499,867,277,700,820,380,663,718,756,462,496,564,562,698,265,147
+500,680,271,610,396,820,250,827,87,768,671,906,706,865,300,560,815,691,745,907
+385,346,945,504,411,291,566,530,677,685,95,659,393,692,683,822,553,640,753,204
+492,821,178,186,488,140,411,739,135,582,445,776,222,699,656,633,879,807,591,428
+635,931,935,304,84,634,416,670,611,773,64,821,570,389,504,671,927,773,333,906
+807,626,617,932,187,402,581,640,693,551,458,583,444,126,695,711,221,327,835,947
+679,750,506,101,705,335,568,615,550,388,497,940,861,260,714,776,333,993,388,753
+197,656,802,589,341,993,378,390,347,403,927,593,928,673,747,554,680,775,342,639
+639,76,742,603,424,219,754,458,257,350,186,805,193,764,390,627,749,342,433,439
+629,704,941,304,637,860,661,388,139,404,945,647,573,840,886,149,667,382,399,747
+588,195,763,438,835,707,220,268,838,574,402,980,372,347,92,205,261,86,681,86
+266,739,816,2,585,701,841,600,590,497,204,743,383,810,140,617,864,770,705,300
+62,673,949,391,765,184,305,528,101,192,708,275,561,649,606,527,687,315,197,633
+433,419,644,531,626,534,300,263,265,257,618,303,631,194,675,684,694,669,861,721
+692,764,408,248,459,176,691,179,252,618,685,456,431,119,948,334,104,433,581,85
+333,341,627,766,620,263,720,118,690,914,641,204,189,722,197,912,612,65,930,906
+711,387,815,619,202,592,613,221,765,403,715,939,844,715,537,204,176,683,656,746
+91,927,559,933,197,406,641,658,391,199,339,272,383,932,829,196,739,755,720,430
+864,603,696,455,752,374,703,98,508,119,756,331,758,396,600,258,842,191,350,526
+633,121,659,428,179,562,715,821,404,260,587,760,570,707,711,566,570,642,824,560
+774,22,878,300,676,763,95,931,268,574,82,490,218,937,602,940,665,97,60,566
+223,632,412,385,909,707,336,937,808,743,775,705,99,984,380,384,585,99,337,724
+947,709,610,646,665,593,278,755,556,606,189,679,403,377,677,84,392,108,638,651
+262,424,498,429,623,385,496,138,696,693,258,454,273,868,533,834,257,100,459,99
+817,56,51,544,631,258,101,384,841,906,637,681,772,189,305,181,200,608,839,932
+141,409,907,665,54,177,349,173,4,448,843,717,380,253,598,140,570,820,502,948
+184,920,382,142,342,530,612,431,196,710,101,704,398,862,612,377,173,876,218,757
+811,800,437,212,756,425,584,616,384,119,839,334,934,600,534,178,86,624,532,711
+938,334,603,142,54,695,5,874,779,700,632,99,942,223,661,579,807,707,614,602
+665,296,52,621,320,434,570,506,687,908,905,714,185,683,758,617,644,82,95,716
+656,685,176,452,385,195,375,87,814,290,52,683,413,456,457,656,143,634,174,659
+756,765,269,251,263,616,715,637,760,454,533,489,52,251,418,306,202,838,180,198
+877,557,220,115,249,774,63,97,348,119,940,444,486,616,926,82,256,585,619,772
+758,337,98,360,296,453,739,807,390,634,497,820,381,179,349,714,676,256,765,60
+50,619,639,941,571,66,267,454,561,379,143,452,554,393,759,149,148,875,397,640
+274,523,275,683,384,620,94,811,79,839,776,589,507,194,430,331,95,606,631,88
+165,121,84,575,201,409,82,800,401,52,301,493,325,691,503,336,555,774,706,251
+576,119,938,333,462,449,339,382,266,808,145,763,459,810,910,342,640,199,617,520
+408,762,183,409,763,59,333,932,323,59,560,703,306,856,269,652,298,98,488,587
+344,948,221,749,835,316,779,860,56,205,723,712,553,346,721,305,494,338,186,819
+184,773,66,619,554,807,120,437,774,645,272,89,710,378,659,403,253,533,396,715
+610,579,565,758,336,817,690,406,289,724,618,200,188,486,529,488,841,582,101,671
+14,325,750,801,182,263,858,550,710,391,633,768,265,601,910,687,429,689,337,402
+200,653,645,875,527,382,348,424,909,810,186,426,60,682,90,83,121,595,116,834
+305,300,686,769,590,90,764,551,426,863,381,506,721,612,627,323,177,4,704,529
+416,277,175,662,688,698,437,586,777,425,533,858,222,60,140,719,493,558,695,768
+863,268,739,653,512,779,437,248,300,451,195,874,436,772,332,589,183,746,94,756
+621,97,575,770,327,803,659,397,346,907,720,862,770,436,520,694,445,691,810,553
+436,642,811,221,758,406,362,442,501,374,684,53,660,146,205,383,677,597,430,201
+926,439,650,266,578,486,189,819,539,760,872,560,910,589,821,605,694,142,762,180
+499,436,417,535,718,674,698,174,696,96,440,490,304,199,406,559,185,328,573,685
+92,803,711,603,721,185,450,676,809,132,569,427,596,248,745,498,574,388,879,667
+253,339,295,805,61,620,140,376,332,712,94,841,528,621,686,756,307,610,255,533
+175,429,628,629,407,260,647,276,619,666,820,145,611,380,750,21,91,629,62,445
+580,750,665,742,935,591,405,643,195,295,592,773,455,545,449,347,701,912,143,380
+698,948,527,822,713,52,683,671,759,767,684,184,817,392,983,60,396,599,907,342
+138,630,6,583,526,401,187,945,836,690,841,531,563,910,408,779,644,660,683,374
+280,669,596,815,346,497,740,493,596,767,675,248,817,222,860,457,938,435,121,120
+144,631,771,437,616,745,668,604,142,862,550,324,570,345,124,622,93,59,619,79
+393,442,549,374,222,447,601,753,373,455,440,582,751,435,596,691,187,686,179,347
+298,616,59,623,447,51,909,755,71,709,701,406,697,373,875,754,573,332,754,767
+709,201,430,81,608,688,939,496,569,260,711,935,943,304,87,617,744,165,487,626
+294,446,946,700,392,880,758,687,656,751,395,407,266,443,61,629,820,458,434,179
+648,669,942,695,587,813,803,254,173,633,376,14,574,702,711,654,761,740,297,597
+435,774,935,592,779,494,635,406,573,723,994,139,772,562,707,637,839,635,380,82
+413,630,657,637,328,614,574,741,687,445,413,777,202,244,200,682,506,644,348,806
+575,712,119,720,695,920,679,300,488,583,933,410,555,762,90,192,138,252,556,95
+813,457,628,648,696,403,382,806,338,183,344,146,799,315,497,401,328,63,747,198
+622,652,329,198,710,442,178,754,817,744,675,819,815,922,764,659,934,582,61,302
+392,533,619,311,299,593,707,876,331,714,590,447,690,753,463,914,526,822,698,655
+665,754,602,614,646,594,550,619,560,393,428,747,634,271,274,339,627,826,909,585
+942,809,614,568,815,344,514,779,927,580,564,909,347,838,403,752,618,566,530,443
+692,820,746,88,640,933,118,183,586,744,745,268,616,250,581,639,615,858,386,984
+87,631,934,841,613,249,691,97,336,886,270,613,634,692,669,257,558,399,306,93
+930,717,669,275,189,258,703,272,602,718,530,331,218,660,271,834,653,836,408,421
+383,804,698,441,417,403,940,858,700,875,770,198,714,435,569,486,487,177,80,949
+202,142,864,348,426,537,204,615,681,676,933,178,816,396,175,769,423,766,879,593
+592,309,804,638,197,759,426,577,441,409,928,571,800,506,275,768,689,333,932,937
+509,607,248,556,575,424,435,942,490,678,563,677,374,295,629,666,252,337,578,745
+827,754,62,747,686,627,671,98,708,686,407,599,835,205,805,534,741,201,384,189
+623,434,15,496,89,655,146,190,816,63,423,496,635,948,910,934,81,641,437,614
+495,52,634,181,376,500,680,57,497,717,14,679,148,406,661,452,906,264,526,401
+97,188,330,948,374,251,633,639,434,777,913,529,679,605,76,625,550,939,762,445
+859,675,304,473,427,261,640,196,647,350,686,58,202,908,912,174,447,590,275,401
+372,748,687,696,381,201,569,676,147,516,338,428,394,148,391,338,819,766,707,585
+769,449,505,602,814,644,272,945,773,424,444,811,417,709,100,862,596,628,450,346
+426,228,424,384,257,681,383,639,554,551,701,942,95,100,842,396,909,609,626,622
+397,589,766,277,459,819,85,807,295,488,449,399,339,532,378,420,144,750,841,145
+683,626,645,75,265,267,773,550,595,604,328,747,262,647,201,590,201,906,932,445
+618,932,345,435,532,276,277,532,813,459,764,327,979,388,634,914,452,396,391,64
+668,53,721,716,591,433,265,190,763,327,693,926,648,84,98,863,770,621,638,977
+685,834,490,686,402,768,575,741,930,582,724,389,551,22,838,665,627,460,590,261
+225,384,397,667,843,411,673,56,120,697,220,623,376,101,305,185,807,698,637,599
+687,375,914,602,806,372,491,560,608,573,80,758,632,932,599,610,327,695,944,987
+676,637,860,718,698,193,71,187,684,335,596,340,673,81,860,630,877,340,948,273
+249,716,674,400,553,567,698,505,834,85,424,597,706,581,740,3,100,804,652,274
+837,836,437,872,220,502,375,643,328,490,0,662,267,648,222,344,399,555,944,946
+121,717,463,643,406,261,391,646,181,641,336,651,86,275,494,607,353,84,384,434
+650,252,13,259,334,840,601,249,199,607,258,629,259,678,611,100,696,339,765,56
+449,692,80,752,778,675,496,940,934,98,189,552,679,629,110,277,192,399,696,739
+190,589,432,913,606,839,121,82,358,384,701,760,618,927,838,912,139,937,326,328
+935,276,427,859,504,758,716,753,276,935,672,457,937,800,192,356,101,679,699,757
+249,830,752,560,801,199,594,722,875,637,99,579,740,762,58,710,149,657,218,605
+935,949,653,453,949,930,802,501,768,275,905,500,177,217,298,768,423,655,187,568
+608,87,296,220,982,200,676,661,147,931,496,600,333,683,192,462,691,400,812,198
+770,435,844,907,402,186,706,433,532,656,696,837,688,774,218,826,575,324,441,874
+680,679,223,459,803,100,300,577,636,751,383,879,404,621,646,306,827,400,413,808
+805,991,623,83,626,615,505,682,757,491,941,295,266,487,807,221,526,914,686,193
+694,622,82,566,187,944,390,431,433,659,837,937,345,513,504,179,306,324,610,601
+660,456,823,760,914,52,773,272,251,815,412,683,266,819,119,111,683,593,487,426
+101,278,712,51,187,710,270,598,219,940,612,182,389,999,341,325,626,302,770,572
+913,537,624,602,584,928,630,862,275,179,803,913,928,805,530,388,445,593,629,294
+111,668,811,864,632,261,929,306,451,665,503,439,88,817,570,874,838,555,304,349
+692,263,255,192,739,621,768,262,318,373,459,487,680,704,799,583,428,447,705,834
+306,406,813,692,107,89,177,597,711,223,408,862,628,603,582,176,142,83,248,657
+395,566,620,663,335,557,385,599,341,810,459,706,805,873,305,875,262,418,613,553
+840,563,100,626,823,186,600,668,945,314,323,442,99,705,684,638,859,564,669,583
+714,334,464,911,406,196,683,931,62,301,98,743,450,416,182,860,197,840,634,599
+774,948,146,893,944,775,339,655,120,176,650,277,712,707,81,140,377,573,487,630
+685,697,143,167,668,773,946,423,859,766,266,696,375,580,264,640,615,807,148,302
+584,124,649,752,220,202,449,935,97,189,64,762,927,432,432,714,80,914,426,188
+836,176,180,839,740,420,54,946,934,149,384,603,743,564,678,662,720,377,461,821
+443,837,385,124,374,267,555,746,459,823,935,586,180,659,632,662,660,934,530,949
+940,874,96,101,801,227,948,553,589,744,698,656,272,278,276,626,337,452,764,702
+430,558,528,533,618,710,321,277,761,937,277,205,914,405,765,779,435,306,119,624
+176,843,763,380,908,190,931,769,327,491,333,463,89,172,838,349,809,675,505,632
+437,764,275,681,911,752,634,340,621,55,491,400,555,751,143,385,575,552,551,357
+749,179,843,429,61,669,426,709,624,74,264,333,631,934,808,196,200,944,526,176
+368,195,441,183,251,699,705,802,295,770,762,819,254,203,669,578,298,600,89,660
+376,178,807,375,628,691,685,299,683,333,824,447,506,305,779,778,62,874,182,303
+536,744,502,769,182,299,184,344,803,619,504,86,769,638,811,836,745,597,614,626
+451,430,651,761,60,844,118,591,776,165,451,573,772,839,96,652,878,807,676,930
+526,589,622,768,773,259,304,262,261,54,249,555,426,865,120,520,54,706,430,323
+97,844,261,260,633,739,761,805,179,178,566,754,330,911,311,58,698,101,276,741
+564,379,453,342,193,676,99,278,443,278,325,257,487,744,299,538,606,335,438,761
+740,97,612,392,272,264,724,252,117,708,818,562,810,675,196,372,749,454,499,560
+779,990,410,448,696,391,672,441,146,581,554,694,768,383,405,692,675,776,936,342
+219,140,563,457,455,326,608,755,720,680,56,412,459,687,925,98,183,802,841,740
+322,81,594,687,52,61,427,173,626,673,863,945,174,594,200,688,770,876,768,553
+815,611,595,454,441,681,526,297,942,301,447,426,100,755,191,645,203,374,276,77
+86,385,659,621,584,684,51,816,347,499,603,488,396,67,432,342,687,816,94,260
+437,778,345,504,574,862,609,843,667,251,704,84,258,457,647,429,875,743,814,833
+676,672,942,197,505,390,568,719,931,947,276,120,824,188,594,808,563,876,775,909
+762,752,940,230,341,118,623,404,716,120,768,101,834,176,755,486,141,184,577,767
+721,676,437,454,391,303,810,220,191,178,937,190,56,714,455,299,82,368,802,740
+60,462,575,865,250,172,931,347,53,54,813,81,295,452,561,937,776,81,705,669
+670,772,676,945,432,522,347,489,620,680,749,194,384,637,201,613,605,630,562,529
+99,599,660,263,304,431,427,101,323,863,426,462,83,649,243,385,497,759,777,93
+433,608,512,425,329,530,602,945,173,875,638,494,770,670,940,836,262,702,659,873
+453,391,428,348,907,687,462,324,941,381,613,204,395,896,946,381,779,810,841,705
+265,905,560,54,681,765,682,88,568,273,939,493,57,266,342,6,612,633,550,337
+930,534,204,753,934,846,569,682,745,934,403,906,272,677,719,776,754,534,556,173
+486,809,755,763,441,396,689,415,385,490,145,304,271,204,375,344,800,92,872,694
+489,425,688,573,743,564,295,652,257,707,267,173,758,365,739,265,684,527,860,655
+299,646,180,52,697,721,766,574,151,762,376,182,407,196,80,873,188,329,248,448
+431,381,779,393,223,575,408,858,616,415,85,707,749,264,489,390,597,779,185,937
+457,168,219,54,90,119,744,332,52,862,941,818,554,703,820,464,742,554,331,914
+809,529,444,455,91,11,843,862,428,632,707,195,571,747,905,187,328,864,393,629
+295,720,375,80,928,551,683,567,418,341,685,632,711,98,218,811,622,583,487,382
+804,113,92,442,296,669,390,218,691,263,492,643,80,669,501,329,566,803,191,879
+805,609,749,808,563,141,612,724,266,666,678,491,566,687,940,338,704,544,528,501
+556,879,356,876,607,183,577,811,344,586,616,767,622,865,859,497,429,580,776,254
+130,276,393,927,190,455,908,329,676,818,572,204,760,801,146,946,205,95,579,139
+423,862,374,93,685,844,101,811,461,81,617,175,643,287,271,179,180,101,595,774
+256,89,407,563,759,665,844,563,932,91,406,597,685,389,658,348,81,295,251,309
+189,743,376,86,333,394,593,773,562,589,668,646,565,477,669,196,581,297,652,98
+769,807,569,559,976,651,266,86,258,934,334,635,560,761,61,188,497,680,571,823
+931,752,461,705,394,128,764,569,297,932,450,665,59,440,694,710,753,627,559,388
+775,631,390,87,772,654,561,145,401,917,175,912,693,64,766,606,590,427,701,688
+594,740,203,748,461,294,822,642,96,610,907,805,647,582,359,719,632,377,748,943
+65,561,677,645,495,99,223,592,596,402,385,746,328,392,583,336,487,684,304,935
+260,679,451,176,596,581,938,679,456,762,464,859,565,715,820,752,530,928,248,15
+218,529,596,297,876,651,557,659,506,562,341,96,3,564,199,400,503,647,707,182
+613,195,929,818,823,808,265,63,498,686,583,97,88,650,866,640,141,461,594,119
+219,873,720,388,835,143,205,602,339,576,448,388,255,731,558,305,644,672,303,255
+526,652,256,520,263,182,263,686,382,581,250,255,559,500,248,566,807,273,622,944
+464,802,408,702,829,299,397,414,403,565,407,412,759,503,565,59,652,758,650,427
+602,57,873,828,564,554,565,435,303,590,323,388,138,528,94,350,175,634,410,63
+254,500,57,86,984,253,751,822,202,395,181,719,812,940,625,640,615,749,437,610
+326,631,940,409,753,368,438,202,553,446,592,876,818,684,617,843,753,575,800,695
+