Have you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the game.Overall, the game has 25 types of cards (5 distinct colors and 5 distinct values). Borya is holding n cards. The game is somewhat complicated by the fact that everybody sees Borya's cards except for Borya himself. Borya knows which cards he has but he knows nothing about the order they lie in. Note that Borya can have multiple identical cards (and for each of the 25 types of cards he knows exactly how many cards of this type he has).The aim of the other players is to achieve the state when Borya knows the color and number value of each of his cards. For that, other players can give him hints. The hints can be of two types: color hints and value hints. A color hint goes like that: a player names some color and points at all the cards of this color. Similarly goes the value hint. A player names some value and points at all the cards that contain the value.Determine what minimum number of hints the other players should make for Borya to be certain about each card's color and value.

Print a single integer — the minimum number of hints that the other players should make.

NoteIn the first sample Borya already knows for each card that it is a green three.In the second sample we can show all fours and all red cards.In the third sample you need to make hints about any four colors.

The first line contains integer n (1 ≤ n ≤ 100) — the number of Borya's cards. The next line contains the descriptions of n cards. The description of each card consists of exactly two characters. The first character shows the color (overall this position can contain five distinct letters — R, G, B, Y, W). The second character shows the card's value (a digit from 1 to 5). Borya doesn't know exact order of the cards they lie in.

Input:
2
G3 G3

Output: 0

Input:
4
G4 R4 R3 B3

Output: 2

Input:
5
B1 Y1 W1 G1 R1

Output: 4

Input:
10
Y4 B1 R3 G5 R5 W3 W5 W2 R1 Y1

Output: 6

Input:
3
G4 G3 B4

Output: 2

Input:
2
W3 Y5

Output: 1

Input:
2
W5 Y5

Output: 1

Input:
100
W4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5

Output: 8

Input:
100
B5 G3 Y2 W3 W1 G1 Y4 G3 G4 B5 W4 B5 Y3 R5 B4 G4 G4 B1 G1 R5 G4 B4 G1 G2 W1 Y4 R5 Y3 W5 W4 Y5 W1 B4 G3 R2 R3 W1 B4 Y4 G2 G2 R1 Y5 W1 Y3 B3 G5 Y3 G3 W2 W5 Y4 B2 Y5 R4 B2 Y3 W4 G2 G3 R2 W1 B4 B2 B1 Y2 Y2 Y3 W3 Y5 W1 R1 R1 R4 R4 R4 Y1 Y3 B2 Y3 Y1 R3 G4 G4 Y5 B5 W2 G1 G5 B3 G1 Y1 R2 G5 R2 Y5 R5 Y4 R4 W2

Output: 8

Input:
100
Y3 Y3 Y5 Y2 Y4 Y1 Y2 Y3 Y1 Y5 Y3 Y1 Y4 Y5 Y5 Y3 Y1 Y5 Y2 Y3 Y1 Y4 Y4 Y1 Y2 Y2 Y4 Y2 Y4 Y5 Y5 Y2 Y3 Y1 Y3 Y5 Y3 Y1 Y5 Y3 Y3 Y2 Y5 Y1 Y5 Y5 Y4 Y2 Y2 Y1 Y2 Y4 Y3 Y2 Y5 Y3 Y4 Y3 Y1 Y4 Y2 Y4 Y4 Y3 Y3 Y1 Y1 Y4 Y2 Y5 Y3 Y4 Y4 Y4 Y3 Y2 Y2 Y2 Y3 Y4 Y4 Y2 Y1 Y2 Y2 Y4 Y3 Y5 Y4 Y2 Y5 Y3 Y1 Y5 Y2 Y5 Y4 Y1 Y2 Y1

Output: 4

Input:
100
G3 B3 G3 Y3 R3 G3 R3 G3 W3 B3 B3 B3 R3 Y3 Y3 W3 R3 B3 G3 W3 G3 W3 Y3 R3 Y3 W3 W3 G3 W3 G3 W3 Y3 G3 R3 Y3 W3 W3 Y3 Y3 Y3 R3 W3 R3 G3 W3 W3 G3 Y3 B3 W3 B3 Y3 G3 Y3 B3 Y3 W3 Y3 R3 Y3 R3 W3 W3 W3 G3 Y3 G3 R3 B3 R3 Y3 R3 Y3 R3 Y3 R3 Y3 R3 W3 Y3 R3 W3 W3 W3 G3 G3 Y3 B3 Y3 R3 G3 G3 B3 B3 Y3 R3 G3 R3 W3 G3

Output: 4

Input:
100
W5 Y5 Y3 W3 Y5 Y5 W5 W5 Y3 W5 Y5 Y3 W5 Y5 W5 W3 Y3 Y5 W3 W5 Y5 W3 Y5 Y3 W3 W3 Y3 Y5 W3 W3 Y3 Y5 W3 Y5 Y5 Y5 W5 Y5 W5 Y5 W5 W5 W3 W5 W3 Y3 W5 W3 W3 W5 Y3 Y5 W5 W5 W3 W5 W5 Y5 W5 W3 W3 W3 Y3 Y5 Y5 Y3 Y5 W5 W5 Y5 W3 W3 W5 Y5 Y5 Y3 W5 W5 W3 Y5 W3 W5 Y3 Y5 W5 Y3 Y3 W3 Y3 Y5 Y3 Y3 W5 Y5 Y3 Y5 Y3 W3 Y3 W5

Output: 2

Input:
100
Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y5 Y5 Y3 Y3 Y5 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5 Y3 Y3 Y3 Y5 Y3 Y3 Y5 Y3 Y3 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y3 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y5 Y3 Y5 Y5 Y5 Y5 Y5 Y5 Y3 Y3 Y3 Y5 Y5

Output: 1

Input:
100
Y3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 Y3 W3 Y3 Y3 Y3 W3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 W3 Y3 W3 W3 W3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 W3 Y3 Y3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 W3 W3 W3 Y3 W3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 Y3 W3 Y3 Y3 W3 W3 Y3

Output: 1

Input:
10
W1 Y4 Y3 W3 Y2 W2 W1 Y2 Y3 W3

Output: 3

Input:
10
W2 R2 B5 W5 W2 B3 B2 R5 Y5 R2

Output: 5

Input:
5
W3 Y5 W2 G3 Y3

Output: 3

Input:
5
W5 G5 W2 Y5 G2

Output: 3

Input:
5
W5 W3 Y3 Y5 W2

Output: 3

Input:
5
Y5 W3 W2 G5 W3

Output: 3

Input:
5
G5 G3 G5 G5 W2

Output: 2

Input:
5
W2 Y2 G3 G3 G3

Output: 2

Input:
5
G3 Y5 Y2 Y5 W3

Output: 3

Input:
5
W3 W5 Y3 W2 G5

Output: 3

Input:
5
Y3 Y2 Y3 Y5 Y5

Output: 2

Input:
5
W5 Y3 W5 W5 Y5

Output: 2

Input:
5
G3 Y3 G3 Y3 G3

Output: 1

Input:
5
G4 W5 Y4 Y4 R5

Output: 3

Input:
5
G3 R2 R5 B3 W4

Output: 4

Input:
5
W2 G5 W3 R4 R4

Output: 3

Input:
5
Y3 Y3 G3 Y3 W3

Output: 2

Input:
5
W5 W5 W3 Y3 Y5

Output: 2

Input:
35
G5 G5 G3 G2 G3 Y3 W3 Y3 G5 W5 G2 G2 W5 G5 G5 W3 G3 G2 Y3 W5 W3 G5 W5 G2 Y2 Y3 W5 G3 W3 W2 G2 W3 Y2 G3 G3

Output: 4

Input:
35
G3 G2 G5 G2 W2 G3 W2 W5 Y5 G5 W2 W2 W2 G5 Y2 G5 W5 W3 W2 Y2 G5 W5 W3 W5 Y2 Y5 W2 W2 W3 Y3 G2 W3 G5 G3 W2

Output: 4

Input:
35
W2 W3 Y2 G5 G2 W3 G5 Y2 W5 Y5 W3 G2 G3 W5 W2 W3 Y2 Y5 Y2 Y5 Y2 Y2 G2 Y5 W3 Y5 G3 Y2 G3 Y2 Y5 W5 G3 W5 W5

Output: 4

Input:
35
Y2 Y3 Y2 Y3 Y5 Y5 Y3 Y5 Y5 Y2 Y2 Y5 Y2 Y2 Y5 Y3 Y2 Y5 Y5 Y3 Y3 Y2 Y2 Y2 Y3 Y5 Y2 Y5 Y5 Y3 Y5 Y2 Y3 Y3 Y2

Output: 2

Input:
35
Y5 Y5 W5 Y5 W3 Y3 W5 W3 W5 W3 W5 Y5 Y3 W3 W5 W5 W5 W3 Y5 Y3 Y5 W5 W5 Y3 Y5 Y5 Y3 W5 W3 W3 W3 W5 Y5 W3 W5

Output: 2

Input:
35
G3 G3 W3 W3 G3 G3 Y3 G3 Y3 Y3 G3 W3 Y3 G3 W3 Y3 W3 Y3 Y3 Y3 Y3 G3 G3 Y3 Y3 G3 G3 G3 G3 G3 Y3 W3 W3 W3 G3

Output: 2

Input:
35
R2 R2 R2 R2 G3 G2 Y3 G2 R3 W5 G4 Y3 Y3 G2 Y5 W5 G4 G2 W4 Y2 W3 R5 W5 G4 G4 Y2 G2 Y5 G2 Y4 W3 G5 G2 R3 G4

Output: 6

Input:
35
G2 Y1 Y1 R4 G5 B5 R2 G4 G2 G3 W4 W1 B3 W5 R2 Y5 R4 R4 B5 Y2 B4 B1 R3 G4 Y3 G2 R4 G3 B2 G2 R3 B2 R1 W2 B4

Output: 8

Input:
35
W4 Y5 Y3 Y3 R5 W3 R5 W2 R5 Y2 R2 Y2 G2 G3 Y4 Y4 R4 Y3 G2 W2 R2 R3 Y3 W5 W2 G4 R3 R3 W2 W5 Y4 R3 W2 R4 R2

Output: 6

Input:
35
Y3 Y3 Y3 Y3 Y3 Y3 W3 G3 G3 G3 W3 G3 G3 Y3 Y3 W3 G3 G3 Y3 W3 W3 Y3 Y3 G3 W3 W3 G3 Y3 Y3 W3 G3 W3 G3 W3 G3

Output: 2

Input:
35
W3 Y3 W3 W5 Y5 W3 W3 Y5 W3 W3 W3 W5 W3 Y3 Y5 Y3 Y5 Y3 W3 W3 W5 W5 W3 Y5 W3 W3 Y3 W3 W5 W3 Y3 Y3 Y5 Y5 Y3

Output: 2

Input:
25
Y3 R2 R2 Y2 Y5 Y4 B3 B3 Y4 W3 R1 W3 W5 B5 R1 Y4 B4 B5 B3 G3 B1 R2 R4 G5 Y5

Output: 7

Input:
25
W5 R1 Y3 G5 G3 G5 W2 Y1 R3 R4 B3 G5 G2 Y2 W1 G2 Y1 B4 Y2 G3 G3 Y4 W3 W5 Y2

Output: 7

Input:
25
Y1 W2 G3 W1 G1 G3 G4 W1 B2 W3 R4 B1 G2 Y4 G1 R2 R3 Y4 B2 G4 W2 Y2 R2 Y5 R4

Output: 7

Input:
25
B3 Y1 R3 Y3 R5 B4 B3 G1 R1 B4 B5 W3 R4 W1 B3 Y3 B3 Y4 B2 G5 Y1 G5 R4 B5 Y1

Output: 7

Input:
25
G4 R4 Y1 Y4 R3 B5 W2 G4 B5 B2 G1 B4 R4 G2 Y3 Y4 G5 Y3 R1 G2 Y5 G3 Y3 Y4 W3

Output: 8

Input:
25
R1 R3 G1 B5 Y5 W3 R4 R4 R1 G3 R2 W1 B1 G2 W2 G4 R2 W3 B1 W3 B5 Y5 R2 B4 B5

Output: 7

Input:
5
W3 B1 Y1 R3 Y5

Output: 3

Input:
4
R1 R2 G1 Y5

Output: 2

Input:
4
R1 R2 G1 B3

Output: 2

Input:
15
Y3 R4 G1 W1 R3 R2 W4 W1 R5 Y4 G3 R5 Y2 W1 Y1

Output: 6

Input:
4
G5 W5 W4 R3

Output: 2


Artem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move goes like this. Artem chooses some element of the array and removes it. For that, he gets min(a, b) points, where a and b are numbers that were adjacent with the removed number. If the number doesn't have an adjacent number to the left or right, Artem doesn't get any points. After the element is removed, the two parts of the array glue together resulting in the new array that Artem continues playing with. Borya wondered what maximum total number of points Artem can get as he plays this game.

In a single line print a single integer — the maximum number of points Artem can get.

The first line contains a single integer n (1 ≤ n ≤ 5·105) — the number of elements in the array. The next line contains n integers ai (1 ≤ ai ≤ 106) — the values of the array elements.

Input:
5
3 1 5 2 6

Output: 11

Input:
5
1 2 3 4 5

Output: 6

Input:
5
1 100 101 100 1

Output: 102

Input:
10
96 66 8 18 30 48 34 11 37 42

Output: 299

Input:
1
87

Output: 0

Input:
2
93 51

Output: 0

Input:
3
31 19 5

Output: 5

Input:
4
86 21 58 60

Output: 118

Input:
5
21 6 54 69 32

Output: 74

Input:
500000
420656 493141 666713 218520 820461 110241 571052 221576 622547 422070 444000 24019 418357 645255 263883 786440 591985 779139 998849 699918 621698 430994 923570 83634 935074 894461 984992 212896 370138 429677 404026 15213 848103 382539 159706 6993 455627 684167 261848 815538 804077 201076 870537 670363 994669 268113 564376 907979 656969 685475 403646 794602 737125 100285 295201 87959 875706 465762 542151 602140 51614 146049 277621 882179 886827 375902 131432 382594 587151 541266 352879 686993 128432...

Output: 333286228412

Input:
6
46 30 38 9 65 23

Output: 145

Input:
7
82 60 92 4 2 13 15

Output: 129

Input:
8
77 84 26 34 17 56 76 3

Output: 279

Input:
9
72 49 39 50 68 35 75 94 56

Output: 435

Input:
10
4 2 2 4 1 2 2 4 2 1

Output: 21

Input:
1
4

Output: 0

Input:
2
3 1

Output: 0

Input:
3
1 2 1

Output: 1

Input:
4
2 3 1 2

Output: 4

Input:
5
2 6 2 1 2

Output: 6

Input:
6
1 7 3 1 6 2

Output: 12

Input:
7
2 1 2 2 2 2 2

Output: 10

Input:
8
3 4 3 1 1 3 4 1

Output: 15

Input:
9
4 5 2 2 3 1 3 3 5

Output: 23

Input:
10000
4 4 4 3 1 3 3 4 2 4 2 3 4 3 3 3 3 1 1 2 3 4 4 4 1 4 2 4 2 1 1 1 1 4 3 3 4 2 2 2 2 3 4 3 4 4 4 1 2 3 4 3 1 1 3 4 1 4 3 2 4 1 2 4 3 3 4 1 4 1 3 1 4 2 2 4 2 2 3 1 4 4 4 1 2 1 4 4 3 2 3 3 4 4 4 2 3 3 1 3 4 1 4 1 2 4 3 1 2 4 4 4 3 3 2 1 1 1 1 4 1 2 3 3 3 3 1 1 1 3 1 2 4 1 4 2 3 1 4 1 4 3 2 4 2 3 1 1 2 4 2 1 1 2 4 2 1 2 2 4 2 4 1 3 1 3 4 3 4 2 2 1 1 4 3 2 2 1 4 1 4 3 2 3 3 2 1 3 1 3 3 4 1 3 1 2 1 1 2 2 3 1 2 3 2 4 1 2 3 2 2 4 3 4 4 3 3 3 2 2 3 2 2 2 4 1 3 4 3 4 2 1 3 1 2 2 4 2 2 1 2 3 1 4 3 4 4 1 1 1 1 1 ...

Output: 31378

Input:
10000
51 51 65 78 110 6 77 101 73 76 92 60 8 46 74 87 88 121 11 32 3 63 51 27 31 57 53 62 70 19 55 75 22 26 94 72 47 120 49 49 102 95 57 35 3 110 23 15 44 6 90 69 34 112 28 61 45 112 69 54 88 113 54 19 86 70 32 103 1 34 57 56 24 67 122 109 89 6 14 22 100 107 1 86 5 16 110 34 53 103 117 11 17 117 104 96 8 18 89 50 1 62 88 43 96 85 57 108 92 120 102 79 58 5 41 16 55 27 51 70 50 87 104 53 11 32 32 89 54 59 53 44 55 57 86 5 91 14 116 20 108 10 63 40 61 98 16 11 58 82 36 59 118 59 123 123 98 90 58 91 69 118 12...

Output: 821942

Input:
10000
305 2217 4079 1032 5027 4431 3905 1423 5423 5392 1722 1680 1222 3408 3246 1744 313 198 2852 5327 4617 3077 1253 5283 4127 57 2085 4838 1455 3747 3155 653 5543 463 1760 3758 623 487 4815 4685 2438 3820 5468 2579 1979 1354 4215 597 3319 178 1200 4881 3173 2107 1530 1655 1204 1759 5293 4445 4639 1091 345 2857 5238 54 4080 5496 2450 1616 2908 5260 1962 214 5331 4168 4219 2063 4259 5448 3784 1780 5350 5256 3855 1569 1931 3502 2232 1257 4228 4088 4848 2240 3837 3720 1861 1766 5281 4250 2527 667 4055 5472 ...

Output: 37185774

Input:
10000
937269 52328 616518 108211 17319 217729 361901 517567 299812 362331 49608 475088 381160 101157 459745 35742 462673 352769 61032 762616 306099 871281 26520 482300 466697 128157 683319 888115 379270 285379 141948 996358 851593 5371 991562 829025 5230 660134 585115 179107 422785 274611 294904 612799 771725 323149 129188 640754 219219 685413 34649 799777 335062 985559 825834 950158 976275 787003 772423 702710 5262 143627 864927 253387 613960 710956 911648 621065 443981 973723 583194 122871 425769 931957...

Output: 6648774646

Input:
100000
613499 780095 313501 52879 215436 862263 306729 367183 314542 622970 347292 284166 390702 24018 760627 417939 959455 794970 72227 14085 898342 330881 379441 184430 577249 650477 997745 520528 335412 503227 478361 262772 20466 474277 603648 474266 969253 51773 82745 652811 764347 57110 457094 203530 849485 737666 428091 975657 519756 220085 813489 991735 795658 830856 558883 554711 755875 12122 487656 850988 725126 310417 670157 310832 379427 197118 45262 907428 966835 513182 387697 873250 834207 43...

Output: 66739070768

Input:
500000
2 3 3 4 4 3 4 2 1 2 2 2 3 4 1 3 2 2 2 2 2 4 3 2 4 2 1 1 1 1 1 4 3 3 4 1 3 3 3 1 4 2 4 1 3 1 4 1 3 1 3 1 3 2 4 4 4 3 3 1 3 4 1 4 1 1 1 2 2 2 2 2 1 1 4 2 3 1 3 3 1 1 2 4 3 4 3 2 1 4 3 4 2 2 1 2 2 2 1 4 1 2 3 2 1 3 2 4 4 3 1 4 2 4 3 3 3 2 3 2 2 4 1 2 2 3 2 3 4 1 3 4 3 4 4 4 4 4 4 1 2 2 4 1 2 3 4 1 2 4 4 1 2 1 2 3 2 1 3 1 4 4 4 2 2 4 4 2 1 4 3 4 2 4 4 2 1 4 3 3 1 1 1 3 2 2 4 2 1 3 2 2 1 2 3 1 3 3 3 1 4 4 2 3 3 2 2 4 2 4 4 1 3 2 1 4 4 2 3 2 2 2 3 4 2 3 4 3 2 4 4 3 4 3 1 1 1 3 3 1 4 2 3 3 1 4 1 1 3 1 3 2...

Output: 1563483

Input:
500000
44 118 122 87 58 104 114 106 81 111 14 8 49 53 103 5 80 44 109 120 100 106 107 103 26 33 56 9 7 110 105 73 35 4 107 20 83 60 54 52 118 68 105 96 45 12 46 93 11 92 43 51 74 21 121 22 25 33 122 103 82 62 123 44 89 56 51 112 28 107 67 116 10 112 31 65 109 92 73 87 69 117 3 54 12 16 6 102 66 103 16 82 50 104 18 81 6 91 33 49 84 33 18 28 79 1 48 95 111 97 113 59 78 87 37 123 4 74 123 107 75 111 82 41 11 42 62 14 49 49 26 9 61 1 14 81 82 113 80 115 81 1 109 105 34 100 96 6 1 48 33 98 99 38 18 94 3 21 121...

Output: 41304696

Input:
500000
2996 495 5250 3319 834 4335 31 5346 2500 497 2969 5281 4565 148 751 3013 458 4778 89 3078 1778 5024 1260 680 4032 3533 2712 2960 4555 446 3276 4720 3834 780 48 2339 1279 993 4615 3464 4087 5104 5353 4137 693 1529 2840 4239 184 1898 4882 2801 1799 4278 389 3559 1091 2903 863 58 631 4525 2711 1593 2277 3881 5037 2159 833 1331 4007 2752 599 3842 4380 4157 4714 4643 873 4661 972 1993 1444 170 1494 433 2164 4501 836 3073 1392 926 1190 3662 1576 3044 494 1163 2913 4205 2407 2704 1754 813 2371 1461 275 89...

Output: 1852279744

Input:
500000
305368 255895 502210 475877 574974 319198 59454 129258 744627 274911 746538 93295 246339 880196 988079 162872 74868 863817 254869 229545 378612 868571 310138 694129 923809 769115 205295 744739 551541 291521 567023 406565 767565 447582 141629 295361 171092 421882 561881 904537 604432 530779 159902 533815 437577 232679 668923 928707 308433 882401 153548 122957 259701 681103 280788 128202 512446 994748 156569 587356 248100 943961 977757 720330 856976 975743 356724 203343 511564 495952 489991 697230 32...

Output: 333152632699

Input:
500000
54986 980609 331654 936147 176951 525059 592709 211432 591241 565473 737272 587991 893779 272415 574906 55545 666668 818799 640849 742225 477091 121575 887416 813637 948128 913172 227400 429067 232792 142760 966786 81503 789228 123534 798267 454896 383327 937374 189412 819995 681842 687532 650421 701518 573278 262715 825910 932815 863406 298127 998890 568149 779318 472096 670872 580500 89459 637099 612919 718166 865473 785250 421813 52485 372339 475139 116708 380165 923858 202758 358658 638718 3182...

Output: 333666489394

Input:
500000
606433 543120 598155 992348 182763 279356 839193 832513 782824 747497 627843 949366 560065 716458 575943 789004 30045 637256 880029 473537 159456 445146 826313 561257 922709 211453 541393 306170 427238 722609 958857 763700 249096 676240 282570 725035 472883 246636 459841 278771 426255 904515 269923 57318 844203 536993 376958 978388 400294 929875 389675 850952 233392 821443 43552 81651 453227 576821 71970 445240 172395 297821 394391 243091 336604 847130 449529 592167 71107 682387 233575 535714 15657...

Output: 333785777692


Kolya got string s for his birthday, the string consists of small English letters. He immediately added k more characters to the right of the string.Then Borya came and said that the new string contained a tandem repeat of length l as a substring. How large could l be?See notes for definition of a tandem repeat.

Print a single number — the maximum length of the tandem repeat that could have occurred in the new string.

NoteA tandem repeat of length 2n is string s, where for any position i (1 ≤ i ≤ n) the following condition fulfills: si = si + n.In the first sample Kolya could obtain a string aabaab, in the second — aaabbbbbb, in the third — abracadabrabracadabra.

The first line contains s (1 ≤ |s| ≤ 200). This string contains only small English letters. The second line contains number k (1 ≤ k ≤ 200) — the number of the added characters.

Input:
aaba
2

Output: 6

Input:
aaabbbb
2

Output: 6

Input:
abracadabra
10

Output: 20

Input:
zwvrx
3

Output: 6

Input:
ayi
10

Output: 12

Input:
eexlzphiay
1

Output: 2

Input:
zumtumtlitf
2

Output: 6

Input:
xbmrxbmrkzovhb
3

Output: 8

Input:
ijtvifbuajod
5

Output: 10

Output: 400

Input:
kbxuunznjtxutlauuuipifggjjkequbpvbagmxojhgxtakxioxsmrmoatlyzwsygibhafspqnfbycyztxmtpirqcyhalluhhubne
100

Output: 200

Input:
lfydqwrwevvvclkkainwxwvqf
33

Output: 58

Input:
skllmtqzajnzjkuflkazjku
10

Output: 20

Output: 134

Input:
kitxizqtbzwjqldmhwpmznaoddtgqzithwvyeyuixxhlnmksmsysikftzrskbnriebbwzermgcxalwpmznaoddtgqzithwvyeyuixxhlnmksmsy
32

Output: 120

Input:
auxrkguktewrcwwklhmuxkgdialidacmjinwcsrtfrtdsvqsbwuqtsrmsyizsvdkbqwrbuphqqvzktqkskylnnqbezibqnaytuuqddrigdkbqwrbuphqqvzktqkskylnnqbezi
23

Output: 86

Input:
ezlrqvaeekbnkqqjcijtkaoisqpbguqfsqxtzjotdhtrnaoxutybbqzzhrqvaeekbnkqqjcijtkaoisqpbguqfsqxtzjotdhtrnaoxutybbqzzhzoeptxwaunvarfcapxsnamwjyqpxbiegizqotuqen
15

Output: 108

Input:
ngkdgsdxouojadjqzgxewuuyxdlxulgrblxpkyzhgmkeatmhvbdelmxxrqtsarfvotcxfuiqsxbnczbadelhxtlfwrnbisayeveiejvycllhkictyyriqseznziyurlgiejvycllhkictyyriqseznziyurlgwiubyvqfmabhstqalicamyholkqlvtjfhcfbyr
133

Output: 266

Output: 280

Output: 334

Input:
cxpleheyfwu
132

Output: 142

Input:
wccknxhbqzjwaseubvizxuisnzneatgjhaatrfydssgzufyztesrxnjlbhckybqlbncvqgjcoupirpqnnmacejicjzhattqolmclqnotctcsliyvjwutvrtrhichssehtlwbrq
123

Output: 246

Input:
eluswgbaoqmkfymoidkripnpgmbvhydcuupfhecefgosemhverqwzxklzzacdgcrrlzdnocxmzxtiamqpxspfogqhrlsnfzdexamrkowqpqggolnrvxfhenedmfzngnavgnjkzsnkjjjfcgfqjuywmrt
115

Output: 230

Output: 400

Output: 220

Output: 64

Output: 46

Output: 186

Output: 190

Input:
mklxokaoaxzccddmsxzc
41

Output: 60

Input:
pdgrwrozhkrwwgebwvuilwm
32

Output: 54

Input:
uzfvkgoaimitrlfjn
43

Output: 60

Input:
xaxgnvphqavbuxzkcsptsih
150

Output: 172

Input:
fonwebmlwaxthdwche
57

Output: 74


DZY loves Fast Fourier Transformation, and he enjoys using it.Fast Fourier Transformation is an algorithm used to calculate convolution. Specifically, if a, b and c are sequences with length n, which are indexed from 0 to n - 1, andWe can calculate c fast using Fast Fourier Transformation.DZY made a little change on this formula. NowTo make things easier, a is a permutation of integers from 1 to n, and b is a sequence only containing 0 and 1. Given a and b, DZY needs your help to calculate c.Because he is naughty, DZY provides a special way to get a and b. What you need is only three integers n, d, x. After getting them, use the code below to generate a and b.//x is 64-bit variable;function getNextX() {    x = (x * 37 + 10007) % 1000000007;    return x;}function initAB() {    for(i = 0; i < n; i = i + 1){        a[i] = i + 1;    }    for(i = 0; i < n; i = i + 1){        swap(a[i], a[getNextX() % (i + 1)]);    }    for(i = 0; i < n; i = i + 1){        if (i < d)            b[i] = 1;        else            b[i] = 0;    }    for(i = 0; i < n; i = i + 1){        swap(b[i], b[getNextX() % (i + 1)]);    }}Operation x % y denotes remainder after division x by y. Function swap(x, y) swaps two values x and y.

Output n lines, the i-th line should contain an integer ci - 1.

NoteIn the first sample, a is [1 3 2], b is [1 0 0], so c0 = max(1·1) = 1, c1 = max(1·0, 3·1) = 3, c2 = max(1·0, 3·0, 2·1) = 2.In the second sample, a is [2 1 4 5 3], b is [1 1 1 0 1].In the third sample, a is [5 2 1 4 3], b is [1 1 1 1 0].

The only line of input contains three space-separated integers n, d, x (1 ≤ d ≤ n ≤ 100000; 0 ≤ x ≤ 1000000006). Because DZY is naughty, x can't be equal to 27777500.

Input: 3 1 1

Output:
1
3
2

Input: 5 4 2

Output:
2
2
4
5
5

Input: 5 4 3

Output:
5
5
5
5
4

Input: 10 2 4

Output:
0
0
0
4
8
5
2
1
10
8

Input: 10 2 5

Output:
1
9
3
8
7
9
5
8
7
10

Input: 10 1 6

Output:
0
0
0
0
0
0
0
0
0
10

Input: 10 4 7

Output:
6
10
10
6
10
4
9
10
8
9

Input: 1 1 8

Output: 1

Input: 100000 1 9

Output:
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
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
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
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...

Input: 10000 3048 10

Output:
0
8708
8708
8708
6915
6915
6915
6325
8708
8708
5633
6915
8708
6431
8708
6915
6144
7404
7404
8258
8708
8258
7025
7341
8708
7404
8971
8971
8971
8708
8258
7487
8258
9420
9420
9420
7404
8971
8258
8971
9420
9716
9716
9716
9420
8971
9420
9194
9716
9716
8708
9194
9716
9194
9716
8434
9420
9398
9398
9822
9822
9822
9539
9507
9716
9398
9822
9822
9539
9716
9822
9539
9822
9539
8708
9507
9420
9716
9822
9539
9398
9507
9822
9716
9716
9716...

Input: 100000 50000 11

Output:
51159
51159
51159
51159
73309
90577
90577
90577
91727
91727
91727
91727
90577
91727
91495
91727
91727
91727
70467
91495
91727
91495
91495
91727
83716
80406
91495
90577
90577
91495
91727
91727
80406
91727
91727
90577
91727
91495
91727
91495
91495
90862
91727
91727
91727
90862
91727
90577
91495
91495
91727
91727
91495
91727
91727
90577
91495
91727
91727
94489
94489
94489
94489
97916
97916
97916
97916
94489
97916
91727
97916
97916
97916
...

Input: 20000 15167 12

Output:
11292
12904
11292
12904
12904
16180
12904
16180
16180
16180
16180
16180
16180
16180
16180
16180
16180
16180
16180
16180
16180
16180
16987
16677
16987
16987
16987
16987
19793
18074
19793
19793
19793
19793
19793
19793
19793
19793
19793
19793
19793
19793
19793
19793
19793
19793
19793
19599
19793
19793
19793
19793
19793
19599
19793
19793
19793
19793
19718
19718
19718
19793
19718
19793
19793
19793
19793
19793
19793
19793
19753
19753
19793
...

Input: 30000 276 13

Output:
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
1695
24089
23208
13831
14741
6151
9178
13512
13535
22781
18938
28549
1459
3694
6793
9067
19269
14518
5571
13786
24629
6444
10727
11785
11020
28625
9678
29049
12029
15543
14342
27251
22676
21413
23652
29965
16642
8111
264
5503
23226
29482
23208
14978
29905
12480
9178
13512
22143
28516
29429
28549
21790
21910
1145...

Input: 40000 14266 14

Output:
0
0
4012
4012
7668
15847
21513
21513
21513
35220
36714
36714
38905
38905
38905
35220
36714
29441
38905
36714
32403
38905
37550
39053
39053
39053
38905
37550
38905
39053
38905
38905
39053
38905
37550
39053
39053
39053
36714
39053
38905
39053
39053
35220
39053
32861
39053
32861
35220
37550
36714
39053
38905
39053
32422
39053
39246
39246
39246
38905
37550
38905
39246
39053
39053
39246
39053
38905
39246
39246
39246
38796
39246
39053
3924...

Input: 50000 32952 15

Output:
32158
26648
12379
32158
26648
32158
32158
32158
32158
32158
32158
26648
42656
32158
26648
42656
49166
42656
42656
49166
42656
49166
49166
49166
49166
49166
49166
41358
42656
49166
42656
42656
49166
49166
49166
49166
42656
49166
49166
39935
49166
47345
41618
47345
49166
49166
47345
47345
47345
46255
49166
49166
49166
49166
47345
49166
49166
49166
49166
47345
49166
46255
49166
49166
46084
49166
47345
49166
49166
49166
47331
49166
47345
...

Input: 60000 12773 16

Output:
0
0
0
24244
47158
17701
43149
57048
24244
47158
57048
52377
57048
58253
58651
38638
58253
58651
58253
58651
58651
57048
52259
52377
57048
58253
58651
58651
58651
52377
58253
58651
58651
58253
58651
52377
57048
58253
58651
58651
58253
58651
58253
58651
58651
59803
52377
57411
59803
58651
59803
59803
57411
57411
52377
56745
58253
59803
59803
59803
58651
57411
59803
59803
57411
59803
52751
58660
56745
59803
59803
57411
59803
58660
59803...

Input: 70000 39299 17

Output:
0
20851
20851
45387
45387
43543
66023
66023
45387
66023
50931
66023
66023
66023
66023
66023
66023
69886
69886
60320
69886
66023
69886
69886
69886
69886
69886
69886
69886
67683
67683
69886
69886
69886
67683
69886
69886
69886
67683
67683
67683
69886
69886
68008
67683
69886
66232
69886
69886
68008
69886
68008
69886
68008
67683
69886
69886
68008
69886
69037
68201
69886
69886
69886
69037
69886
69037
69886
69037
69886
68201
69886
69886
6988...

Input: 80000 11241 18

Output:
0
0
0
0
0
0
0
56122
73277
44690
2247
3942
51940
37765
63112
50724
57422
39508
19217
73362
45852
31276
6763
79788
29783
53874
35140
25917
72116
77368
53878
56644
20984
66902
42017
63390
78768
60288
46678
16440
66828
56122
73277
70592
28367
70913
66626
37765
63112
50724
57422
77578
73277
73362
45852
45247
56122
79788
63112
65097
57422
64267
76842
77368
53878
57422
73277
79788
73362
63390
78768
60288
79788
77368
73277
56644
61170
733...

Input: 90000 38290 19

Output:
57355
57355
57355
31644
86679
86679
86679
59523
59523
86679
82111
82111
82111
57355
86679
82111
80209
86679
86679
86679
82111
86679
86679
86679
84551
82111
80209
86679
82111
82111
80499
80209
84551
82111
86679
86679
86679
84551
80499
84551
84551
84551
82111
80499
65943
86679
80209
86679
80209
79172
80499
82111
86679
84551
86679
86679
86679
80209
82111
86679
86679
82111
88363
88363
88363
84906
84906
88363
80499
84906
84551
80499
88363
...

Input: 100000 3347 20

Output:
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
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
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
15175
7481
90770
37616
27966
31412
14288
37134
35716
14917
30337
85186
15502
42729
94153
67806
50896
79187
51520...

Input: 100000 10 21

Output:
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
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
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
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...

Input: 100000 2 22

Output:
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
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
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
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...

Input: 100000 8 23

Output:
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
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
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
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...

Input: 100000 9 24

Output:
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
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
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
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...

Input: 100000 10 25

Output:
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
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
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
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...

Input: 100000 71233 26

Output:
0
15801
44549
71608
82361
82361
99290
99290
99290
99290
99290
99209
99290
99290
99290
99290
99290
99290
99290
99290
99209
99290
99290
99372
99372
99372
99372
99372
99290
99823
99823
99823
99823
99823
99372
99823
99823
99823
99823
99823
99823
99823
99823
99372
99823
99823
99823
99823
99372
99823
99823
99823
99823
99823
99823
99823
99823
99823
99372
99823
99823
99823
99823
99823
99823
99372
99324
99372
99823
99823
99324
99823
99372
9982...

Input: 100000 27967 27

Output:
0
3803
72242
59197
84660
61063
57598
9332
72242
59197
84660
72242
59197
84660
61063
84660
75750
60796
71095
89107
72242
84660
85346
91238
84660
93588
69546
75750
89107
91238
89107
93588
91238
95345
93588
71095
93588
89107
71446
95345
91238
91238
95345
93588
95345
93588
84660
77745
77745
84660
95345
95345
84660
99477
95590
91238
89394
93588
75750
99477
95590
91238
99477
95590
99477
95590
92160
93588
91238
92160
99477
99477
97287
99477
...

Input: 100000 52212 28

Output:
0
93755
93755
93755
93755
92371
92371
92371
93755
93755
93755
93755
99751
99751
99751
99751
80948
98744
98744
99751
99751
99751
99751
93755
98744
99751
99801
99801
99801
99801
99751
99751
93943
99801
99801
99801
99801
99751
99751
99801
93755
99751
98744
99751
99801
99801
99751
93943
99801
98744
99801
99801
99801
99801
93943
99801
99751
99801
99801
99751
99801
98744
99801
99751
99801
99801
99801
99801
98744
98744
99801
99801
99751
9980...

Input: 100000 18900 29

Output:
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
68230
10523
68505
21750
73066
10203
54925
18323
88527
16504
74843
79456
68505
21965
92172
68230
54925
89319
88527
73066
74843
79456
68230
88527
92172
74843
79456
93957
62262
92172
88527
73066
89319
92172
60228
88527
92172
99206
79456
89319
99281
92172
93957
91018
89319
92172
93957
99206
91018
93957
99281
92172
99206
68505
94135
99281
99206
98477
93957
...

Input: 100000 83381 30

Output:
6238
81334
81334
81334
81850
81850
85239
85239
85239
81850
85239
85239
87028
87028
87028
85239
87028
87028
87339
87339
87339
87028
87896
87896
87896
87339
87896
87896
87896
87896
87896
87896
87896
87896
87896
87896
87339
87896
87339
87896
87896
87896
87896
95004
95004
95004
87896
95004
95004
95004
95004
95004
95004
95004
98427
98427
98427
96740
98427
98427
98427
98427
98427
98427
98427
98427
98427
98427
96740
98427
95004
98427
98427
9...

Input: 100000 1 31

Output:
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
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
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
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...

Input: 100000 50000 32

Output:
95852
95852
95852
90234
63209
95852
90234
62967
95852
90234
95852
95852
90234
95852
90234
95852
90234
71940
84047
95852
95852
95852
90234
84047
84213
95852
90234
84047
95852
90234
79004
95852
90234
95852
95852
90234
88760
95852
90234
95852
90234
95852
98549
98549
98549
95852
92807
98549
95852
90234
98549
92807
98549
98549
92807
98549
95852
98549
95852
95852
95751
98549
98549
98549
95852
95852
95852
98549
95852
95751
98549
95852
95751
...

Input: 100000 100 33

Output:
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
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
0
0
0
0
0
0
0
0
0
0
0
0
0
46743
96399
80255
29054
91605
66807
11064
16230
45244
47156
40975
83740
70817
95060
20836
13782
72194
84300
54733
59491
98212
93409
48636
49607
67240
96308
86...

Input: 100000 200 34

Output:
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
0
0
0
0
40217
22316
61836
27649
59496
62525
88725
85276
14922
95189
48908
80534
77470
87196
80153
11151
3802
76277
36018
69732
14740
16594
32045
85309
70657
80183
90972
25810
60307
52859
81329
84976
94829
67012
81652
50695
41486
7418
50003
33104
7868
43714
9717
97795
78424
61067
57941
36314
73039
88914
15236
82...

Input: 100000 300 35

Output:
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
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
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
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...

Input: 100000 400 36

Output:
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
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
84143
1470
9677
17233
75834
93792
33470
86462
20536
39091
866
42178
94216
37582
35989
20099
53064
24075
16545
97619
63782
25776
62048
73691
51680
20858
78414
17694
41343
88501
8006
50732
93791
86964
52990
1382
61730
40513
81787
2...

Input: 100000 500 37

Output:
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
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
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
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...

Input: 100000 600 38

Output:
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
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
0
0
0
39353
23989
40660
98167
33094
31658
10831
20461
9422
42085
90232
90615
53800
58452
49463
87399
93063
78281
64266
69306
69224
49610
53666
26395
64846
76657
20609
89825
24589
88367
44610...

Input: 100000 700 39

Output:
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
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
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
62937
77260
27827
60513
78366
76485
53374
75999
74191
66885
17120
87988
11093
23440
14460
27635
50274
81779
56840
...

Input: 100000 800 40

Output:
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
96269
6314
89739
71227
75181
36081
69864
61853
33417
81379
4967
83379
26115
49429
62090
94359
49737
70103
13277
46923
96269
6314
89739
71227
75181
39415
69864
61853
56672
81379
15960
83379
87883
49429
89895
96269
49737
89739
86866
75181
36081
69864
61853
40587
91778
63866
83379
47122
79842
71838
94359
49737
87883
68...

Input: 100000 900 41

Output:
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
92660
98090
5815
66766
42601
21487
45213
28060
80274
11761
68602
76828
94660
55272
50825
6990
15277
37215
33104
60585
44081
39015
86371
91493
14647
67083
89805
1857
98055
75991
23758
45323
70381
84227
60381
55975
85757
58099
72460
56807
27940
37059
90410
18054
31381
54794
53642
12396
20496
42547
26673
84031
63114
87323
31087
44559
78...

Input: 100000 1000 42

Output:
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
27126
91923
90330
42429
31490
19673
95548
17415
49283
36509
16759
12855
3403
14537
27029
95246
13213
86414
94455
19859
82396
80058
74192
82343
62231
1227
29877
46539
126
9103
88750
27583
74924
96252
23404
79830
90763
30368
48448
81627
3081
96892
73659
65669
29707
4898
26271
91754
73968
74994
543
21750
52736
95174
52123
3075
99195
98339
9316
70826
58264
31429
13630
99074
82071
3...

Input: 100000 1100 43

Output:
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
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
66450
89639
9909
59711
41179
24955
48025
35876
19906
14168
26067
85955
99522
92866
26940
57837
77692
83293
15066
22108
92519
58898
90426
1567
21453
8906
53051
76851
85696
90669
44232
69113
10725
42433
51739
68202
76631
10447
37920
8587...

Input: 100000 1200 44

Output:
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
90271
69368
40548
81606
5755
80376
89745
6297
4821
15191
6423
94022
80536
79873
728
91135
78766
28974
5484
24780
91968
94155
15182
1323
93991
83213
77472
18186
26204
33234
59326
77495
85196
11440
75250
50673
61932
73169
32902
1433
76545
95102
3496
11519
85776
61476
14796
66110
3213
22677
68396
48687
11133
81928
16281
28113
59403
75362
43411
36033
977...

Input: 100000 1300 45

Output:
50697
37748
1032
71021
9811
93101
41508
50697
37748
56494
97587
28517
93101
44403
44645
62203
56494
97587
28517
90678
44403
63800
98691
63817
62361
90730
71328
45003
63800
98691
63817
62361
98738
21244
45003
51424
62054
54199
9567
98738
56461
81857
51424
89956
54517
14748
8913
93960
81857
29975
89956
91133
91031
23806
93960
77913
39686
76895
91133
91031
39464
99970
66190
39686
35033
74478
21717
93722
99970
66190
44789
93095
74478
7996...

Input: 100000 1400 46

Output:
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
37102
71508
49614
38321
44978
37102
71508
90665
38321
44978
30490
56868
90665
49105
36113
84850
56868
74421
49105
36113
84850
38970
74183
74259
86401
31158
35773
67337
74259
86401
56198
72694
99251
74416
67257
68215
72694
99251
82197
67257
91500
56186
90289
82197
38666
91500
56186
90289
99182
24495
73734
77152
59793
99182
24495
63811
77152
59793
50428
57183
63811
...

Input: 100000 1500 47

Output:
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
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
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
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...

Input: 100000 1600 48

Output:
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
79758
30908
9925
62330
68310
77179
72588
76595
62938
50474
44556
80664
67330
33930
59335
40778
69407
34475
6809
44565
79758
91335
81310
87322
68310
77179
94398
76595
76595
62938
72246
94337
80664
67330
96300
79211
69407
69407
34475
44565
73583
91335
91335
87322
87322
58718
94398
94398
45851
54732
95927
94337
94337
84101
96300
96300
7...

Input: 100000 1700 49

Output:
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
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
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
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...

Input: 100000 100000 50

Output:
63977
63977
90043
90043
90043
90043
90043
90043
90043
90043
90043
90043
90043
90043
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
94404
...

Input: 100000 99900 51

Output:
70188
70188
70188
91030
91030
91030
91030
91030
93881
93881
93881
93881
96042
96042
96042
96042
96042
96042
96042
96042
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
97895
99358
...

Input: 100000 10000 52

Output:
49261
93534
93534
91599
74864
93534
91599
74864
93534
91599
95607
95607
78261
86546
95607
79972
86163
95607
70113
79972
86546
71136
79972
93534
91599
86079
87066
87066
86079
79403
87066
86163
95607
87066
90008
90008
65705
79972
90008
65705
96828
96828
75237
87090
96828
73865
86079
96828
87066
75237
87090
66653
70847
61502
65705
61142
90008
61502
61142
96798
96798
81537
96828
96798
93534
91599
96798
81537
75804
97227
97227
95607
93786
...

Input: 100000 20000 53

Output:
90446
37657
18478
30875
49095
58681
33333
90446
76674
18478
76103
67884
58681
97622
86169
76674
98606
90446
91342
29098
97622
90446
58681
98606
86169
91342
90446
86169
90485
76674
97622
76103
70491
98606
97622
91342
98606
98606
91342
97622
86169
78435
98606
76103
91342
90485
97622
90446
90485
98606
97622
97622
70491
98606
98606
91342
91342
85071
85192
90446
97622
90485
96221
98606
86341
95123
96835
97622
86341
97622
98606
85192
98606
...

Input: 100000 30000 54

Output:
0
0
0
0
0
0
0
0
0
0
4237
68685
68685
56328
90808
90808
68685
68685
90808
90808
90808
86147
86147
75708
75708
86147
99378
99378
59380
90808
99378
99378
99378
92267
86147
75708
92267
92267
92267
99378
97186
99378
99378
97186
99378
97186
90808
92267
95940
95940
95940
85695
97186
99378
99378
99378
94512
97186
99378
95940
95940
94541
99378
94541
92267
92090
97186
99378
97186
94512
94541
97186
95940
99378
99378
97186
99378
92090
92090
...

Input: 100000 40000 55

Output:
96608
96608
81600
96608
96608
96608
96608
96274
96608
96274
96608
96274
96608
76306
96608
76306
96608
96608
96608
96608
96608
96608
96274
96608
96608
96274
96274
96608
96608
96274
96608
96608
96608
96274
96274
96608
96608
96608
96608
96010
97271
97271
96608
97271
97271
97271
97271
84196
97271
96010
97271
85253
97271
96608
97271
96010
98302
98302
97271
98302
98302
98302
98302
97271
98302
97091
98302
97271
98302
96608
98485
98485
98302
...

Input: 100000 50000 56

Output:
22524
51604
53485
60971
60971
61793
73400
73400
93938
93938
93938
93938
93938
68335
93938
87143
93938
93938
93938
93938
93938
89657
93938
93938
87143
89657
93938
93938
93938
93938
87143
93938
93938
93938
93938
89657
93938
93938
93938
93938
93938
93938
93938
93938
87143
93938
89657
89657
89657
89657
93938
89657
89657
85975
93938
93938
85975
97737
97737
97737
97737
97737
93889
97737
93889
97737
97737
97737
97737
97737
93938
97737
97737
...

Input: 100000 60000 57

Output:
94727
94727
66089
66089
94727
59403
94727
94727
66089
66089
82833
94727
94727
94727
94727
94727
94727
85761
94727
94727
85761
82833
94727
82339
85761
94727
85761
85761
85761
94727
94727
85761
95003
95003
82339
85761
95003
81576
95003
95003
81576
82339
94727
95003
95003
95003
97295
97295
95003
94727
97295
95003
97295
97295
95003
94727
88171
97295
97295
97295
97295
97295
97295
94727
97295
97295
88171
94727
97295
82833
95003
97295
94727
...

Input: 100000 70000 58

Output:
76652
76652
76652
76652
76652
76652
76652
88962
88962
92765
92765
92765
92765
92765
92765
92765
92765
88962
92765
92765
92765
92765
88962
88962
92765
92765
92765
92765
92765
92765
92765
92765
92765
85960
92765
88962
92765
98528
98528
98528
98528
98528
98528
98528
98528
95303
98528
98528
98528
98528
95303
85960
98528
98528
98528
98528
98528
98528
98528
98528
98528
95303
98528
95303
98528
98528
98528
98528
95303
98528
98528
97204
98528
...

Input: 100000 80000 59

Output:
55961
55961
92812
92812
96144
96144
96144
96144
96144
96144
96144
96144
96144
96144
96144
96144
92812
96144
96144
96144
96144
96144
96144
96144
96144
96144
96144
96144
96144
96144
96144
96144
92812
96144
96144
96144
96144
85607
92812
85607
96144
92812
96144
96144
96144
96144
96144
92812
96144
96144
96144
96144
96144
96144
96144
96144
96144
96144
92812
96144
96144
96144
96144
96144
96144
92812
96144
96144
96144
96144
96144
96144
96144
...

Input: 100000 90000 60

Output:
27267
27267
93465
93465
93465
93465
93465
56515
93465
93465
71030
93465
93465
71527
94971
94971
94971
94971
94971
94324
96834
96834
96834
96834
96834
94324
96834
98809
98809
98809
98809
98809
96834
98809
98809
96834
98809
98809
96834
98809
98809
98809
98809
98809
98809
98809
98809
96834
98812
98812
99511
99511
99511
99511
99511
98812
99511
99511
98812
99511
99511
98812
99511
99511
99511
99511
99511
99511
99511
99511
98812
99511
99511
...

Input: 24578 10020 53129589

Output:
0
6088
7309
7309
6535
8746
8746
6322
7309
23293
23293
8746
8746
23293
24194
24194
23293
23293
24194
23645
24194
24194
24194
23645
23293
23645
23645
23645
23293
24194
22309
23293
14366
24194
23645
19657
24194
22309
24194
24194
23293
23645
20841
23645
24194
24194
22309
18632
18146
23645
23645
23293
21766
23293
21079
23293
24194
22309
24194
23293
24194
23645
18632
24194
24194
24194
23293
23293
23645
23645
23645
24194
24194
22309
22202
...

Input: 47979 7412 1000000006

Output:
0
39259
22910
6961
7325
34260
42575
4086
22651
30880
44700
25576
1255
10674
7415
16969
27553
31736
15997
39259
22937
39259
39259
35915
42575
34260
42575
42575
44700
42115
44700
44700
42575
22910
30880
44700
44700
42575
31736
28403
30880
44700
35943
35915
39259
33822
39259
42115
35915
42575
42115
42575
30880
44700
44106
44700
44106
44106
44700
34260
42575
44106
44106
35943
44700
33730
35915
44106
35943
42575
36380
40130
42575
44700
42...

Input: 89958 49591 1000000000

Output:
0
0
0
0
37632
63338
85404
63338
85404
63338
85404
85404
85404
85404
85404
85404
85404
83940
85259
83940
85404
85404
85404
85259
85404
85259
85404
82646
85404
82646
85259
85404
85404
82458
85404
85404
85404
85404
85259
85404
83940
85259
85259
83940
85404
85259
85259
85404
83940
85404
85404
85404
85404
85404
85404
85404
85404
85404
83940
85404
85259
85259
85404
85259
85404
85404
85259
85404
83940
85259
83828
83940
85259
83828
85259
85...

Input: 99997 59991 5959687

Output:
0
73628
73628
73628
73628
96345
99549
99549
99549
99549
99072
96345
99549
99549
99072
96345
99549
99549
99072
99549
99072
99549
99549
99549
99549
99549
99549
99549
99549
99549
99549
99549
99072
99549
99549
99072
99549
99549
99072
99549
99549
99072
99549
99072
94517
93488
96345
99549
99549
99213
99213
99549
99549
99549
99213
99549
99072
99213
99549
99549
99549
99549
99549
99213
99213
99213
99213
99549
99213
99549
99213
99213
99213
9634...

Input: 99999 20001 2959959

Output:
0
65557
41590
84951
65557
84951
84951
91328
84951
91328
91328
84951
91328
74438
84951
91328
74438
84951
91328
80985
82948
91328
82948
82948
80985
98523
97758
98523
98523
97758
98523
97758
84951
98523
97758
77022
98523
97758
73279
98523
97758
74701
84084
82948
84951
84084
85517
74701
98523
98523
97758
87335
87335
84951
98523
97758
65960
91328
84084
84951
87335
91328
84951
91328
84951
84951
98523
97758
91328
91328
85517
83551
98523
9775...

Input: 100000 50000 5646

Output:
0
3593
14642
22204
87085
87085
96068
96068
87085
96068
96068
87085
96068
96068
96068
87085
87085
96068
96068
98945
98945
96068
98945
98945
93471
98945
98945
98945
96068
95820
98945
98945
98945
98945
98945
96068
96068
95820
98945
98945
98945
98945
93471
96068
98945
98945
96068
98945
98945
98945
95820
98945
98945
95820
95820
96068
98945
96068
98945
98945
98945
98945
98945
96068
98945
98945
95820
95861
98945
98945
98945
95861
98945
95861...

Input: 100000 61212 1112333

Output:
0
24619
82275
3763
32183
89938
82275
82275
89938
89938
89938
89938
89938
89938
89938
99489
82275
89938
99489
99489
99489
99489
99489
99489
99489
99489
98576
99489
89411
99489
99489
98576
99489
98576
99489
99489
99489
98482
98576
99489
99489
99489
98482
98576
99489
98576
98576
99489
99489
98482
98576
98576
99489
99489
99489
98576
99489
99489
99489
98576
99489
99489
99489
98576
99489
98576
89411
99489
98576
99489
99489
98576
99489
98576...

Input: 100000 100000 100000000

Output:
28331
93810
93810
93810
93810
93810
97014
97014
97014
97014
97014
97014
98097
98097
98097
98097
98097
98097
98097
98097
98097
98345
98345
98345
98345
98345
98345
98345
98345
98345
98345
98345
98345
98345
98345
98345
98345
98345
98345
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99161
99813
99813
99813
99813
99813
99813
...


Bizon the Champion is called the Champion for a reason. Bizon the Champion has recently got a present — a new glass cupboard with n shelves and he decided to put all his presents there. All the presents can be divided into two types: medals and cups. Bizon the Champion has a1 first prize cups, a2 second prize cups and a3 third prize cups. Besides, he has b1 first prize medals, b2 second prize medals and b3 third prize medals. Naturally, the rewards in the cupboard must look good, that's why Bizon the Champion decided to follow the rules:  any shelf cannot contain both cups and medals at the same time;  no shelf can contain more than five cups;  no shelf can have more than ten medals. Help Bizon the Champion find out if we can put all the rewards so that all the conditions are fulfilled.

Print "YES" (without the quotes) if all the rewards can be put on the shelves in the described manner. Otherwise, print "NO" (without the quotes).

The first line contains integers a1, a2 and a3 (0 ≤ a1, a2, a3 ≤ 100). The second line contains integers b1, b2 and b3 (0 ≤ b1, b2, b3 ≤ 100). The third line contains integer n (1 ≤ n ≤ 100). The numbers in the lines are separated by single spaces.

Input:
1 1 1
1 1 1
4

Output: YES

Input:
1 1 3
2 3 4
2

Output: YES

Input:
1 0 0
1 0 0
1

Output: NO

Input:
0 0 0
0 0 0
1

Output: YES

Input:
100 100 100
100 100 100
100

Output: YES

Input:
100 100 100
100 100 100
1

Output: NO

Input:
1 10 100
100 10 1
20

Output: NO

Input:
1 1 1
0 0 0
1

Output: YES

Input:
0 0 0
1 1 1
1

Output: YES

Input:
5 5 5
0 0 0
2

Output: NO

Input:
0 0 0
10 10 10
2

Output: NO

Input:
21 61 39
63 58 69
44

Output: YES

Input:
18 95 4
7 1 75
46

Output: YES

Input:
64 27 81
72 35 23
48

Output: YES

Input:
6 6 6
11 11 11
7

Output: NO

Input:
1 2 3
2 4 6
3

Output: NO

Input:
1 2 3
2 4 6
4

Output: YES

Input:
99 99 99
99 99 99
89

Output: NO

Input:
5 0 0
15 0 0
2

Output: NO

Input:
10 10 10
0 0 0
1

Output: NO

Input:
1 1 1
1 1 1
15

Output: YES

Input:
2 3 5
2 3 5
2

Output: NO

Input:
2 2 2
3 3 5
3

Output: NO

Input:
1 2 2
2 4 4
1

Output: NO

Input:
1 2 3
1 5 5
2

Output: NO


Bizon the Champion isn't just a bison. He also is a favorite of the "Bizons" team.At a competition the "Bizons" got the following problem: "You are given two distinct words (strings of English letters), s and t. You need to transform word s into word t". The task looked simple to the guys because they know the suffix data structures well. Bizon Senior loves suffix automaton. By applying it once to a string, he can remove from this string any single character. Bizon Middle knows suffix array well. By applying it once to a string, he can swap any two characters of this string. The guys do not know anything about the suffix tree, but it can help them do much more. Bizon the Champion wonders whether the "Bizons" can solve the problem. Perhaps, the solution do not require both data structures. Find out whether the guys can solve the problem and if they can, how do they do it? Can they solve it either only with use of suffix automaton or only with use of suffix array or they need both structures? Note that any structure may be used an unlimited number of times, the structures may be used in any order.

In the single line print the answer to the problem. Print "need tree" (without the quotes) if word s cannot be transformed into word t even with use of both suffix array and suffix automaton. Print "automaton" (without the quotes) if you need only the suffix automaton to solve the problem. Print "array" (without the quotes) if you need only the suffix array to solve the problem. Print "both" (without the quotes), if you need both data structures to solve the problem. It's guaranteed that if you can solve the problem only with use of suffix array, then it is impossible to solve it only with use of suffix automaton. This is also true for suffix automaton.

NoteIn the third sample you can act like that: first transform "both" into "oth" by removing the first character using the suffix automaton and then make two swaps of the string using the suffix array and get "hot".

The first line contains a non-empty word s. The second line contains a non-empty word t. Words s and t are different. Each word consists only of lowercase English letters. Each word contains at most 100 letters.

Input:
automaton
tomat

Output: automaton

Input:
array
arary

Output: array

Input:
both
hot

Output: both

Input:
need
tree

Output: need tree

Input:
abacaba
aaaa

Output: automaton

Input:
z
zz

Output: need tree

Output: need tree

Input:
y
u

Output: need tree

Input:
nbjigpsbammkuuqrxfnmhtimwpflrflehffykbylmnxgadldchdbqklqbremcmzlpxieozgpfgrhegmdcxxfyehzzelcwgkierrj
bjbakuqrnhimwhffykylmngadhbqkqbrcziefredxxezcgkerj

Output: automaton

Input:
gzvvawianfysfuxhruarhverinqsbrfxvkcsermuzowahevgskmpvfdljtcztnbkzftfhvnarvkfkqjgrzbrcfthqmspvpqcva
wnm

Output: automaton

Input:
dvzohfzgzdjavqwhjcrdphpdqjwtqijabbrhformstqaonlhbglmxugkwviigqaohwvqfhdwwcvdkjrcgxblhvtashhcxssbvpo
zgvqhpjhforlugkwfwrchvhp

Output: automaton

Input:
wkfoyetcjivofxaktmauapzeuhcpzjloszzxwydgavebgniiuzrscytsokjkjfkpylvxtlqlquzduywbhqdzmtwprfdohmwgmysy
y

Output: automaton

Output: automaton

Output: array

Output: array

Output: array

Output: array

Output: array

Input:
hxsvvydmzhxrswvhkvrbjrfqkazbkjabnrdghposgyfeslzumaovfkallszzumztftgpcilwfrzpvhhbgdzdvnmseqywlzmhhoxh
dbelhtzgkssyfrqgzuurdjhwvmdbhylhmvphjgxpzhxbb

Output: both

Input:
nppjzscfgcvdcnsjtiaudvutmgswqbewejlzibczzowgkdrjgxrpirfdaekvngcsonroheepdoeoeevaullbfwprcnhlxextbxpd
ifilrvacohnwcgzuleicucebrfxphosrgwnglxxkqrcorsxegjoppbb

Output: both

Input:
ggzmtrhkpdswwqgcbtviahqrgzhyhzddtdekchrpjgngupitzyyuipwstgzewktcqpwezidwvvxgjixnflpjhfznokmpbyzczrzk
gpgwhtzrcytstezmhettkppgmvxlxqnkjzibiqdtceczkbfhdziuajwjqzgwnhnkdzizprgzwud

Output: both

Output: both

Input:
ypyhyabmljukejpltkgunwuanhxblhiouyltdiczttndrhdprqtlpfanmzlyzbqanfwfyurxhepuzspdvehxnblhajczqcxlqebx
lladxuucky

Output: both

Input:
ddmgoarkuhknbtjggnomyxvvavobmylixwuxnnsdrrbibitoteaiydptnvtfblathihflefuggfnyayniragbtkommycpdyhft
tejwybmyrhmalraptqwhghsckvnnaagtmzhnpwbhzzgfgritqwqqamgssllnicjqdkivrwaqyxngsqopwieljfxcdywjaal

Output: need tree

Input:
kipjuscf
kbwfqfwuvkyhmvnaznzsgdgdnpipikbicmlcwehjirmhgwpxwpgfztqjwfqfaapmsgskr

Output: need tree

Input:
kobhhrqgwbgqkzcoacrhpkegyepzfds
hlwcgbvvlegoyrcrjhsjywpdnccxtzgmeujxciuwjlnefllwldidlnjswmetkarxqjigokfvmpxpzfxarhkpdcia

Output: need tree

Input:
lllolloloolllloolollololololollllooololoooloooolololloolloollllolloolloooooooololllolllolllloolllool
lollollololololooooloooooooooolloolllololooollllol

Output: automaton

Input:
lloloooolooollololloooloololooollooloollolllloolllllllloollollllolooloollloololollllooloooololooolol
looooollooolllololloollooooololollollloloollollolo

Output: both

Output: need tree

Input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Output: automaton

Input:
abracadabra
lol

Output: need tree

Input:
abc
aa

Output: need tree

Input:
ba
aa

Output: need tree

Input:
abbb
aaab

Output: need tree

Input:
baaa
bb

Output: need tree

Input:
boosss
osos

Output: both


Jzzhu has a big rectangular chocolate bar that consists of n × m unit squares. He wants to cut this bar exactly k times. Each cut must meet the following requirements:  each cut should be straight (horizontal or vertical);  each cut should go along edges of unit squares (it is prohibited to divide any unit chocolate square with cut);  each cut should go inside the whole chocolate bar, and all cuts must be distinct. The picture below shows a possible way to cut a 5 × 6 chocolate for 5 times.  Imagine Jzzhu have made k cuts and the big chocolate is splitted into several pieces. Consider the smallest (by area) piece of the chocolate, Jzzhu wants this piece to be as large as possible. What is the maximum possible area of smallest piece he can get with exactly k cuts? The area of a chocolate piece is the number of unit squares in it.

Output a single integer representing the answer. If it is impossible to cut the big chocolate k times, print -1.

NoteIn the first sample, Jzzhu can cut the chocolate following the picture below:  In the second sample the optimal division looks like this:  In the third sample, it's impossible to cut a 2 × 3 chocolate 4 times.

A single line contains three integers n, m, k (1 ≤ n, m ≤ 109; 1 ≤ k ≤ 2·109).

Input: 3 4 1

Output: 6

Input: 6 4 2

Output: 8

Input: 2 3 4

Output: -1

Input: 10 10 2

Output: 30

Input: 1000000000 1000000000 2000000000

Output: -1

Input: 1000000000 1000000000 999999999

Output: 1000000000

Input: 1000000000 1000000000 1

Output: 500000000000000000

Input: 98283 999283848 23

Output: 4092192268041

Input: 6 4 5

Output: 4

Input: 6 4 6

Output: 2

Input: 482738478 493948384 502919283

Output: 53

Input: 1 1 1

Output: -1

Input: 1 1 2

Output: -1

Input: 1 1 1000000000

Output: -1

Input: 1000000000 1000000000 123456

Output: 8099000000000

Input: 192837483 829387483 828374

Output: 193030320483

Input: 987283748 999283748 589766888

Output: 999283748

Input: 999999123 999999789 123456789

Output: 7999998312

Input: 999999789 999999123 52452444

Output: 18999995991

Input: 789789789 777888999 999999999

Output: 3

Input: 789529529 444524524 888524444

Output: 4

Input: 983748524 23 2

Output: 7542072002

Input: 999999999 1000000000 1

Output: 499999999500000000

Input: 1000000000 999999999 3

Output: 249999999750000000

Input: 12345 123456789 123456789

Output: 6172

Input: 98283 999283848 23

Output: 4092192268041

Input: 98723848 8238748 82838

Output: 9812348868

Input: 444444444 524444444 524

Output: 443973777333804

Input: 298238388 998888999 1000000000

Output: 268

Input: 599399444 599999994 897254524

Output: 2

Input: 999882937 982983748 999999888

Output: 8404

Input: 979882937 982983748 988254444

Output: 185

Input: 999872837 979283748 987837524

Output: 979283748

Input: 979283524 999872524 987524524

Output: 979283524

Input: 989872444 999283444 977999524

Output: 999283444

Input: 999872524 989283524 977999444

Output: 999872524

Input: 999524524 888524524 6

Output: 126871721067257708

Input: 888999999 999999444 7

Output: 111124937645000070

Input: 999888524 999995249 52424

Output: 19071909388928

Input: 999995244 999852424 52999

Output: 18864910278060

Input: 628145517 207579013 1361956

Output: 95693924993

Input: 186969586 883515281 376140463

Output: 373939172

Input: 98152103 326402540 762888636

Output: -1

Input: 127860890 61402893 158176573

Output: 2

Input: 646139320 570870045 9580639

Output: 38248293015

Input: 61263305 484027667 178509023

Output: 122526610

Input: 940563716 558212775 841082556

Output: 558212775

Input: 496148000 579113529 26389630

Output: 10424043522

Input: 70301174 837151741 925801173

Output: -1

Input: 902071051 285845006 656585276

Output: 285845006

Input: 9467291 727123763 403573724

Output: 9467291

Input: 899374334 631265401 296231663

Output: 1893796203

Input: 491747710 798571511 520690250

Output: 491747710

Input: 789204467 643215696 799313373

Output: 63

Input: 456517317 162733265 614608449

Output: 1

Input: 181457955 806956092 555253432

Output: 181457955

Input: 158398860 751354014 528156707

Output: 158398860

Input: 458000643 743974603 152040411

Output: 2231923809

Input: 882264705 164556874 37883251

Output: 3784808102

Input: 167035009 877444310 205461190

Output: 668140036

Input: 732553408 300206285 785986539

Output: 5

Input: 896205951 132099861 775142615

Output: 132099861

Input: 19344368 457641319 555144413

Output: -1

Input: 909420688 506507264 590064714

Output: 506507264

Input: 793692317 55434271 489726670

Output: 55434271

Input: 537850353 901329639 210461043

Output: 2151401412

Input: 570497240 614794872 29523792

Output: 11681102568

Input: 904237002 706091348 905203770

Output: 730

Input: 307178253 337246325 118054687

Output: 674492650

Input: 644505509 896162464 150625750

Output: 3584649856

Input: 500000002 500000002 1000000000

Output: 1

Input: 6 6 9

Output: 1

Input: 6 7 2

Output: 14

Input: 1000000000 1000000000 1999999998

Output: 1

Input: 100 100 150

Output: 1

Input: 2 2 2

Output: 1

Input: 5 5 5

Output: 2

Input: 4 6 4

Output: 4

Input: 1000 1000 1000

Output: 500

Input: 5 4 3

Output: 5

Input: 6 7 1

Output: 21

Input: 6 7 5

Output: 7

Input: 6874 8974 3245

Output: 17948

Input: 1000000000 1000000000 220000000

Output: 4000000000

Input: 100 100 100

Output: 50

Input: 1000000000 10000000 10000000

Output: 990000000

Input: 7 8 9

Output: 2

Input: 4 5 6

Output: 1

Input: 4 6 3

Output: 6

Input: 10 10 11

Output: 3

Input: 1000000000 1000000000 999000111

Output: 1000000000

Input: 2 1 1

Output: 1


Bizon the Champion isn't just charming, he also is very smart.While some of us were learning the multiplication table, Bizon the Champion had fun in his own manner. Bizon the Champion painted an n × m multiplication table, where the element on the intersection of the i-th row and j-th column equals i·j (the rows and columns of the table are numbered starting from 1). Then he was asked: what number in the table is the k-th largest number? Bizon the Champion always answered correctly and immediately. Can you repeat his success?Consider the given multiplication table. If you write out all n·m numbers from the table in the non-decreasing order, then the k-th number you write out is called the k-th largest number.

Print the k-th largest number in a n × m multiplication table.

NoteA 2 × 3 multiplication table looks like this:1 2 32 4 6

The single line contains integers n, m and k (1 ≤ n, m ≤ 5·105; 1 ≤ k ≤ n·m).

Input: 2 2 2

Output: 2

Input: 2 3 4

Output: 3

Input: 1 10 5

Output: 5

Input: 1 1 1

Output: 1

Input: 10 1 7

Output: 7

Input: 10 10 33

Output: 14

Input: 500000 500000 1

Output: 1

Input: 500000 500000 250000000000

Output: 250000000000

Input: 3 3 1

Output: 1

Input: 3 3 2

Output: 2

Input: 3 3 3

Output: 2

Input: 3 3 5

Output: 3

Input: 3 3 8

Output: 6

Input: 3 3 9

Output: 9

Input: 1 500000 74747

Output: 74747

Input: 500000 1 47474

Output: 47474

Input: 499975 499981 12345

Output: 1634

Input: 499997 499989 248758432143

Output: 225563648440

Input: 5 1 2

Output: 2

Input: 2 2 4

Output: 4

Input: 1 2 1

Output: 1

Input: 2 44 36

Output: 24

Input: 2 28 49

Output: 42

Input: 3 48 30

Output: 17

Input: 5 385 1296

Output: 711

Input: 1 454 340

Output: 340

Input: 1 450 399

Output: 399

Input: 1 3304 218

Output: 218

Input: 3 4175 661

Output: 361

Input: 4 1796 2564

Output: 1232

Input: 2 33975 17369

Output: 11580

Input: 4 25555 45556

Output: 21868

Input: 5 17136 9220

Output: 4039

Input: 3 355632 94220

Output: 51393

Input: 5 353491 107977

Output: 47290

Input: 4 194790 114613

Output: 55015

Input: 47 5 157

Output: 87

Input: 26 5 79

Output: 42

Input: 40 2 3

Output: 2

Input: 12 28 127

Output: 49

Input: 32 12 132

Output: 50

Input: 48 40 937

Output: 364

Input: 45 317 6079

Output: 2160

Input: 18 459 7733

Output: 5684

Input: 38 127 1330

Output: 404

Input: 25 1155 9981

Output: 3318

Input: 41 4600 39636

Output: 10865

Input: 20 2222 11312

Output: 3502

Input: 32 11568 36460

Output: 8988

Input: 48 33111 5809

Output: 1308

Input: 27 24692 71714

Output: 18432

Input: 46 356143 2399416

Output: 598032

Input: 25 127045 1458997

Output: 548779

Input: 41 246624 2596292

Output: 751716

Input: 264 3 775

Output: 741

Input: 495 3 17

Output: 10

Input: 252 5 672

Output: 328

Input: 314 32 3903

Output: 1345

Input: 472 15 932

Output: 283

Input: 302 39 4623

Output: 1589

Input: 318 440 57023

Output: 19203

Input: 403 363 932

Output: 175

Input: 306 433 25754

Output: 6500

Input: 143 1735 246128

Output: 218316

Input: 447 4446 802918

Output: 268036

Input: 132 3890 439379

Output: 265096

Input: 366 45769 5885721

Output: 1841004

Input: 123 37349 4224986

Output: 2895390

Input: 427 46704 7152399

Output: 2256408

Input: 357 184324 28748161

Output: 9992350

Input: 187 425625 25103321

Output: 7534560

Input: 345 423483 40390152

Output: 11441760

Input: 4775 3 7798

Output: 4254

Input: 1035 2 2055

Output: 2040

Input: 3119 3 7305

Output: 5024

Input: 1140 18 11371

Output: 4830

Input: 4313 40 86640

Output: 33496

Input: 2396 24 55229

Output: 43102

Input: 2115 384 385536

Output: 140250

Input: 2376 308 665957

Output: 445248

Input: 4460 377 1197310

Output: 581462

Input: 2315 1673 225263

Output: 40950

Input: 1487 3295 736705

Output: 169290

Input: 3571 3828 7070865

Output: 2696688

Input: 3082 23173 68350097

Output: 51543000

Input: 1165 34678 7211566

Output: 1745254

Input: 1426 26259 37212278

Output: 33359110

Input: 2930 491026 923941798

Output: 409544625

Input: 3191 454046 718852491

Output: 267275676

Input: 1274 295345 301511265

Output: 165699050

Input: 10657 3 9816

Output: 5355

Input: 38939 3 6757

Output: 3686

Input: 37107 4 28350

Output: 13608

Input: 19618 16 313726

Output: 311296

Input: 27824 40 906786

Output: 518185

Input: 46068 31 424079

Output: 131352

Input: 40716 482 14569037

Output: 7363656

Input: 48922 150 653002

Output: 135716

Input: 37203 219 2355222

Output: 681502

Input: 23808 3322 48603931

Output: 20824476

Input: 12090 2766 12261436

Output: 3894264

Input: 20296 4388 29300901

Output: 8862304

Input: 29699 38801 37684232

Output: 6032628

Input: 17980 28231 221639883

Output: 76707084

Input: 16148 39736 239320912

Output: 76569666

Input: 35531 340928 9207622511

Output: 4761654318

Input: 43737 111829 865416726

Output: 208223208

Input: 21980 353130 2233068545

Output: 638445948

Input: 339697 4 1259155

Output: 993876

Input: 404625 2 132619

Output: 88413

Input: 226111 2 359116

Output: 266010

Input: 318377 38 7214261

Output: 3108710

Input: 139863 21 1834174

Output: 833220

Input: 204791 41 8382971

Output: 8020256

Input: 149281 382 51428462

Output: 33762615

Input: 370768 123 15161219

Output: 4677246

Input: 313975 448 85041752

Output: 36070940

Input: 136614 3211 364472869

Output: 209750632

Input: 201542 4833 512478332

Output: 197440230

Input: 423029 1365 126620483

Output: 32780826

Input: 110941 47433 2098952903

Output: 693548595

Input: 175869 39014 3201917805

Output: 1148848775

Input: 397356 10518 874806404

Output: 222468766

Input: 118728 168631 16269281609

Output: 9092195490

Input: 183656 409931 42943608085

Output: 17438143800

Input: 283422 407789 73398688052

Output: 32237937640

Input: 500000 500000 888888

Output: 77856


There are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to n. The i-th child wants to get at least ai candies.Jzzhu asks children to line up. Initially, the i-th child stands at the i-th place of the line. Then Jzzhu start distribution of the candies. He follows the algorithm:  Give m candies to the first child of the line.  If this child still haven't got enough candies, then the child goes to the end of the line, else the child go home.  Repeat the first two steps while the line is not empty. Consider all the children in the order they go home. Jzzhu wants to know, which child will be the last in this order?

Output a single integer, representing the number of the last child.

NoteLet's consider the first sample. Firstly child 1 gets 2 candies and go home. Then child 2 gets 2 candies and go to the end of the line. Currently the line looks like [3, 4, 5, 2] (indices of the children in order of the line). Then child 3 gets 2 candies and go home, and then child 4 gets 2 candies and goes to the end of the line. Currently the line looks like [5, 2, 4]. Then child 5 gets 2 candies and goes home. Then child 2 gets two candies and goes home, and finally child 4 gets 2 candies and goes home.Child 4 is the last one who goes home.

The first line contains two integers n, m (1 ≤ n ≤ 100; 1 ≤ m ≤ 100). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100).

Input:
5 2
1 3 1 4 2

Output: 4

Input:
6 4
1 1 2 2 3 3

Output: 6

Input:
7 3
6 1 5 4 2 3 1

Output: 4

Input:
10 5
2 7 3 6 2 5 1 3 4 5

Output: 4

Input:
100 1
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

Output: 100

Input:
9 3
9 5 2 3 7 1 8 4 6

Output: 7

Input:
20 10
58 4 32 10 73 7 30 39 47 6 59 21 24 66 79 79 46 13 29 58

Output: 16

Input:
50 5
89 56 3 2 40 37 56 52 83 59 43 83 43 59 29 74 22 58 53 41 53 67 78 30 57 32 58 29 95 46 45 85 60 49 41 82 8 71 52 40 45 26 6 71 84 91 4 93 40 54

Output: 48

Input:
50 1
4 3 9 7 6 8 3 7 10 9 8 8 10 2 9 3 2 4 4 10 4 6 8 10 9 9 4 2 8 9 4 4 9 5 1 5 2 4 4 9 10 2 5 10 7 2 8 6 8 1

Output: 44

Input:
50 5
3 9 10 8 3 3 4 6 8 2 9 9 3 1 2 10 6 8 7 2 7 4 2 7 5 10 2 2 2 5 10 5 6 6 8 7 10 4 3 2 10 8 6 6 8 6 4 4 1 3

Output: 46

Input:
50 2
56 69 72 15 95 92 51 1 74 87 100 29 46 54 18 81 84 72 84 83 20 63 71 27 45 74 50 89 48 8 21 15 47 3 39 73 80 84 6 99 17 25 56 3 74 64 71 39 89 78

Output: 40

Input:
50 3
31 39 64 16 86 3 1 9 25 54 98 42 20 3 49 41 73 37 55 62 33 77 64 22 33 82 26 13 10 13 7 40 48 18 46 79 94 72 19 12 11 61 16 37 10 49 14 94 48 69

Output: 11

Input:
50 100
67 67 61 68 42 29 70 77 12 61 71 27 4 73 87 52 59 38 93 90 31 27 87 47 26 57 76 6 28 72 81 68 50 84 69 79 39 93 52 6 88 12 46 13 90 68 71 38 90 95

Output: 50

Input:
100 3
4 14 20 11 19 11 14 20 5 7 6 12 11 17 5 11 7 6 2 10 13 5 12 8 5 17 20 18 7 19 11 7 7 20 20 8 10 17 17 19 20 5 15 16 19 7 11 16 4 17 2 10 1 20 20 16 19 9 9 11 5 7 12 9 9 6 20 18 13 19 8 4 8 1 2 4 10 11 15 14 1 7 17 12 13 19 12 2 3 14 15 15 5 17 14 12 17 14 16 9

Output: 86

Input:
100 5
16 8 14 16 12 11 17 19 19 2 8 9 5 6 19 9 11 18 6 9 14 16 14 18 17 17 17 5 15 20 19 7 7 10 10 5 14 20 5 19 11 16 16 19 17 9 7 12 14 10 2 11 14 5 20 8 10 11 19 2 14 14 19 17 5 10 8 8 4 2 1 10 20 12 14 11 7 6 6 15 1 5 9 15 3 17 16 17 5 14 11 9 16 15 1 11 10 6 15 7

Output: 93

Input:
100 1
58 94 18 50 17 14 96 62 83 80 75 5 9 22 25 41 3 96 74 45 66 37 2 37 13 85 68 54 77 11 85 19 25 21 52 59 90 61 72 89 82 22 10 16 3 68 61 29 55 76 28 85 65 76 27 3 14 10 56 37 86 18 35 38 56 68 23 88 33 38 52 87 55 83 94 34 100 41 83 56 91 77 32 74 97 13 67 31 57 81 53 39 5 88 46 1 79 4 49 42

Output: 77

Input:
100 2
1 51 76 62 34 93 90 43 57 59 52 78 3 48 11 60 57 48 5 54 28 81 87 23 44 77 67 61 14 73 29 53 21 89 67 41 47 9 63 37 1 71 40 85 4 14 77 40 78 75 89 74 4 70 32 65 81 95 49 90 72 41 76 55 69 83 73 84 85 93 46 6 74 90 62 37 97 7 7 37 83 30 37 88 34 16 11 59 85 19 57 63 85 20 63 97 97 65 61 48

Output: 97

Input:
100 3
30 83 14 55 61 66 34 98 90 62 89 74 45 93 33 31 75 35 82 100 63 69 48 18 99 2 36 71 14 30 70 76 96 85 97 90 49 36 6 76 37 94 70 3 63 73 75 48 39 29 13 2 46 26 9 56 1 18 54 53 85 34 2 12 1 93 75 67 77 77 14 26 33 25 55 9 57 70 75 6 87 66 18 3 41 69 73 24 49 2 20 72 39 58 91 54 74 56 66 78

Output: 20

Input:
100 4
69 92 76 3 32 50 15 38 21 22 14 3 67 41 95 12 10 62 83 52 78 1 18 58 94 35 62 71 58 75 13 73 60 34 50 97 50 70 19 96 53 10 100 26 20 39 62 59 88 26 24 83 70 68 66 8 6 38 16 93 2 91 81 89 78 74 21 8 31 56 28 53 77 5 81 5 94 42 77 75 92 15 59 36 61 18 55 45 69 68 81 51 12 42 85 74 98 31 17 41

Output: 97

Input:
100 5
2 72 10 60 6 50 72 34 97 77 35 43 80 64 40 53 46 6 90 22 29 70 26 68 52 19 72 88 83 18 55 32 99 81 11 21 39 42 41 63 60 97 30 23 55 78 89 35 24 50 99 52 27 76 24 8 20 27 51 37 17 82 69 18 46 19 26 77 52 83 76 65 43 66 84 84 13 30 66 88 84 23 37 1 17 26 11 50 73 56 54 37 40 29 35 8 1 39 50 82

Output: 51

Input:
100 7
6 73 7 54 92 33 66 65 80 47 2 53 28 59 61 16 54 89 37 48 77 40 49 59 27 52 17 22 78 80 81 80 8 93 50 7 87 57 29 16 89 55 20 7 51 54 30 98 44 96 27 70 1 1 32 61 22 92 84 98 31 89 91 90 28 56 49 25 86 49 55 16 19 1 18 8 88 47 16 18 73 86 2 96 16 91 74 49 38 98 94 25 34 85 29 27 99 31 31 58

Output: 97

Input:
100 9
36 4 45 16 19 6 10 87 44 82 71 49 70 35 83 19 40 76 45 94 44 96 10 54 82 77 86 63 11 37 21 3 15 89 80 88 89 16 72 23 25 9 51 25 10 45 96 5 6 18 51 31 42 57 41 51 42 15 89 61 45 82 16 48 61 67 19 40 9 33 90 36 78 36 79 79 16 10 83 87 9 22 84 12 23 76 36 14 2 81 56 33 56 23 57 84 76 55 35 88

Output: 47

Input:
100 10
75 81 39 64 90 58 92 28 75 9 96 78 92 83 77 68 76 71 14 46 58 60 80 25 78 11 13 63 22 82 65 68 47 6 33 63 90 50 85 43 73 94 80 48 67 11 83 17 22 15 94 80 66 99 66 4 46 35 52 1 62 39 96 57 37 47 97 49 64 12 36 63 90 16 4 75 85 82 85 56 13 4 92 45 44 93 17 35 22 46 18 44 29 7 52 4 100 98 87 51

Output: 98

Input:
100 20
21 19 61 70 54 97 98 14 61 72 25 94 24 56 55 25 12 80 76 11 35 17 80 26 11 94 52 47 84 61 10 2 74 25 10 21 2 79 55 50 30 75 10 64 44 5 60 96 52 16 74 41 20 77 20 44 8 86 74 36 49 61 99 13 54 64 19 99 50 43 12 73 48 48 83 55 72 73 63 81 30 27 95 9 97 82 24 3 89 90 33 14 47 88 22 78 12 75 58 67

Output: 94

Input:
100 30
56 79 59 23 11 23 67 82 81 80 99 79 8 58 93 36 98 81 46 39 34 67 3 50 4 68 70 71 2 21 52 30 75 23 33 21 16 100 56 43 8 27 40 8 56 24 17 40 94 10 67 49 61 36 95 87 17 41 7 94 33 19 17 50 26 11 94 54 38 46 77 9 53 35 98 42 50 20 43 6 78 6 38 24 100 45 43 16 1 50 16 46 14 91 95 88 10 1 50 19

Output: 95

Input:
100 40
86 11 97 17 38 95 11 5 13 83 67 75 50 2 46 39 84 68 22 85 70 23 64 46 59 93 39 80 35 78 93 21 83 19 64 1 49 59 99 83 44 81 70 58 15 82 83 47 55 65 91 10 2 92 4 77 37 32 12 57 78 11 42 8 59 21 96 69 61 30 44 29 12 70 91 14 10 83 11 75 14 10 19 39 8 98 5 81 66 66 79 55 36 29 22 45 19 24 55 49

Output: 88

Input:
100 50
22 39 95 69 94 53 80 73 33 90 40 60 2 4 84 50 70 38 92 12 36 74 87 70 51 36 57 5 54 6 35 81 52 17 55 100 95 81 32 76 21 1 100 1 95 1 40 91 98 59 84 19 11 51 79 19 47 86 45 15 62 2 59 77 31 68 71 92 17 33 10 33 85 57 5 2 88 97 91 99 63 20 63 54 79 93 24 62 46 27 30 87 3 64 95 88 16 50 79 1

Output: 99

Input:
100 70
61 48 89 17 97 6 93 13 64 50 66 88 24 52 46 99 6 65 93 64 82 37 57 41 47 1 84 5 97 83 79 46 16 35 40 7 64 15 44 96 37 17 30 92 51 67 26 3 14 56 27 68 66 93 36 39 51 6 40 55 79 26 71 54 8 48 18 2 71 12 55 60 29 37 31 97 26 37 25 68 67 70 3 87 100 41 5 82 65 92 24 66 76 48 89 8 40 93 31 95

Output: 100

Input:
100 90
87 32 30 15 10 52 93 63 84 1 82 41 27 51 75 32 42 94 39 53 70 13 4 22 99 35 44 38 5 23 18 100 61 80 9 12 42 93 9 77 3 7 60 95 66 78 95 42 69 8 1 88 93 66 96 20 76 63 15 36 92 52 2 72 36 57 48 63 29 20 74 88 49 47 81 61 94 74 70 93 47 3 19 52 59 41 5 40 22 3 76 97 91 37 95 88 91 99 76 15

Output: 98

Input:
100 100
79 75 7 28 6 96 38 35 57 95 41 74 24 96 32 78 81 13 63 84 24 95 3 23 66 1 60 6 96 49 41 5 14 18 31 97 66 19 49 89 49 70 51 28 20 99 18 1 28 77 24 46 69 21 40 32 31 66 28 6 66 97 9 16 70 90 91 30 34 82 93 41 65 11 39 52 1 88 63 43 80 50 60 49 28 56 18 76 24 57 74 1 28 99 36 35 79 54 18 16

Output: 100

Input:
1 3
5

Output: 1

Input:
1 1
100

Output: 1

Input:
2 3
4 2

Output: 1

Input:
2 5
99 97

Output: 2

Input:
3 4
7 5 2

Output: 2

Input:
3 50
47 86 51

Output: 3

Input:
5 100
82 100 85 1 37

Output: 5

Input:
5 20
40 39 21 5 20

Output: 3

Input:
1 27
81

Output: 1

Input:
20 13
7 8 29 83 74 28 93 85 7 8 3 9 8 70 49 50 39 41 57 1

Output: 7

Input:
2 1
100 2

Output: 1

Input:
2 2
6 4

Output: 1

Input:
5 2
6 4 4 1 1

Output: 1

Input:
1 4
3

Output: 1

Input:
3 2
1 5 3

Output: 2

Input:
3 1
3 2 2

Output: 1

Input:
3 1
2 3 2

Output: 2

Input:
5 1
5 1 1 1 1

Output: 1

Input:
2 3
7 4

Output: 1


Jzzhu has invented a kind of sequences, they meet the following property:You are given x and y, please calculate fn modulo 1000000007 (109 + 7).

Output a single integer representing fn modulo 1000000007 (109 + 7).

NoteIn the first sample, f2 = f1 + f3, 3 = 2 + f3, f3 = 1.In the second sample, f2 =  - 1;  - 1 modulo (109 + 7) equals (109 + 6).

The first line contains two integers x and y (|x|, |y| ≤ 109). The second line contains a single integer n (1 ≤ n ≤ 2·109).

Input:
2 3
3

Output: 1

Input:
0 -1
2

Output: 1000000006

Input:
-9 -11
12345

Output: 1000000005

Input:
0 0
1000000000

Output: 0

Input:
-1000000000 1000000000
2000000000

Output: 1000000000

Input:
-12345678 12345678
1912345678

Output: 12345678

Input:
728374857 678374857
1928374839

Output: 950000007

Input:
278374837 992837483
1000000000

Output: 721625170

Input:
-693849384 502938493
982838498

Output: 502938493

Input:
-783928374 983738273
992837483

Output: 16261734

Input:
-872837483 -682738473
999999999

Output: 190099010

Input:
-892837483 -998273847
999283948

Output: 892837483

Input:
-283938494 738473848
1999999999

Output: 716061513

Input:
-278374857 819283838
1

Output: 721625150

Input:
-1000000000 123456789
1

Output: 7

Input:
-529529529 -524524524
2

Output: 475475483

Input:
1 2
2000000000

Output: 2

Input:
-1 -2
2000000000

Output: 1000000005

Input:
1 2
1999999999

Output: 1

Input:
1 2
1999999998

Output: 1000000006

Input:
1 2
1999999997

Output: 1000000005

Input:
1 2
1999999996

Output: 1000000006

Input:
69975122 366233206
1189460676

Output: 703741923

Input:
812229413 904420051
806905621

Output: 812229413

Input:
872099024 962697902
1505821695

Output: 90598878

Input:
887387283 909670917
754835014

Output: 112612724

Input:
37759824 131342932
854621399

Output: 868657075

Input:
-246822123 800496170
626323615

Output: 753177884

Input:
-861439463 974126967
349411083

Output: 835566423

Input:
-69811049 258093841
1412447

Output: 741906166

Input:
844509330 -887335829
123329059

Output: 844509330

Input:
83712471 -876177148
1213284777

Output: 40110388

Input:
598730524 -718984219
1282749880

Output: 401269483

Input:
-474244697 -745885656
1517883612

Output: 271640959

Input:
-502583588 -894906953
1154189557

Output: 497416419

Input:
-636523651 -873305815
154879215

Output: 763217843

Input:
721765550 594845720
78862386

Output: 126919830

Input:
364141461 158854993
1337196589

Output: 364141461

Input:
878985260 677031952
394707801

Output: 798046699

Input:
439527072 -24854079
1129147002

Output: 464381151

Input:
840435009 -612103127
565968986

Output: 387896880

Input:
875035447 -826471373
561914518

Output: 124964560

Input:
-342526698 305357084
70776744

Output: 352116225

Input:
-903244186 899202229
1527859274

Output: 899202229

Input:
-839482546 815166320
1127472130

Output: 839482546

Input:
-976992569 -958313041
1686580818

Output: 981320479

Input:
-497338894 -51069176
737081851

Output: 502661113

Input:
-697962643 -143148799
1287886520

Output: 856851208

Input:
-982572938 -482658433
1259858332

Output: 982572938

Input:
123123 78817
2000000000

Output: 78817

Input:
1000000000 -1000000000
3

Output: 14

Input:
-1000000000 1000000000
6

Output: 14

Input:
2 3
6

Output: 1000000006

Input:
0 -1
6

Output: 1

Input:
500000000 -1000000000
600000003

Output: 500000014

Input:
-1000000000 1000000000
3

Output: 999999993

Input:
1 3
6

Output: 1000000005

Input:
1 2
12

Output: 1000000006

Input:
7 -1000000000
3

Output: 0

Input:
-999999997 999999997
6

Output: 20

Input:
3 4
6

Output: 1000000006

Input:
-1 2
6

Output: 1000000004

Input:
2 3
12

Output: 1000000006

Input:
4 18
6

Output: 999999993

Input:
1 2
6

Output: 1000000006

Input:
1000000000 -1000000000
6

Output: 999999993

Input:
999999999 -999999999
3

Output: 16

Input:
-1 0
1

Output: 1000000006

Input:
1000000000 -1000000000
9

Output: 14

Input:
999999999 -1000000000
12

Output: 999999992

Input:
1000000000 -7
3

Output: 0

Input:
-5 5
6

Output: 999999997

Input:
5 9
6

Output: 1000000003

Input:
-15 -10
1

Output: 999999992


After winning gold and silver in IOI 2014, Akshat and Malvika want to have some fun. Now they are playing a game on a grid made of n horizontal and m vertical sticks.An intersection point is any point on the grid which is formed by the intersection of one horizontal stick and one vertical stick.In the grid shown below, n = 3 and m = 3. There are n + m = 6 sticks in total (horizontal sticks are shown in red and vertical sticks are shown in green). There are n·m = 9 intersection points, numbered from 1 to 9.  The rules of the game are very simple. The players move in turns. Akshat won gold, so he makes the first move. During his/her move, a player must choose any remaining intersection point and remove from the grid all sticks which pass through this point. A player will lose the game if he/she cannot make a move (i.e. there are no intersection points remaining on the grid at his/her move).Assume that both players play optimally. Who will win the game?

Print a single line containing "Akshat" or "Malvika" (without the quotes), depending on the winner of the game.

NoteExplanation of the first sample:The grid has four intersection points, numbered from 1 to 4.  If Akshat chooses intersection point 1, then he will remove two sticks (1 - 2 and 1 - 3). The resulting grid will look like this.  Now there is only one remaining intersection point (i.e. 4). Malvika must choose it and remove both remaining sticks. After her move the grid will be empty.In the empty grid, Akshat cannot make any move, hence he will lose.Since all 4 intersection points of the grid are equivalent, Akshat will lose no matter which one he picks.

The first line of input contains two space-separated integers, n and m (1 ≤ n, m ≤ 100).

Input: 2 2

Output: Malvika

Input: 2 3

Output: Malvika

Input: 3 3

Output: Akshat

Input: 20 68

Output: Malvika

Input: 1 1

Output: Akshat

Input: 1 2

Output: Akshat

Input: 1 3

Output: Akshat

Input: 2 1

Output: Akshat

Input: 2 2

Output: Malvika

Input: 3 1

Output: Akshat

Input: 3 2

Output: Malvika

Input: 68 42

Output: Malvika

Input: 1 35

Output: Akshat

Input: 25 70

Output: Akshat

Input: 59 79

Output: Akshat

Input: 65 63

Output: Akshat

Input: 46 6

Output: Malvika

Input: 28 82

Output: Malvika

Input: 98 98

Output: Malvika

Input: 98 99

Output: Malvika

Input: 98 100

Output: Malvika

Input: 99 98

Output: Malvika

Input: 99 99

Output: Akshat

Input: 99 100

Output: Akshat

Input: 100 98

Output: Malvika

Input: 100 99

Output: Akshat

Input: 100 100

Output: Malvika

Input: 3 4

Output: Akshat


Devu wants to decorate his garden with flowers. He has purchased n boxes, where the i-th box contains fi flowers. All flowers in a single box are of the same color (hence they are indistinguishable). Also, no two boxes have flowers of the same color.Now Devu wants to select exactly s flowers from the boxes to decorate his garden. Devu would like to know, in how many different ways can he select the flowers from each box? Since this number may be very large, he asks you to find the number modulo (109 + 7). Devu considers two ways different if there is at least one box from which different number of flowers are selected in these two ways.

Output a single integer — the number of ways in which Devu can select the flowers modulo (109 + 7).

NoteSample 1. There are two ways of selecting 3 flowers: {1, 2} and {0, 3}.Sample 2. There is only one way of selecting 4 flowers: {2, 2}.Sample 3. There are three ways of selecting 5 flowers: {1, 2, 2}, {0, 3, 2}, and {1, 3, 1}.

The first line of input contains two space-separated integers n and s (1 ≤ n ≤ 20, 0 ≤ s ≤ 1014). The second line contains n space-separated integers f1, f2, ... fn (0 ≤ fi ≤ 1012).

Input:
2 3
1 3

Output: 2

Input:
2 4
2 2

Output: 1

Input:
3 5
1 3 2

Output: 3

Input:
2 270030023747
891135146290 437305641972

Output: 30021858

Input:
20 4385085334307
273634411136 208521328637 450482376435 844118010709 197241285878 472126475472 2414038897 672334205413 809269727018 409013884362 739986692075 953956651947 462216461906 388007176838 245504550965 527140291750 632844435887 550532123833 757200390348 944901802640

Output: 316418090

Input:
20 3752307092657
283053521097 653583221811 681984546714 933027822250 487241474739 534269715560 834243597472 848019110117 485265346854 396702345118 408945102153 816559907551 401511139988 367150665755 712567362471 717769226958 548952754032 434801840119 879399744983 324531633609

Output: 381258106

Input:
20 16619020188439
1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000

Output: 801984344

Input:
20 262144
0 1 3 7 15 31 63 127 255 511 1023 2047 4095 8191 16383 32767 65535 131071 262143 524287

Output: 725216474

Input:
20 5230175580
2 8 26 80 242 728 2186 6560 19682 59048 177146 531440 1594322 4782968 14348906 43046720 129140162 387420488 1162261466 3486784400

Output: 538211934

Input:
20 5230176570
2 8 26 80 242 728 2186 6560 19682 59048 177146 531440 1594322 4782968 14348906 43046720 129140162 387420488 1162261466 3486784400

Output: 19372190

Input:
20 818000201
0 2 8 26 80 242 728 2186 6560 19682 59048 177146 531440 1594322 4782968 14348906 43046720 129140162 387420488 1162261466

Output: 505949526

Input:
1 1
1

Output: 1

Input:
5 4
3 3 4 4 4

Output: 68

Input:
3 850878851187
599705086316 802990808570 221067397125

Output: 334902111

Input:
4 731767033652
306127542694 172970942464 358017806176 394151815116

Output: 418840506

Input:
5 1199105497223
12549999072 542951076358 494968215227 507969287352 287108873850

Output: 997302283

Input:
6 2407012786524
721119939098 908636242955 629771140630 619639275940 522572133850 990422786968

Output: 338886284

Input:
7 1658412315976
390687619668 278616376849 766721549681 733456748176 716885650745 179493438565 887893058525

Output: 227709251

Input:
8 3813157100184
94962592398 646449027095 903671958732 847274220411 915494134937 336004281651 958773586686 419294404968

Output: 789858236

Input:
9 3583740972033
805680016072 12134193693 38474884135 958944208999 114102619129 486072673792 990651855390 976802100017 464520935171

Output: 411195526

Input:
10 1303630103199
335013516244 958354148440 976543431084 565663694920 818191244892 247036352979 903603155051 844331675449 5958875397 633112048156

Output: 130003736

Input:
11 3413722756227
41435972622 328334282334 113493840135 681628650803 53654504892 397104745120 937628907403 397544403202 978080140924 138793325393 275583919363

Output: 481042457

Input:
12 3950166899748
752153396296 698314416228 246149281890 795446123039 250115505435 549320620909 4214468268 918197322444 952348890098 685624345734 963610131910 998304966486

Output: 704755232

Input:
13 3231756157805
456428369026 63999582826 385247174589 909263595275 444429022331 701536496698 38240220621 473557533845 887615379817 195600590268 694933571209 105486312375 699514624098

Output: 21927593

Input:
14 5118792034176
162850825404 433979716719 522197583640 20933583863 643037506523 851604888839 104825781485 989915485791 859736645343 740284126961 419814559564 214815141912 468744648539 228783909097

Output: 80223119

Input:
15 1558494741523
871420765430 803959850613 654853025395 134751056099 837351023419 8115731924 136704050190 545275697192 831857910870 250260371494 109988255759 324143971449 270534481491 203417577675 71520651905

Output: 674766437

Input:
16 788453604753
577843221808 167497533563 791803434447 283275820494 72814283419 158184124065 203289611054 98488424946 799684209100 792796424539 834869244114 427030350042 39764505931 217053505710 484435378338 862395026264

Output: 652797798

Input:
17 9007952448244
282118194538 537477667457 930901327146 397093292730 264980316667 347254775663 237315363407 616993860539 771805474627 339627444880 525042940309 536359179580 804699563076 230689433744 897350104771 814486287026 524910356697

Output: 31329302

Input:
18 7999930929823
992835618212 907457801350 63556768901 515205732262 463588800858 499470651452 303900924272 170206588293 707071964345 849603689414 249923928664 643540525469 608636879676 207470585970 342824639716 768725031437 470251089472 346311861570

Output: 648904203

Input:
19 9705775952949
662403298782 277437935244 200507177952 626875720850 657902317754 649539043593 337926676624 688712023886 679193229872 394287226107 940097624859 752869355006 377866904116 218959030357 755739366148 759818551656 454594081704 739525703426 242214895448

Output: 810780885

Input:
2 412849959951
186777869134 354554126688

Output: 482034976

Input:
3 994437863260
596847635049 634289413919 671297779787

Output: 912049453

Input:
4 484402508263
19064884611 335165127717 322359010582 281374567239

Output: 289015253

Input:
5 791953923546
435577101470 614900414949 563017233052 356648566543 441001524035

Output: 173305014

Input:
6 2640586287988
845646867385 315776128746 214078463847 838768025119 708835459344 934321520813

Output: 795903668

Input:
7 2053179920110
674709576219 593363932330 454736686317 330887483693 391367370275 279198145307 147889917494

Output: 893383692

Input:
8 439869733705
96926825781 294239646128 105797917112 808711974973 661348789232 209376794178 892923476071 68560519128

Output: 158940804

Input:
9 1291213158274
506996591696 573974933359 753301598853 302978917195 348175667460 544253418672 652252001943 837793929669 992753968527

Output: 115213603

Input:
10 957014537036
817957214028 21216064562 782979338116 99716780532 466634308294 252843354854 653225805495 197215781879 450502843918 936581467941

Output: 339756041

Input:
11 2523835918230
238026979942 300951351794 27195109640 583983722756 153461186521 589867462996 410406847719 383294651690 434136016355 239499156985 605005205631

Output: 410668022

Input:
12 237485322803
654539196801 989679581945 674698791381 76103181330 828140581102 517898628219 165440406295 160380578581 10923729522 532416846030 869246361010 697649464752

Output: 882287279

Input:
13 3269153679576
76756446363 279414869175 913209530202 553927672610 103827032762 854922736361 505775989249 925319021826 982409418312 237885027049 548185492012 981990500354 816927519686

Output: 771986243

Input:
14 3533400720920
486826212278 970290582974 566418244646 46047131184 780653910990 782953901584 265104515121 121397891635 966042590749 530802716094 816721614687 274184052307 410140678523 769875336369

Output: 641684934

Input:
15 2774417264718
899043461842 260025870205 221774442737 121321130489 60635329946 132125493373 24433040993 886336334879 945380795890 823720405139 90962770066 149532144989 995501321008 824453862177 210161921008

Output: 36123304

Input:
16 6819891369867
321260711404 950901584003 458137697911 603440589064 737462208174 469149601515 771614083218 82415204689 522168509057 535631037101 355203925446 429578213295 590861963493 295877847255 313625384311 583033522628

Output: 348393153

Input:
17 2309534620849
148175936589 240636871234 113493896003 95560047639 15296143483 397180766738 530942609090 847353647933 503654197846 828548726146 36290540095 711771765248 184075122329 350456373063 419236331263 152256813920 755146994664

Output: 379054730

Input:
18 1950920788528
560393186152 931512585032 349857151176 577679506214 687828054415 734204874881 285976167666 626587058472 487287370283 127171447894 300531695475 996112800850 765140797519 400739931575 522699794566 124030597188 562898195459 475763385703

Output: 698191096

Input:
19 4682267377407
970462952067 221247872263 995213349269 65503997493 957809473372 662236040104 43157209890 812665928283 64075083449 420089136939 564772850855 288306352803 360501440003 860016433006 626163257870 93656896807 955951420632 637845969941 165819589855

Output: 523191343

Input:
20 14017821532816
1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000

Output: 347848142

Input:
20 16335271760241
1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000

Output: 395113180

Input:
20 18060579396941
1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000

Output: 668178260

Input:
20 10137806992108
1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000

Output: 357383650

Input:
20 17054536210144
1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000

Output: 517516660

Input:
20 14387278835382
1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000

Output: 467238355

Input:
20 10472667171608
1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000

Output: 868395358

Input:
20 9876740295167
1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000

Output: 125737184

Input:
20 9502335428550
1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000

Output: 209415674

Input:
20 16899776686559
1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000 1000000000000

Output: 212580649

Input:
1 1
0

Output: 0

Input:
20 10043
2 8 26 80 242 728 2186 6560 19682 59048 177146 531440 1594322 4782968 14348906 43046720 129140162 387420488 1162261466 3486784400

Output: 52142433

Input:
1 0
1

Output: 1

Input:
17 953674316167
4 24 124 624 3124 15624 78124 390624 1953124 9765624 48828124 244140624 1220703124 6103515624 30517578124 152587890624 762939453124

Output: 197405646

Input:
17 953674314899
4 24 124 624 3124 15624 78124 390624 1953124 9765624 48828124 244140624 1220703124 6103515624 30517578124 152587890624 762939453124

Output: 307042369

Input:
17 953674312906
4 24 124 624 3124 15624 78124 390624 1953124 9765624 48828124 244140624 1220703124 6103515624 30517578124 152587890624 762939453124

Output: 81725967

Input:
20 33554432
0 1 3 7 15 31 63 127 255 511 1023 2047 4095 8191 16383 32767 65535 131071 262143 524287

Output: 0

Input:
20 1048554
0 1 3 7 15 31 63 127 255 511 1023 2047 4095 8191 16383 32767 65535 131071 262143 524287

Output: 19

Input:
20 1048455
0 1 3 7 15 31 63 127 255 511 1023 2047 4095 8191 16383 32767 65535 131071 262143 524287

Output: 461657829

Input:
20 1038555
0 1 3 7 15 31 63 127 255 511 1023 2047 4095 8191 16383 32767 65535 131071 262143 524287

Output: 216743080

Input:
20 64741
0 1 3 7 15 31 63 127 255 511 1023 2047 4095 8191 16383 32767 65535 131071 262143 524287

Output: 181890008

Input:
20 125618
1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288

Output: 435524008