1
0

6 Коммиты 82465164ec ... e50704ef67

Автор SHA1 Сообщение Дата
  Piotr Czajkowski e50704ef67 Added description 2 недель назад
  Piotr Czajkowski 7b41fa3b84 Solved part2 2 недель назад
  Piotr Czajkowski 4846c4faed Solved part1 2 недель назад
  Piotr Czajkowski dcccc8aa2d Better? 2 недель назад
  Piotr Czajkowski e824f613fd Solved for sample, not for input 2 недель назад
  Piotr Czajkowski 60b7ae89bd Able to read input 2 недель назад
3 измененных файлов с 1040 добавлено и 0 удалено
  1. 136 0
      07/code.go
  2. 54 0
      07/description.txt
  3. 850 0
      07/input

+ 136 - 0
07/code.go

@@ -0,0 +1,136 @@
+package main
+
+import (
+	"bufio"
+	"fmt"
+	"log"
+	"os"
+	"strconv"
+	"strings"
+)
+
+type Equation struct {
+	result  int
+	numbers []int
+}
+
+func readInput(file *os.File) []Equation {
+	scanner := bufio.NewScanner(file)
+	var equations []Equation
+
+	for scanner.Scan() {
+		line := scanner.Text()
+		if line == "" {
+			break
+		}
+
+		var equation Equation
+		parts := strings.Split(line, ": ")
+		if len(parts) != 2 {
+			log.Fatalf("Bad input: %s", line)
+		}
+
+		var err error
+		equation.result, err = strconv.Atoi(parts[0])
+		if err != nil {
+			log.Fatalf("Problem parsing '%s': %s", parts[0], err)
+		}
+
+		numbers := strings.Split(parts[1], " ")
+		for _, number := range numbers {
+			item, err := strconv.Atoi(number)
+			if err != nil {
+				log.Fatalf("Problem parsing '%s': %s", number, err)
+			}
+
+			equation.numbers = append(equation.numbers, item)
+		}
+
+		equations = append(equations, equation)
+	}
+
+	return equations
+}
+
+func concatenate(a, b int) int {
+	if a == 0 {
+		return b
+	}
+
+	result, _ := strconv.Atoi(strconv.Itoa(a) + strconv.Itoa(b))
+	return result
+}
+
+func check(equation Equation, index, result int, conc bool) bool {
+	if result > equation.result {
+		return false
+	}
+
+	if index >= len(equation.numbers) {
+		if result == equation.result {
+			return true
+		}
+
+		return false
+	}
+
+	resultAdd := check(equation, index+1, result+equation.numbers[index], conc)
+
+	resultConc := false
+	if conc {
+		resultConc = check(equation, index+1, concatenate(result, equation.numbers[index]), conc)
+	}
+
+	if result == 0 {
+		result++
+	}
+	resultMul := check(equation, index+1, result*equation.numbers[index], conc)
+
+	if resultAdd {
+		return resultAdd
+	}
+
+	if resultConc {
+		return resultConc
+	}
+
+	return resultMul
+}
+
+func parts(equations []Equation) (int, int) {
+	var part1 int
+	var toRecheck []Equation
+	for _, equation := range equations {
+		if check(equation, 0, 0, false) {
+			part1 += equation.result
+		} else {
+			toRecheck = append(toRecheck, equation)
+		}
+	}
+
+	part2 := part1
+	for _, equation := range toRecheck {
+		if check(equation, 0, 0, true) {
+			part2 += equation.result
+		}
+	}
+
+	return part1, part2
+}
+
+func main() {
+	if len(os.Args) < 2 {
+		log.Fatal("You need to specify a file!")
+	}
+
+	filePath := os.Args[1]
+	file, err := os.Open(filePath)
+	if err != nil {
+		log.Fatalf("Failed to open %s!\n", filePath)
+	}
+
+	equations := readInput(file)
+	part1, part2 := parts(equations)
+	fmt.Println("Part1:", part1)
+	fmt.Println("Part2:", part2)
+}

+ 54 - 0
07/description.txt

@@ -0,0 +1,54 @@
+--- Day 7: Bridge Repair ---
+
+The Historians take you to a familiar rope bridge over a river in the middle of a jungle. The Chief isn't on this side of the bridge, though; maybe he's on the other side?
+
+When you go to cross the bridge, you notice a group of engineers trying to repair it. (Apparently, it breaks pretty frequently.) You won't be able to cross until it's fixed.
+
+You ask how long it'll take; the engineers tell you that it only needs final calibrations, but some young elephants were playing nearby and stole all the operators from their calibration equations! They could finish the calibrations if only someone could determine which test values could possibly be produced by placing any combination of operators into their calibration equations (your puzzle input).
+
+For example:
+
+190: 10 19
+3267: 81 40 27
+83: 17 5
+156: 15 6
+7290: 6 8 6 15
+161011: 16 10 13
+192: 17 8 14
+21037: 9 7 18 13
+292: 11 6 16 20
+
+Each line represents a single equation. The test value appears before the colon on each line; it is your job to determine whether the remaining numbers can be combined with operators to produce the test value.
+
+Operators are always evaluated left-to-right, not according to precedence rules. Furthermore, numbers in the equations cannot be rearranged. Glancing into the jungle, you can see elephants holding two different types of operators: add (+) and multiply (*).
+
+Only three of the above equations can be made true by inserting operators:
+
+    190: 10 19 has only one position that accepts an operator: between 10 and 19. Choosing + would give 29, but choosing * would give the test value (10 * 19 = 190).
+    3267: 81 40 27 has two positions for operators. Of the four possible configurations of the operators, two cause the right side to match the test value: 81 + 40 * 27 and 81 * 40 + 27 both equal 3267 (when evaluated left-to-right)!
+    292: 11 6 16 20 can be solved in exactly one way: 11 + 6 * 16 + 20.
+
+The engineers just need the total calibration result, which is the sum of the test values from just the equations that could possibly be true. In the above example, the sum of the test values for the three equations listed above is 3749.
+
+Determine which equations could possibly be true. What is their total calibration result?
+
+Your puzzle answer was 4998764814652.
+--- Part Two ---
+
+The engineers seem concerned; the total calibration result you gave them is nowhere close to being within safety tolerances. Just then, you spot your mistake: some well-hidden elephants are holding a third type of operator.
+
+The concatenation operator (||) combines the digits from its left and right inputs into a single number. For example, 12 || 345 would become 12345. All operators are still evaluated left-to-right.
+
+Now, apart from the three equations that could be made true using only addition and multiplication, the above example has three more equations that can be made true by inserting operators:
+
+    156: 15 6 can be made true through a single concatenation: 15 || 6 = 156.
+    7290: 6 8 6 15 can be made true using 6 * 8 || 6 * 15.
+    192: 17 8 14 can be made true using 17 || 8 + 14.
+
+Adding up all six test values (the three that could be made before using only + and * plus the new three that can now be made by also using ||) produces the new total calibration result of 11387.
+
+Using your new knowledge of elephant hiding spots, determine which equations could possibly be true. What is their total calibration result?
+
+Your puzzle answer was 37598910447546.
+
+Both parts of this puzzle are complete! They provide two gold stars: **

+ 850 - 0
07/input

@@ -0,0 +1,850 @@
+426048: 425 608 69 88 1 282
+1234: 8 53 21 2 611 1 538
+3493064: 42 823 101 932 966
+7851123: 81 52 937 7 9
+109137611815: 9 4 9 1 9 5 13 97 18 1 4
+143516213: 2 906 6 5 12 22 578 3 3
+629453: 7 492 3 28 6 6 9 104
+5423661: 5 2 8 8 91 4 6 7 3 40 8 6
+18682395: 93 37 3 1 431 765 2
+556488358421: 794 98 33 6 917 7
+14604120: 89 13 65 703 17
+51347: 24 9 908 8 9 3 6 36 41 6
+1200264: 1 324 69 614 9 34 52
+84467: 99 1 694 50 64
+832680: 3 58 68 45 3
+13238: 4 3 58 9 652
+1505251: 3 24 97 1 29 669 5
+28869324: 99 749 1 46 74
+125890: 6 894 7 6 87 9 2
+265251: 8 9 8 87 251
+928664914: 4 7 6 8 664 8 2 9 1
+103228624: 7 2 73 7 94 91 95 26
+5765376: 442 85 4 41 8 742 8 4 8
+101551004: 2 78 991 38 75 8 4
+11531: 4 42 589 122 1
+230639: 88 6 3 722 3 9 1
+533796498: 66 80 3 2 101 4 5 2 501
+8494148: 32 35 79 2 8 3 30 2 8
+222246692: 23 41 13 94 970 689
+9841934: 2 998 419 815 5 809
+2186556: 51 9 9 660 4 2 9 8 69 7 3
+11207789126: 1 9 425 1 68 5 9 2 293 9
+33355203: 7 199 5 84 119 57
+60424: 989 61 79 8 8
+651253: 3 4 904 8 2 8 72 87 493
+2099106644: 277 842 9 624 22
+29145931: 3 6 15 3 7 9 70 6 1 1 6 5
+63140: 8 79 61 77 82
+720845730: 9 3 43 1 53 45 650 81
+3030: 45 57 85 280 5 94
+64316066: 7 6 7 422 14 953 37 4 2
+31898201: 77 74 3 622 3 797
+99024982725: 48 77 1 3 47 8 1 30 846
+3086415: 5 139 1 6 1 8 2 24 2 3 6 9
+1604915280: 2 7 652 74 321 7 18 4
+1040: 316 22 7 3 4
+792201: 748 7 22 488 99 493 4
+1449102: 23 525 6 4 4 5 82
+6672: 8 1 563 7 9 593 863 1 4
+641235: 18 5 76 3 87 8 8 93 15
+836: 399 2 31 7
+2589888404878: 4 8 94 21 41 40 4 8 77
+79158297957: 221 570 58 29 795 6
+94656: 64 547 254 223 87
+158670130: 2 9 3 4 32 2 645 2 6 5
+1172900: 5 624 9 5 3 69 38
+18570144924: 6 3 570 144 926
+11809188: 63 26 801 77 7 9 90
+17569711116: 9 9 2 2 156 793 3 109 4
+72864: 8 2 3 1 5 3 99 8 4 72
+30090677155977: 38 89 11 5 217 41 9 79
+54186: 5 418 6
+536456640: 1 53 273 27 3 1 35 52
+1324: 568 47 2 45 5 2 40
+255466537: 98 49 133 4 82 56
+108593: 440 931 5 635 54
+274562: 18 4 88 12 3
+2310: 168 125 6 551 1
+158226796: 4 2 1 71 56 18 67
+227860: 632 36 2 68 5
+254276307: 211 927 13 62 57 90
+969151: 96 75 1 79 6 608 1 856
+1381920960: 329 7 7 6 4 3 5 51 5 4 3 8
+57750433: 466 22 1 43 6 1 131
+2039463: 8 532 4 2 2 4 3 59 245 1
+924: 4 2 42 57 2 23
+984: 9 5 1 3 4
+3490: 32 9 8 5 7 7 18
+764789: 47 91 3 83 341 2 942 4
+8761312983: 1 5 1 645 2 56 981
+49375245: 46 16 94 4 67
+1371731088: 258 80 58 98 119 1 6
+1691074: 3 653 36 8 2 4 61 153
+237984: 3 60 942 4 84 514
+8487: 3 836 6 3 7
+1302665: 8 327 850 4 8 848 637
+338504789434: 9 7 96 4 27 58 1 7 7 431
+4375: 5 320 13 87 62
+39114592: 24 74 32 3 53 53 8 58 9
+55211: 1 2 5 261 3 6 6 3 873 6 5
+3930310: 6 727 89 883 77
+105416741: 8 6 2 7 830 2 7 81 29 72
+1864306: 752 37 67 22 76
+10308245: 460 6 22 56 243
+8724688: 61 143 1 688
+802716549428: 81 991 6 5 494 30
+4542460: 5 11 52 818 924
+3187936924: 8 9 54 879 356
+63545: 1 459 7 429 71
+117919: 9 76 202 28 91 1
+3743973: 74 82 5 41 5 269
+861952: 57 558 68 7 2
+3334911: 668 16 39 8 255
+66798536: 27 9 931 6 92 65 3 3
+8653262: 4 82 5 326 2
+658062508: 5 97 94 2 5 6 9 3 55 6 7
+22128516: 111 222 898
+1200278: 40 5 6 269 1 8
+8492254: 465 206 452 28 74 6
+3976640: 97 49 2 8 340
+6598260668: 7 20 3 459 9 9 9 66 8
+349711968: 699 417 1 4 1 9 50 4 4 8
+4360998090: 46 474 98 40 5 9 586 2
+38968452095: 4 8 59 12 7 172 6 592
+7435934408: 521 8 34 8 32 2 2 2 7 79
+3601746: 772 4 711 1 61 7
+1037835487: 2 33 58 143 836 7
+5238563720270: 5 238 5 5 4 9 720 27 2 5
+73195290: 1 5 3 442 4 46 2 7 74 9
+39219: 7 612 3 676 2 9 5 58 3 3
+171333389699: 63 45 681 1 9 868 3 96
+5938: 5 554 315 59 8
+26921: 93 28 3 36 843
+462492: 370 38 563 73 443
+372492502: 9 1 521 5 407
+252499564: 6 1 676 72 5 91 736 44
+9089304: 8 405 786 1 28
+22290929687: 18 8 255 512 849
+496884960: 62 9 691 5 3 52 2 418 1
+52469758: 7 21 96 244 80
+1915494: 72 667 81 32 1 5
+9240: 10 4 9 8 48 21
+1229174: 39 965 1 6 16 2 676 73
+63520233: 629 6 20 20 2 31
+40053664: 520 36 298 72 207
+31513519: 5 63 13 52 1
+73259497328: 105 380 5 4 81 92 2 82
+380149: 5 2 9 59 84 52
+3532752: 75 6 40 8 7 9 1 4 7 7 48
+735865836: 2 63 65 3 220 42 58
+1036899: 1 972 63 89 6
+119723575: 885 89 2 8 95 775
+3394585738: 1 14 571 49 3 218 264
+43184: 9 47 91 47 18 728
+49179361: 3 2 358 1 27 7 8 5 1 35 1
+60589: 51 9 55 8 31
+3853: 376 9 454 6 9
+97218628: 727 238 7 1 5 3 562 67
+573: 3 18 8 47 306
+2673281: 37 17 850 5 31
+2519097323: 4 4 5 97 433 8 9 95 142
+6282472: 46 1 691 942 3 472
+1997842: 25 474 46 4 4
+21463827009: 6 23 2 74 68 7 1 540 5 6
+52876: 55 96 7 3 3
+5458: 97 56 11 8 8
+306: 4 93 5 1 3
+2246440404358: 35 2 97 944 68 53 358
+2156122429948: 627 6 8 625 3 796 3 1 9
+705471450: 257 448 47 1 450
+12086441200083: 60 4 322 5 3 8 5 5 20 86
+95185977895: 98 5 36 209 966
+66643: 1 3 7 1 6 43
+243331: 233 9 57 6 756
+12661228256: 590 33 4 6 7 5 4 774 8 4
+1100: 141 1 952 1 5
+10510801045: 69 2 2 9 86 5 9 1 76 28 3
+9888464534: 77 6 246 98 7 74 967 5
+361718875114: 2 97 4 725 12 1 5 186 6
+106512316: 40 7 2 8 449 818 536
+7588010: 64 694 772 1 291
+991: 23 4 7 1
+417: 6 45 7 75 65
+15920852: 55 93 8 8 3 3 5 8 5 7 8 9
+699: 4 8 55 43 589
+35097279829: 4 6 2 2 7 9 58 9 5 7 982 9
+108684: 5 6 2 62 283 1 6 4 9 2 1 6
+35276: 28 575 4 57 677
+8895075: 5 175 18 8 8 171
+40618: 7 219 38 7 558 54 46
+55909321: 4 4 4 6 3 2 41 705 8 3
+176390408: 496 6 61 6 8 3 64 5 2 5
+407788355: 40 778 7 603 3 747
+102608197: 81 5 348 5 7 26 1 4 237
+8020532: 9 9 9 1 969 8 4 5 8 884
+2581035: 66 5 388 83 7
+802185122: 561 993 4 360
+3277848705: 9 6 53 9 95 6 7 11 7 6
+134464957445: 1 493 1 9 495 74 44
+229748861160: 67 46 3 205 234 518
+2940111322: 37 12 917 589 22
+18670960793: 9 6 5 3 9 8 261 3 1 46 4
+1142150721: 5 16 55 5 212 5 5 2 18 3
+22196443505: 815 786 45 77 4 1
+573211: 2 377 7 24 18 9
+4843: 3 6 9 44 4 82 8
+302249666485: 3 194 57 134 54 717
+662063: 5 3 2 1 624
+132572: 6 8 36 82 57 2
+3864582: 2 3 24 7 582
+1690: 102 691 4 128 765
+1209: 19 8 7 7 96
+126089845: 7 5 8 5 98 736 3 7 9 1 7 6
+46487320: 7 1 664 7 249 71
+39486: 46 405 1 87 160
+2736552: 3 28 8 83 7 28 537
+2172301065: 63 91 618 3 55
+523522: 93 1 67 362 522
+986428764: 985 978 446 4 722 43
+12315880: 9 29 96 8 470
+3984391: 39 843 92
+5689708: 5 4 5 7 7 576 6 157 6 19
+64505661: 64 1 505 397 262
+227515138: 227 5 1 513 5
+215361445: 3 83 63 820 93 86 2 46
+34003007060: 651 993 2 526 60
+16267: 920 7 1 2 834 6 58 69
+267374268991: 6 89 73 9 8 826 8 71 59
+112166154: 10 2 93 5 66 155
+135: 9 1 5 42 43
+11248: 70 1 423 8
+2911500: 7 1 379 10 647
+65618: 984 65 686 971 1
+1423917: 23 24 26 9 18 1 3 99
+1436633024645: 2 84 134 9 2 9 9 8 79 8 2
+280912: 935 3 3 62 52
+102593598: 442 2 326 89 3 4 1 7 75
+38611: 3 9 503 9 6 7
+36060: 5 8 1 16 4 601
+28487: 73 691 6 37
+721930973: 72 18 830 479 70
+36324778803: 800 100 3 2 26 454
+70492231245: 571 990 211 5 591
+801607886: 2 79 33 888 80 7 886
+15442400: 28 69 999 3 72 157 8
+354682: 8 40 1 3 5 5 4 8 3 18 9 1
+11718044: 9 180 31 20 43
+2292878: 7 56 82 229 425
+8686510: 37 390 2 64 1 9 291 4 3
+47239: 2 77 52 4 9 9
+23755253: 2 3 1 14 707 19 10 22 1
+20814560: 68 8 44 536 1 3 2 4 2 2
+431195040: 3 579 696 74 1
+29632103424: 32 66 6 7 6 62 898
+3417: 8 81 2 28 869
+10513496180: 211 3 56 7 2 6 7 135 47
+4575903869: 45 6 2 3 9 1 903 8 6 9
+481562: 2 15 946 50 5 9 3
+23919714428: 27 8 335 3 2 6 39 4 2 6
+7227024325: 393 870 603 211 22
+113705615: 16 7 76 94 561 4
+36627744: 31 879 122 467 76
+9682305217682: 3 1 3 8 5 9 739 1 1 835 1
+1883: 19 215 8 1 14
+310865765704: 4 5 93 47 8 3 6 8 5 703 4
+65640: 2 3 9 5 671 1 89 9 3 9 3
+34615688: 8 581 1 9 1 6 5 699 4 90
+2874960: 136 2 372 936 55
+125692: 11 4 89 28 2
+21607840833966: 9 9 950 1 75 96 871 39
+23335608: 45 75 54 7 51
+6234: 20 18 819 73 6 654
+250181: 92 8 4 338 50 7 4
+38566354: 9 7 120 611 37
+62704469: 2 8 9 71 5 66 44 5 6 10
+385850: 5 8 8 7 2 8 63 6 3 678 3 2
+115032285: 8 150 96 7 913 15 21
+24871: 8 3 270 600 1
+77113465: 7 555 723 1 6 7 465
+6231: 5 8 5 956 5
+388: 4 291 1 18 4 72
+63870451184: 1 1 3 2 911 508 8 293
+961: 5 9 1 8 4 9 87 5 10 5 26 1
+651002: 2 861 685 2 84 5 2
+2999: 9 328 41 3 3
+697540864632: 38 79 4 2 726 8 4 316 2
+13399549: 3 1 11 73 8 59
+3562090: 866 1 6 83 674
+7828907: 74 2 706 87 2 10
+2386854: 1 2 6 68 78 5 2 4 3 5 5 4
+81760686: 706 5 7 1 6 6 2 7 2 19 87
+214797: 8 9 3 421 8 1 3 4 1 9 42 9
+54427336: 30 712 8 173 53 79 73
+1053341344949: 65 569 3 712 238 4
+1448736525566: 160 97 9 6 4 6 8 57 563
+2123419597390: 606 83 8 9 9 6 6 9 7 393
+123978240: 336 8 4 9 4 6 8 7 7 2 8 60
+35148535: 2 7 4 48 565 8 4 2 8 9 5 2
+204124802990: 9 630 13 340 36 7 583
+539960: 44 66 196 25 960
+37179596269: 5 9 63 806 153 6 267
+46944: 256 517 694 4 8
+164447918604: 3 3 5 68 2 239 59 3 20 1
+606512067: 202 5 85 25 2 1 7 4 6
+582: 6 82 4 78 1 8
+358489335615: 4 8 36 290 49 3 356 12
+37968920318: 619 787 27 6 9 203 1 8
+45917891663: 6 97 6 743 4 91 665
+56974260612: 681 192 73 598 894
+1433362936: 23 81 301 2 938
+13387282062: 71 5 209 7 382 7
+1440477: 3 9 37 3 66 4 2 667 58 9
+54297: 87 359 12 77 5 2 7
+45930136: 75 180 3 3 8 378 104 8
+15415060: 60 9 86 5 795 94 115
+152568: 9 1 61 5 68
+27460988: 2 74 60 488 501
+1057969: 284 4 4 93
+2426020: 856 7 13 202 2
+49096: 6 5 24 2 68
+9219: 345 9 3 85 8 23 15 5
+502450092967: 1 142 17 6 6 1 85 589
+252469069: 478 8 7 1 57 8 66 59
+24272: 1 8 8 7 4 752 9 6 1
+156972819: 21 9 858 968 3
+4435814457: 77 9 8 8 6 1 14 460
+7029: 57 3 5 6 971
+7053569543: 70 52 914 2 653 531 9
+19649102: 9 7 9 5 22 545 4 839 94
+267089242: 3 5 3 83 8 2 342 7 29 5 7
+93765: 40 945 53 957 47
+815253659: 48 97 581 700 8 52 7
+14381: 70 1 91 2 1
+6727770: 8 5 1 2 7 47 96 2 4 2 9 38
+488959: 12 7 770 5 7
+444850: 57 3 7 68 6 350
+359101435530: 819 36 14 3 143 553 2
+255298640: 5 7 2 336 9 6 25 6 226 8
+627971804: 91 69 71 723 81
+376876294: 603 625 5 15 779
+4870224: 8 32 3 2 68 8 93
+2921378615: 7 3 1 1 7 7 272 2 3 953 5
+25762: 22 3 475 1 288
+9334: 8 9 6 1 5 125 42 364
+61711944: 453 61 26 6 4 8 3
+31159097: 62 1 5 953 605 32 97
+1486721291: 178 87 68 96 9
+164195070864: 93 879 40 795 8 4 22
+209: 2 83 46
+448419: 16 657 642 341 4
+2213729487: 7 9 9 7 1 33 6 6 7 457 3 4
+826: 83 91 642 8 2
+69845916113: 4 6 87 39 6 1 6 62 78 77
+420247390: 7 8 70 5 9 6 6 33 1 9 6 53
+468391418: 1 5 4 363 885 7 3 9 6 3 8
+730151: 729 320 7 816 9
+6121517413: 707 9 6 6 4 4 6 43 6 9 3 4
+1331520: 8 304 44 288 95
+2651662: 24 755 9 34 1
+55557168: 45 8 7 13 6 49 716 8
+925030462: 453 992 2 8 8 64 4 2 3
+22929993: 6 1 9 403 8 6 7 9 677 9 8
+136079: 10 7 80 8 1
+4018560: 24 2 115 4 182
+155443251648: 1 89 7 9 6 2 2 819 48
+47311914088: 1 739 4 9 498 7 71 7 4
+12959675904: 7 558 529 98 1 84 64
+117075505: 4 651 2 693 2 63 6 89 7
+8663990338: 3 5 36 5 2 989 3 23 337
+38598654357: 8 78 6 7 3 2 5 1 9 1 343
+1066: 3 68 3 447 7
+9763884: 4 8 11 4 806
+2649: 710 3 76 94 1 3
+97022: 6 5 4 84 77 2
+4436743: 2 4 20 36 7 37 6
+10887: 8 1 931 930 26
+41289: 5 160 2 2 4
+64001920: 561 4 3 61 38
+4877046: 961 40 84 3 58
+94551: 942 3 5 3 1
+2348968: 234 86 3 6 8
+4829697944: 5 51 4 9 7 8 687 122 8
+1275687: 531 4 6 262 9 9
+866: 5 3 7 3 8
+62826: 1 6 1 1 6 2 634 84 491 7
+234421278: 586 4 2 12 81
+987: 5 81 3 31 864
+1512712546: 9 8 7 63 7 125 47
+81507: 1 4 800 69 38
+6885843415: 743 5 546 570 926
+28383880: 20 47 9 76 1 89 469
+8399: 73 86 242 8 877 994
+6734289681: 841 681 9 889
+2487534047373: 259 5 3 948 9 974 101
+11402873: 17 96 609 414 17 553
+18904325600: 55 21 735 4 325 600
+1335462451: 16 5 9 9 14 8 3 3 70 955
+70253: 2 115 30 9 2 38
+17112: 9 5 4 7 9 66 1 6 5 1 9 2
+240212907: 4 9 83 31 381 71 8 21 4
+1137902: 24 89 78 71 31
+17115001: 8 9 5 100 978 2
+8596391: 85 8 7 3 87 9 24 3 5 5 22
+536020: 80 67 17
+1999835: 8 241 881 8 790
+91503776: 1 6 419 4 5 7 7 2 6 8 91 7
+141043433: 470 5 59 6 4 796 1 2 3
+662831: 69 96 6 5 31 9
+2527482: 5 670 26 6 8 4 3 6 6 258
+663617436: 3 8 420 90 66 91 7
+5117396: 9 43 45 5 32 34 74
+286833458: 299 976 59 956
+1810904: 402 12 2 15 73 351 3
+14755500281: 339 44 1 161 3 3 2 1 3 2
+891738: 8 2 2 43 1 6 4 93 2 963
+1431924: 1 32 3 124 9 92 4
+18526: 572 3 33 7 71 27 4
+204101449: 650 314 9 5 50
+19637: 54 6 5 57 55
+46435032: 4 5 706 87 84
+3901884025: 21 5 80 167 377 335
+1357110633: 798 3 2 85 633
+368814453: 93 509 63 8 612
+16783688: 4 9 9 417 4 972 5 31 9
+12778007: 75 949 14 552 167
+3103890: 775 4 3 89 3
+746384: 52 14 91 74 5 8 305 9 8
+1324077: 1 132 24 2 1 6 674 967
+6907431: 203 9 3 7 2 6 3 6 30 4 3 3
+291241150: 142 5 2 5 909 5 500 86
+10416: 35 4 9 217
+222786114772: 428 3 36 98 836 1 52
+30956235: 5 263 130 3 193 37
+1807890624: 973 24 27 1 688
+70133160056: 822 711 9 1 4 2 6 5 5 5 7
+882460946: 1 8 8 6 3 1 3 2 5 943 2 3
+2371851: 8 27 50 5 890
+40024680321: 1 8 5 7 65 5 4 38 941 3 7
+487213: 29 9 661 697 9
+740743860807: 77 75 6 2 46 134 812
+17850: 20 9 9 26 83 5
+83290948: 5 91 8 75 2 927
+586005: 584 894 66 816 228
+483120417: 3 3 72 4 50 99 4 17
+21612195: 117 9 6 9 6 1 3 379 5 6 9
+1146285425: 70 5 863 1 945 427
+311680: 8 8 5 4 81 3 621 3 4 1 6 5
+81: 2 5 2 4 1
+1692432: 6 80 5 764 8 146
+982802: 73 73 2 8 4 3 8 5 3 5 7 2
+25409164560: 1 6 9 1 188 7 2 5 7 9 12 5
+366260: 318 47 47 1 78 7
+168240337: 5 944 11 6 9 9 4 3 5 2 67
+156807: 47 4 8 456 80 7
+14995745: 6 714 25 35 870
+24780095: 8 15 5 5 4 7 67 4 3 7 11
+104125: 557 482 2 22 2
+1844501: 41 2 9 357 7 202 32 5
+6275963892: 1 482 98 9 9 699 1 12 1
+3890574408: 176 78 786 6 28
+47467: 293 9 3 6 1
+926285: 9 2 532 96 5
+2209: 7 1 8 94 20 9
+219763712: 294 7 62 184 8 8
+1754288721: 344 99 440 155 814 9
+531930: 49 85 694 65 6 900 85
+1005239880: 1 733 9 94 6 997 2 4 60
+462: 33 9 26 131 8
+6132669: 9 52 546 4 6
+14541: 30 6 1 8 8
+49132039: 57 7 6 4 6 8 98 5 2 5 2 42
+10597759252: 40 7 3 622 8 10 9 7 7 6 9
+750879481848: 55 65 6 1 6 5 8 7 3 31 9 5
+301540320: 46 510 83 819 8 795
+25711201: 3 7 337 9 296 2 2 60 5 7
+3131219615335: 6 1 51 20 21 9 615 3 35
+190931: 6 6 9 7 836 2 1 7 6 1 552
+39873482: 1 61 950 90 687
+136495497599: 4 878 7 7 4 48 5 3 7 99 2
+62: 5 9 3
+4072901: 4 52 40 14 1 2 9 1 4 1 8 8
+3639889: 665 7 2 540 6 46 7 1
+44833: 8 910 6 472 1 8 3 672
+226176: 2 65 275 30 608
+100819083: 3 9 6 7 16 325 116 9 18
+2124636580913: 5 382 61 9 6 580 91 1
+18389: 71 5 6 4 6 2
+74957687: 7 2 7 8 5 9 5 59 9 636 6
+1935561104: 70 129 276 8 5 58 561
+285412: 39 26 7 961 98 2
+910425: 7 9 111 4 4 5 427
+1868263488: 7 973 1 56 654 52
+356: 9 9 7 64 4
+121563: 2 3 84 6 25 566
+11793880: 9 1 1 61 292 577
+6433920: 50 265 4 8 4
+757114712: 677 795 6 739 29 86 4
+92196314: 91 427 769 314
+3622: 9 5 32 3 9 8 9 20 65
+748249: 41 5 3 5 3 9 1 101 4 810
+57521100: 67 570 940 490 3
+694140: 42 712 4 1 92
+2584: 1 9 2 2 6 8 7 8 12 7 460 4
+1299844: 72 4 567 8 8 47
+4438062035: 7 710 541 133 8 1 996
+17848382: 733 639 949 13 44
+1285415254454: 377 73 415 786 82 3 2
+42573460: 1 8 2 3 317 730 79 381
+6487474065: 4 6 6 6 4 42 4 48 4 5 7 89
+11248830: 1 570 7 7 4 3 5 7 11 6 9 6
+1236900001: 24 10 720 625 57
+774935037: 293 473 63 40 66
+121832: 7 5 3 2 6 88 1 1 552 7 3 3
+1016743: 76 37 6 658 58
+2533368513: 61 4 55 636 596 21
+6990058: 4 1 835 30 204
+1847406607: 20 526 740 9 8
+779328000: 6 373 4 2 3 8 80 9 12 5 8
+96371: 3 5 88 208 156 7
+5419039: 3 8 517 90 41
+249830: 99 374 8 177 3 7 9 8 90
+100166088: 8 9 99 5 45 733 9 264
+3376144: 7 157 927 442 7 584 6
+43593660: 11 9 537 99 41
+411324689: 7 21 208 389 4 41 29 6
+234004: 61 323 7 87 89 62
+23183285: 23 18 26 6 88
+97916165533: 269 91 4 165 535
+1112448: 9 61 841 2 5 4 3 8 9 6 89
+8963: 896 5 1
+73558189852: 5 6 9 4 6 97 6 658 2 98 7
+13680414: 49 47 66 90 594
+24172014797: 48 336 8 5 1 479 7
+9967992824: 9 41 946 706 93 28 2 4
+76153297584: 47 81 66 2 975 84
+541346194846: 45 1 6 73 5 2 97 4 2 2 5 2
+2476666710: 2 630 15 208 17 630
+60279278: 6 982 17 61 6 3 845
+55027351: 4 528 9 2 88 135
+929699919: 3 89 480 9 8 2 99 5 4 21
+257203: 304 846 14 3 2
+19954464: 4 2 199 29 8 7 2 8 6 8 12
+349703121: 87 425 69 5 1 43 8 8 9
+9607739480: 120 8 1 4 3 7 3 6 3 4 74 3
+70229: 6 57 4 3 227
+19346675608: 4 3 7 4 3 7 466 3 5 5 609
+59456: 9 39 3 3 875 64
+4049373107: 490 831 2 825 85 1 7
+38708598: 9 8 89 40 412 1 7 18 2 5
+217787072132: 186 39 5 2 3 6 9 5 355 6
+1252444294: 382 309 78 42 9
+7796721302: 7 796 71 6 5 300
+232741316: 8 29 741 314 1
+26910444: 298 907 9 879 9 15
+40916974: 2 8 5 2 9 8 6 1 5 16 971
+34830687: 15 387 6 668 19
+49022893747: 778 140 1 17 7 4 9
+240774: 4 815 4 1 5
+2030: 4 95 11 46 895
+141432: 8 9 395 3 5 8 7 8 3 49 7 1
+466823: 1 32 544 26 71
+5847912: 202 47 694 82 7
+242621: 232 7 801 56 67
+330876: 8 4 2 2 2 2 7 150 5 18 7
+93687: 25 197 3 19 55
+71444393: 1 6 5 9 7 8 5 789 8 423 9
+6751035: 1 21 553 845 258 5 1
+191462315465: 957 31 2 3 15 464
+15511497: 55 8 2 94 73 289
+494852056149: 918 7 65 77 610 4 9
+116901382: 42 97 79 9 847 3 608 6
+287727946: 1 643 7 8 1 2 799 5 1 7
+26218340: 244 68 525 56 8 8 5 5 4
+76566: 9 77 13 60 6
+1830: 292 29 891 531 87
+403126: 356 9 148 58 706
+26406: 799 7 32 525 2 79 8
+61533769122: 1 551 8 75 6 983 189
+5083523328: 909 3 8 7 1 3 976 4 1 68
+35952796: 7 5 952 35 39 5 51
+167412767: 5 1 4 1 9 8 94 38 6 7 7 70
+2195302: 85 6 308 41 46
+1474198: 69 9 5 70 54
+364088987: 88 8 41 8 987
+78139858: 1 4 5 2 19 3 628 2 7 6 5 6
+4404409: 63 832 69
+78435: 7 47 2 61 5 16 7 21 5
+757520426: 77 2 98 98 26
+203318778: 4 281 991 7 5 62 31 8
+287102009: 8 88 930 764 73 6 8 7
+90227: 48 705 88 61 26
+8181666: 73 8 8 166 9
+4345042264: 16 1 3 8 23 5 183 8 62
+1748: 74 8 5 4 2
+253: 1 3 5 5 160 54
+7800887: 9 4 5 7 5 99 79 15 94 7
+5590: 14 42 8 5 81
+37762: 87 9 48 2 9 167
+333279: 2 2 58 80 363 524 1 57
+171214269218: 844 322 681 3 63
+118944: 5 8 7 873 93
+124807260: 419 9 9 3 40 8 270 300
+57067: 5 2 65 9 88 41 1
+67645321537: 92 3 2 715 36 71 4 4 9 6
+897: 1 7 827 62
+1191701596: 94 6 393 18 83 83 3 15
+1273: 3 4 7 1
+144149: 5 9 32 78 68
+1256472: 63 7 3 2 1 539 71 277 6
+30990621: 309 83 94 668 4
+38536499222: 2 510 18 1 9 95 88 780
+856374: 5 802 1 492 5 7 17
+130842660: 3 6 58 8 1 3 793 9 4 9
+69578132: 7 21 1 5 2 47 6 99 7 1 3 3
+5276748016: 8 7 53 1 208 226 93
+48947804: 5 910 9 3 8 1 330 773 2
+194740286300: 5 8 3 275 5 5 2 67 5 89 9
+22422998: 337 7 85 37 95 905
+6918244: 6 8 497 29 1
+45185615913: 97 710 90 9 1 9 1 810 3
+316116: 27 527 2 312 54
+11292: 929 9 4 5 201 64 9 384
+143302570: 4 16 808 8 117 82 888
+6574936: 810 8 94 844 91
+19500766: 927 48 20 7 67
+5496862: 4 4 2 5 86 8 399 28 3 3 7
+4081: 4 74 6 281 7
+107041551: 2 57 2 900 35 9 52
+365716: 8 34 43 277 3 719
+233199: 34 225 11 9
+75781172: 315 75 3 8 2 9 1 6 4
+6441: 3 601 327 1 3 6 45
+72: 7 5 6
+1847: 2 645 49 191 869 90 1
+689524: 27 4 504 47 44
+421965206413: 87 9 6 8 4 5 206 391 25
+965613600002: 4 846 6 280 7 140 690
+50559280: 8 1 6 4 2 4 567 26 534 4
+365496049: 9 4 32 4 8 7 6 686 7 4 2 5
+64994090: 2 9 4 1 21 74 3 73 79 7
+1241: 1 3 4 2 7 1 927 298
+7392027906: 8 350 66 4 2 7 909
+72665135998: 6 6 743 1 3 4 3 68 727 8
+42527813: 6 563 5 4 3 74 13
+2085967: 414 4 499 14 7
+10090710861: 386 49 70 80 95 41 21
+188483597: 7 582 4 8 218 54 1 877
+367380998: 2 2 2 6 96 3 900 5 998
+68095186: 23 615 83 8 58 665 27
+6509884572: 69 3 7 3 5 447 3 29 45
+24930077: 28 690 986 2 4 3 8 70
+886840: 24 5 86 770 45 5 883
+42180751: 55 6 7 350 535 356 90
+73846429: 761 303 97 4 36
+118157648: 762 70 33 91 1 9 221
+31303: 316 129 114 56
+2340: 1 2 1 90 13
+38925682: 993 392 77 2 5
+132208396: 881 37 1 90 5 8 7 3
+17362906539: 165 30 832 90 653 6
+513060: 806 636 6 352 86
+13556739: 451 47 42 13 3
+87166290: 5 85 372 295 72 4
+2085930558: 856 47 3 770 559
+1271377657: 9 33 460 8 7 7 8 914 6 3
+92480: 40 514 24 4 40
+203612568029: 9 8 9 3 4 593 8 4 4 80 3 1
+997367027585: 79 95 567 99 21 6 2
+14986059: 5 53 1 4 2 4 3 8 9 2 2 338
+16943: 7 4 20 353
+192411245217: 1 4 16 3 411 243 2 214
+3267945: 932 5 35 316 8 35 993
+7584118814: 7 671 470 45 7 3 34
+92005506: 773 3 57 87 6 1 761 8
+83148275295: 3 339 4 451 3 44 80 9 7
+2758387: 393 7 7 3 88
+158229124: 29 55 19 2 19 6 28 3
+19731329: 2 9 1 83 7 94 6 1 2 980 9
+372969: 6 731 54 84 9
+44398676936: 995 485 95 8 446
+29: 4 8 2 5
+28812: 917 31 113 6 27
+3221058: 4 4 121 4 4 5 83 41 620
+5012875154: 898 6 867 8 88 75 157
+619: 81 324 57 159
+2000875149: 877 559 36 5 57 387 8
+538511: 4 7 544 52 863
+37415205: 7 45 7 9 84 9 78 4 9 991
+87187684: 567 6 8 2 951 2
+723726: 7 146 73 188 2 12 9 62
+5611: 15 2 2 547 8
+161732: 8 19 1 4 8 39 32
+77322232001: 8 26 104 9 591 9 93 4 1
+7664: 9 8 5 45 7 2
+43978994: 462 45 951
+184200: 63 29 10 5 4
+24754844735: 574 385 653 66 2
+38841958460: 447 488 62 14 60
+512307698: 78 476 8 7 92 35 2 978
+978764208: 1 83 5 78 7 56 484 4 8 4
+51510: 9 1 77 9 7 32 38 7 583
+519848234: 89 192 64 9 659 7 8 4 3
+279759946564: 694 6 76 839 58 1 6 8 2
+27642337368: 30 7 9 658 999 7 368
+1714046887054: 9 4 3 88 3 699 1 7 3 976
+2096866: 762 7 4 2 9 7 4 7 1 2 27 2
+829347: 57 9 11 283 50 19
+5188: 9 98 18 397 4
+8546580: 3 931 494 63 95
+2569449: 4 318 202 3 8
+1008685401: 3 24 22 9 26 3 511 2 8
+38907: 341 1 41 3 61 4 64
+47134149: 59 5 6 423 9 55 2 6 37
+156: 4 5 48 80 8
+13690: 373 8 21 967 3
+152680: 5 4 62 3 9 75 1 7 6 2 5 4
+22638959: 203 8 12 282 4 90
+667766987: 6 184 969 39 93 7 5 3 2
+491050285: 9 3 9 9 9 7 6 28 270 6 8 3
+123681: 9 1 5 8 4 88 91 3 4 5 14 3
+2442314: 2 5 7 9 947
+66996296: 6 1 9 7 48 8 1 1 8 4 4 372
+527: 6 5 6 4 2
+18881838: 929 53 32 45 52 21 6
+41565: 44 3 73 665 8 52 2
+38558: 1 5 21 68 21
+6715471: 839 434 8
+6389: 91 7 6 9 5 7 178 974 5 4
+2117591196: 3 5 748 679 614 9 3 94
+28162196: 8 7 1 32 2 196
+35808181: 2 2 8 746 180
+9867444479: 73 352 40 6 9 1 2 48 1 4
+78674: 7 501 25 659 66
+45024: 4 4 3 3 18 18 57 276 7
+19756: 4 99 3 942 7
+799: 34 57 708
+157466: 8 2 6 8 7 678 40 9 6 69
+12013722: 53 771 14 3 7
+305851750: 8 736 8 8 5 6 3 34 8 7 5 1
+31627: 85 8 4 85 7
+120636732: 750 274 14 587 7 7
+239363098: 57 7 6 69 1 1 1 8 59 5 4 6
+23142: 7 7 4 3 8 579 6 6 8 8 50
+330: 3 42 4 9 8 5
+610059: 3 3 2 541 80 888
+15743730746: 31 237 561 6 84
+1289162: 5 6 57 370 11 28 8 5 2
+4912012: 49 120 12
+21034792439: 47 1 58 1 7 2 7 915 9 39
+10550: 2 3 9 970 45 8 514 1 5
+27651: 2 9 1 8 1 5 8 7 8 4 4 35
+53322: 8 87 4 8 2 66 63 96 759
+138446470: 26 6 47 682 4 71
+1648416: 9 278 7 657 3
+6538688411: 30 351 741 838 668
+1344480: 7 466 85 43 7 56 424
+244514648942: 468 4 7 2 5 2 1 2 37 945
+241060: 8 3 5 67 8 69 6 48 4
+40133289211: 659 7 87 9 7 2 9 17 4 1
+435126: 783 57 518 8
+17711006228220: 76 834 259 998 890
+5734080: 36 1 1 288 55
+8979895786: 9 2 93 110 38 8 5 21
+3330: 532 23 6
+10241840: 102 34 7 8 38
+13305407: 2 1 4 5 8 7 259 5 2 12 5 2
+1433165: 3 9 1 891 73 367 65
+177433659084: 44 3 58 41 477 10 4 2
+222432: 311 919 67 3 4 6 71 56
+85538: 1 4 7 2 910
+32399920: 9 4 9 9 9 343 93 8 3 8 70
+3157308169: 1 373 938 9 169
+48314570: 8 329 1 58 9 3 470 5
+2157760504767: 751 9 9 76 9 2 9 7 9 2 8 3
+113124347: 1 9 87 43 2 9 95 347 1
+234373743: 2 9 28 89 3 4 285
+65134472: 65 133 910 5 559
+5111: 5 42 2 513 9 53
+280608943: 45 909 7 7 7 5 5 9 4 587
+4944: 40 1 9 45
+177101: 80 4 186 35 2
+8123256299: 643 1 251 7 58 4 9 296
+2610013: 28 55 24 2 655 487 6
+3473695: 10 681 6 7 17 5
+102288: 44 8 693 6 8 980 4 2
+792006: 80 9 71 8 1 44 73 6 82
+8393424: 656 4 6 4 3 8 4 9 8 87 3 4
+3357448904: 9 2 514 71 901
+11955840: 5 778 1 3 2 8 3 2 4 4 16
+33523655: 1 1 3 1 1 294 8 68 4 5 8 3
+40658: 1 477 43 78 20
+419: 5 99 4
+10692: 9 8 4 4 27
+2316100872: 772 5 1 6 812 6
+8456347: 98 587 147 25
+45388: 6 755 4 4 18 59
+98449258: 90 859 57 260 7
+290537744: 880 4 3 514 8 11
+1920630535: 5 7 1 57 4 6 4 84 1 771
+41738341141: 8 3 103 9 3 4 6 5 962
+267888: 53 5 71 5 36
+457162268328: 14 3 754 7 71 9 6 318
+9818370: 378 26 9 30 10 3 90
+136158886: 8 1 7 95 325 2 1 5 3 8 7
+407: 6 42 69 8 78
+1012705468: 822 4 44 7 657 811
+4180406340096: 466 981 98 12 6 36 9 4
+10705064: 4 424 136 5 931 181
+2217819683: 7 51 62 9 9 423 96 3 5 4
+7508279323: 3 250 555 272 3 6 32 2
+2658216: 558 18 25 4 66
+59297: 60 97 2 747 351
+7495229447: 8 328 9 266 28 50
+2644059830523: 57 55 2 97 574 815 8
+54008124608: 94 751 10 958 57
+2207268: 50 592 72 49 50 7 9
+9395936945: 83 33 540 34 9 806 4
+65754981: 340 41 89 53
+5424: 267 8 2 69
+194627: 564 43 8 613 1
+75167376: 75 166 1 972 404
+237336645000: 628 915 45 700 590
+522553: 7 58 4 91 7 2 7 9 148 49
+4897: 29 13 6 95
+13670996090: 500 614 6 73 31 610
+16290039939: 74 7 6 1 7 882 87 2 438
+2804002896239: 85 2 41 17 5 52 774 5
+86506: 910 1 29 157 73 74
+21660911180: 722 2 15 911 180
+6815: 6 743 72
+114802992537: 6 17 215 5 39 1 5 186 2
+720907: 203 61 587 39 81 8
+15904808: 28 3 80 96 5 5
+200829237621: 999 710 37 3 744 27
+95188135587: 835 3 68 49 755 579 8
+61525: 81 49 4 75 3 4 5 8 28
+13221210319: 3 486 9 6 6 4 20 5 5 6 2 8
+3728996709124: 945 71 9 708 62 96 6 1
+39283710: 7 46 6 3 64 51 9 717
+24046652: 1 8 92 61 34 2 646 46 7
+178492223: 4 1 18 61 81 5 7 2 8 194
+1677144138: 6 123 83 227 39
+105579656: 2 3 4 7 2 96 8 6 63 6 366
+78276190303: 7 94 9 131 13 41 3 7 9
+110367683: 778 9 8 5 5 3 4 9 394 9
+7626312605: 4 502 5 552 1 72 598 5
+56319236258: 9 5 39 82 6 8 9 548 258
+5406139: 642 842 45 4 6
+45342: 7 29 96 267 8 1 2 50
+7525096: 1 820 330 35 97
+80899207: 11 236 80 9 7
+1022048029: 328 76 82 5 24 7
+853304431680: 313 630 752 6 603
+4608388638: 31 9 958 177 93
+68959734: 7 8 33 5 44 732 6 2 6 4
+4653: 845 319 4
+2523796352: 2 51 789 2 4 8 98
+185856: 885 21 6
+19948509: 72 83 24 3 910 396
+1680716: 236 37 35 71 3