The map of Bertown can be represented as a set of $$$n$$$ intersections, numbered from $$$1$$$ to $$$n$$$ and connected by $$$m$$$ one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length of some path from one intersection to another is the number of roads that one has to traverse along the path. The shortest path from one intersection $$$v$$$ to another intersection $$$u$$$ is the path that starts in $$$v$$$, ends in $$$u$$$ and has the minimum length among all such paths.Polycarp lives near the intersection $$$s$$$ and works in a building near the intersection $$$t$$$. Every day he gets from $$$s$$$ to $$$t$$$ by car. Today he has chosen the following path to his workplace: $$$p_1$$$, $$$p_2$$$, ..., $$$p_k$$$, where $$$p_1 = s$$$, $$$p_k = t$$$, and all other elements of this sequence are the intermediate intersections, listed in the order Polycarp arrived at them. Polycarp never arrived at the same intersection twice, so all elements of this sequence are pairwise distinct. Note that you know Polycarp's path beforehand (it is fixed), and it is not necessarily one of the shortest paths from $$$s$$$ to $$$t$$$.Polycarp's car has a complex navigation system installed in it. Let's describe how it works. When Polycarp starts his journey at the intersection $$$s$$$, the system chooses some shortest path from $$$s$$$ to $$$t$$$ and shows it to Polycarp. Let's denote the next intersection in the chosen path as $$$v$$$. If Polycarp chooses to drive along the road from $$$s$$$ to $$$v$$$, then the navigator shows him the same shortest path (obviously, starting from $$$v$$$ as soon as he arrives at this intersection). However, if Polycarp chooses to drive to another intersection $$$w$$$ instead, the navigator rebuilds the path: as soon as Polycarp arrives at $$$w$$$, the navigation system chooses some shortest path from $$$w$$$ to $$$t$$$ and shows it to Polycarp. The same process continues until Polycarp arrives at $$$t$$$: if Polycarp moves along the road recommended by the system, it maintains the shortest path it has already built; but if Polycarp chooses some other path, the system rebuilds the path by the same rules.Here is an example. Suppose the map of Bertown looks as follows, and Polycarp drives along the path $$$[1, 2, 3, 4]$$$ ($$$s = 1$$$, $$$t = 4$$$): Check the picture by the link http://tk.codeforces.com/a.png   When Polycarp starts at $$$1$$$, the system chooses some shortest path from $$$1$$$ to $$$4$$$. There is only one such path, it is $$$[1, 5, 4]$$$;  Polycarp chooses to drive to $$$2$$$, which is not along the path chosen by the system. When Polycarp arrives at $$$2$$$, the navigator rebuilds the path by choosing some shortest path from $$$2$$$ to $$$4$$$, for example, $$$[2, 6, 4]$$$ (note that it could choose $$$[2, 3, 4]$$$);  Polycarp chooses to drive to $$$3$$$, which is not along the path chosen by the system. When Polycarp arrives at $$$3$$$, the navigator rebuilds the path by choosing the only shortest path from $$$3$$$ to $$$4$$$, which is $$$[3, 4]$$$;  Polycarp arrives at $$$4$$$ along the road chosen by the navigator, so the system does not have to rebuild anything. Overall, we get $$$2$$$ rebuilds in this scenario. Note that if the system chose $$$[2, 3, 4]$$$ instead of $$$[2, 6, 4]$$$ during the second step, there would be only $$$1$$$ rebuild (since Polycarp goes along the path, so the system maintains the path $$$[3, 4]$$$ during the third step).The example shows us that the number of rebuilds can differ even if the map of Bertown and the path chosen by Polycarp stays the same. Given this information (the map and Polycarp's path), can you determine the minimum and the maximum number of rebuilds that could have happened during the journey?

Print two integers: the minimum and the maximum number of rebuilds that could have happened during the journey.

The first line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n \le m \le 2 \cdot 10^5$$$) — the number of intersections and one-way roads in Bertown, respectively. Then $$$m$$$ lines follow, each describing a road. Each line contains two integers $$$u$$$ and $$$v$$$ ($$$1 \le u, v \le n$$$, $$$u \ne v$$$) denoting a road from intersection $$$u$$$ to intersection $$$v$$$. All roads in Bertown are pairwise distinct, which means that each ordered pair $$$(u, v)$$$ appears at most once in these $$$m$$$ lines (but if there is a road $$$(u, v)$$$, the road $$$(v, u)$$$ can also appear). The following line contains one integer $$$k$$$ ($$$2 \le k \le n$$$) — the number of intersections in Polycarp's path from home to his workplace. The last line contains $$$k$$$ integers $$$p_1$$$, $$$p_2$$$, ..., $$$p_k$$$ ($$$1 \le p_i \le n$$$, all these integers are pairwise distinct) — the intersections along Polycarp's path in the order he arrived at them. $$$p_1$$$ is the intersection where Polycarp lives ($$$s = p_1$$$), and $$$p_k$$$ is the intersection where Polycarp's workplace is situated ($$$t = p_k$$$). It is guaranteed that for every $$$i \in [1, k - 1]$$$ the road from $$$p_i$$$ to $$$p_{i + 1}$$$ exists, so the path goes along the roads of Bertown.

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

Output: 1 2

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

Output: 0 0

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

Output: 0 3

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

Output: 3 3

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

Output: 5 8

Input:
200000 200000
136681 174056
15423 127122
137672 18542
61006 42559
100993 75825
127154 78864
45846 107290
90566 138733
14816 162076
103420 129914
114282 76956
84055 109451
60410 98835
87450 128443
88089 53597
17504 29650
191714 90663
123767 131600
159335 5416
50211 165717
155480 122795
114778 79131
160130 30508
122082 161582
84675 57923
160533 123470
104475 154615
71811 66321
146618 29051
9884 148531
174343 136606
12006 184589
90277 132097
36794 103218
2543 158399
31228 8...

Output: 0 0

Input:
100000 200000
99425 19372
65894 49823
46049 81197
47047 88322
27333 52675
17577 47048
37090 87556
57515 38881
68912 15728
87086 45332
96140 96168
91687 85568
35009 99210
70897 52531
1665 83360
43728 59264
4310 31016
12521 45397
88644 57610
89520 60896
74367 87421
40373 75625
4086 28966
89659 97328
11690 28936
63889 64887
65444 78523
4094 65878
10240 6571
21220 88133
92056 22730
34150 86090
4181 91377
45325 74245
96372 84468
55543 44377
21982 79978
41173 8571
39069 880...

Output: 13658 17355

Input:
66668 199998
54202 10061
27399 48918
63834 62512
63237 48918
63834 8529
7426 48918
63834 50008
48663 48918
63834 36905
6143 34962
59866 48918
14997 28719
63834 63519
29036 57825
56192 48918
60013 56736
49439 48918
63834 40749
51888 48918
12876 10716
53017 34537
11086 48918
11485 56649
3292 48918
48001 26029
2556 40975
38363 48918
63834 61877
61369 21205
51001 48918
59413 15530
7210 2938
63834 2013
63834 49213
63834 38881
63335 52339
8888 16158
27119 48918
63834 58487
...

Output: 66665 66666

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

Output: 2 2

Input:
200000 200000
145827 139546
8937 173880
12265 41379
44734 140550
128308 185639
59326 11112
194954 30244
171297 34263
98450 125220
165342 31193
90455 21545
185807 133949
166935 169540
26369 20977
166107 165803
111186 116254
36724 161354
168237 61786
155174 177648
47890 34273
187397 104456
126697 31133
107618 128829
78416 104932
18942 167157
195769 134503
173639 81244
154499 71888
105810 168499
123113 138873
10218 57335
67225 87735
52261 81729
104155 64431
171616 12730
780...

Output: 0 0

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

Output: 0 0

Input:
2 2
1 2
2 1
2
1 2

Output: 0 0

Input:
100001 199999
1648 23231
88206 83495
28950 23231
17831 23231
63696 23231
52496 23231
84137 23231
39901 16491
35144 20282
93964 1069
31347 98654
24248 83914
22641 23231
65304 23231
82861 65035
80282 81037
52366 97567
43136 78294
13077 23231
81391 23231
83279 1790
69228 16741
23711 23231
49448 21239
24885 23231
69664 23231
82337 22412
42661 23231
64506 23231
85395 90754
73095 96477
76855 23231
39198 68183
53805 23231
86277 23231
27612 23231
95062 23231
65275 23231
78368...

Output: 99998 99998

Input:
133332 199997
54855 83839
51921 90785
30290 64291
77831 90301
94178 87501
9628 6663
24907 105653
132637 6854
72877 62555
61365 76196
33831 47042
122320 13361
22924 102156
28927 91792
108352 131614
36948 38741
121153 2614
105606 34738
113759 128239
115309 124254
3445 105377
79866 17855
96250 32754
19779 76922
76241 22989
20447 130741
79540 37660
36778 15038
54517 108460
53902 97462
9626 59371
31129 108814
49940 61223
68974 66884
130721 1149
120216 129025
85133 8069
8874...

Output: 0 66665

Input:
100000 200000
99880 75854
8015 53356
37935 54583
99880 77754
84405 92819
49062 80780
25394 50738
63131 11124
59443 42805
89455 40330
65865 59282
48386 60514
43397 35497
99880 53152
50871 10094
37354 2063
39473 85486
37935 77237
78013 37221
99880 8953
63131 69401
37042 43360
70093 49387
84879 18886
37935 34461
41752 93262
34177 47168
13678 550
99880 54660
74950 54273
20151 49424
98248 89313
84114 13042
41866 49812
37935 3699
67164 29849
26333 83027
14813 67926
52069 38...

Output: 1 1

Input:
100000 200000
80405 14948
47995 47522
24872 7313
21670 5847
79073 664
26805 48377
80405 82208
90933 63795
59778 654
59778 73300
37543 54698
30425 22234
883 59623
38578 55377
87700 1497
79974 26917
18370 47716
45327 35298
52595 84134
18239 8112
96215 86111
85509 50965
80405 66867
80701 14051
45327 22741
6927 10507
67111 17967
38454 15183
90135 23528
37543 83723
80405 94780
80405 76176
79974 85464
27521 97996
20271 88834
26390 94437
80405 32817
46732 19448
7543 79349
7...

Output: 47 47

Input:
100000 200000
62981 14466
12678 28357
70405 82432
42177 85035
96251 61605
13855 56103
96511 79429
92416 67727
70711 70422
84720 52605
94207 69087
69435 5642
4277 46436
74583 8169
26942 86652
90042 8224
66670 78287
27626 58025
34286 19840
93657 33346
34365 50812
12694 68044
417 19791
3596 93613
55402 50797
85898 41472
2564 43442
63263 73805
77197 39441
22841 71185
73204 19470
76634 59895
18678 45354
55865 31509
58786 28539
11346 8480
67808 87431
37368 3483
3999 58259
...

Output: 2 2

Input:
50000 200000
11584 19329
36815 27598
6917 28520
45056 19198
11607 45243
27603 21003
31175 7397
33367 38766
13379 15958
46661 35875
26910 21963
12706 8289
24363 7470
36413 10250
9977 19193
19424 25957
20808 43285
21345 6745
19424 19514
38138 3894
19651 23687
11607 28684
36413 9352
9894 18994
36509 2870
7536 42343
44470 24882
28414 41409
27636 9030
27636 25186
13531 21433
36413 28066
38657 1443
7599 42889
41997 6345
17622 28530
11607 48370
5810 47783
36599 42447
13531 ...

Output: 12642 17666

Input:
50000 200000
46095 5557
10996 45395
18157 24049
46095 43885
30441 29575
18157 38269
5770 13886
21841 33812
4880 15208
26523 7532
924 17222
23752 14771
22163 13957
18157 49949
43123 31480
22596 42861
36276 24122
43216 3751
16704 15821
36486 6725
26167 1797
20311 8194
8476 42706
10849 25031
12163 39417
11426 46248
22031 17299
47975 5278
44813 3894
46095 1032
18157 12986
17724 26027
3417 24986
27660 5102
8606 32813
45345 31738
27660 38476
6795 1181
47593 47243
4292 4736...

Output: 11537 16051

Input:
50000 200000
13859 17413
34424 3708
260 48877
9210 36152
49516 49500
19701 17870
49955 45687
42965 44596
19392 43224
19885 19222
34599 26070
2908 6690
36075 7582
32777 27870
3708 15661
49126 6374
14374 14147
46505 17009
2030 32691
33998 27597
13647 12951
44817 33578
4678 49850
40524 1067
7385 14576
46354 48803
8661 22857
2230 42878
30981 22716
35416 7032
47787 2165
49080 15944
37966 14024
3308 30746
3191 32338
31789 29374
24479 13645
36174 46946
25577 15994
26228 419...

Output: 11239 15776

Input:
50000 200000
29993 21906
33136 6164
28285 8924
36437 48672
45141 27978
11720 45315
42257 45802
15623 33122
39981 5517
24188 14675
3493 8694
19167 32464
29322 2746
37451 14698
26966 25943
38817 34207
27712 33920
2391 8086
17653 26278
25655 31039
39203 26812
31973 30262
16815 11947
11772 19276
29920 23750
6175 49005
35904 12241
33976 1830
44118 39385
13137 34478
1601 8388
20557 30145
1281 46747
25563 22975
21822 5551
5527 37696
47901 4873
2421 27720
32357 17404
42531 1...

Output: 1843 2602

Input:
200000 200000
1112 154640
195908 146502
74402 168131
22837 98711
127696 154816
99192 65799
129816 36743
34747 117801
31571 102564
171083 37778
86451 112908
66353 35307
93809 64070
193183 127865
197358 119908
92501 96601
151456 117195
44959 184080
187971 31208
58167 16392
156693 5086
129143 155922
100533 88559
66928 127100
160147 148387
35951 112324
161330 135392
105995 24592
144297 57553
22366 87727
74677 76510
174828 191148
101478 83218
149973 163318
70028 142456
7795 2...

Output: 0 0

Input:
200000 200000
4127 77182
60736 141161
13537 21078
32747 147134
72073 118191
14789 183959
198943 142162
162137 185042
151961 90253
44419 98014
105100 195228
1835 31011
193710 92394
173266 51857
26066 136422
26756 60454
13468 109574
150082 81044
5825 96329
195848 82215
188635 102601
163425 13887
12295 46391
21228 79586
146143 191216
90908 55015
61301 184231
137799 106335
112122 115108
13161 89584
149549 88303
124945 14421
68813 191073
174812 102238
127254 136475
85740 5616...

Output: 0 0

Input:
200000 200000
89762 23210
106015 24887
160020 28808
106075 27804
127405 100643
174192 26553
22909 105445
93674 139264
191898 83091
90879 147501
80544 40256
115811 48618
32262 27902
47740 61000
69644 195230
164964 96811
140491 188089
126576 16672
176970 129371
173174 50602
185265 9256
23907 38343
13677 927
168103 195877
86047 35930
106285 90951
18899 12629
86242 64203
139205 95955
77741 103668
104237 9770
187558 79677
56435 100466
185076 104608
22451 57555
10332 132673
2...

Output: 0 0

Input:
320 385
1 2
1 3
2 4
3 4
4 5
4 6
5 7
6 7
7 8
7 9
8 10
9 10
10 11
10 12
11 13
12 13
13 14
13 15
14 16
15 16
16 17
16 18
17 19
18 19
19 20
19 21
20 22
21 22
22 23
22 24
23 25
24 25
25 26
25 27
26 28
27 28
28 29
28 30
29 31
30 31
31 32
31 33
32 34
33 34
34 35
34 36
35 37
36 37
37 38
37 39
38 40
39 40
40 41
40 42
41 43
42 43
43 44
43 45
44 46
45 46
46 47
46 48
47 49
48 49
49 50
49 51
50 52
51 52
52 53
52 54
53 55
54 55
55 56
55 57
56 58
...

Output: 0 1


Makoto has a big blackboard with a positive integer $$$n$$$ written on it. He will perform the following action exactly $$$k$$$ times:Suppose the number currently written on the blackboard is $$$v$$$. He will randomly pick one of the divisors of $$$v$$$ (possibly $$$1$$$ and $$$v$$$) and replace $$$v$$$ with this divisor. As Makoto uses his famous random number generator (RNG) and as he always uses $$$58$$$ as his generator seed, each divisor is guaranteed to be chosen with equal probability.He now wonders what is the expected value of the number written on the blackboard after $$$k$$$ steps.It can be shown that this value can be represented as $$$\frac{P}{Q}$$$ where $$$P$$$ and $$$Q$$$ are coprime integers and $$$Q \not\equiv 0 \pmod{10^9+7}$$$. Print the value of $$$P \cdot Q^{-1}$$$ modulo $$$10^9+7$$$.

NoteIn the first example, after one step, the number written on the blackboard is $$$1$$$, $$$2$$$, $$$3$$$ or $$$6$$$ — each occurring with equal probability. Hence, the answer is $$$\frac{1+2+3+6}{4}=3$$$.In the second example, the answer is equal to $$$1 \cdot \frac{9}{16}+2 \cdot \frac{3}{16}+3 \cdot \frac{3}{16}+6 \cdot \frac{1}{16}=\frac{15}{8}$$$.

Print a single integer — the expected value of the number on the blackboard after $$$k$$$ steps as $$$P \cdot Q^{-1} \pmod{10^9+7}$$$ for $$$P$$$, $$$Q$$$ defined above.

The only line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 10^{15}$$$, $$$1 \leq k \leq 10^4$$$).

Input: 6 1

Output: 3

Input: 6 2

Output: 875000008

Input: 60 5

Output: 237178099

Input: 2 4

Output: 562500005

Input: 12 3

Output: 775462970

Input: 55 5

Output: 789062507

Input: 935 9

Output: 658825880

Input: 1 10000

Output: 1

Input: 120 1

Output: 500000026

Input: 1000000000000000 10000

Output: 215514159

Input: 671058194037157 8673

Output: 298638658

Input: 900018062553298 4801

Output: 345432320

Input: 128973636102142 5521

Output: 99152648

Input: 999999999999993 8123

Output: 868053217

Input: 260858031033600 9696

Output: 692221824

Input: 562949953421312 9779

Output: 98057767

Input: 357933504618282 1649

Output: 197730476

Input: 586884783199831 5073

Output: 883678085

Input: 187877211524483 8497

Output: 562808746

Input: 866421317361600 10000

Output: 82212846

Input: 782574093100800 9999

Output: 293217028

Input: 577614211574400 9998

Output: 681915605

Input: 65214507758400 9997

Output: 677959603

Input: 963761198400 9996

Output: 669401143

Input: 5587021440 9995

Output: 360750834

Input: 17297280 9994

Output: 94383698

Input: 7560 9993

Output: 412712546

Input: 120 9992

Output: 167656619

Input: 1 1

Output: 1

Input: 609359740010496 1337

Output: 263703037

Input: 912750790581630 9876

Output: 291557094

Input: 617673396283947 7777

Output: 488769014

Input: 890604418498560 9119

Output: 185509970

Input: 524288004718592 8888

Output: 851726115

Input: 999999999999989 8998

Output: 391873310

Input: 999999999999999 8123

Output: 41003922

Input: 817237005720659 4233

Output: 533017938

Input: 1000000007 1

Output: 500000004

Input: 1000000007 2

Output: 750000006

Input: 999999999999970 8998

Output: 939941657

Input: 900000060000001 8123

Output: 865356488

Input: 999011322032079 4233

Output: 546309400

Input: 999005327998113 9119

Output: 106270540

Input: 900000720000023 9876

Output: 511266473


Let's introduce some definitions that will be needed later.Let $$$prime(x)$$$ be the set of prime divisors of $$$x$$$. For example, $$$prime(140) = \{ 2, 5, 7 \}$$$, $$$prime(169) = \{ 13 \}$$$.Let $$$g(x, p)$$$ be the maximum possible integer $$$p^k$$$ where $$$k$$$ is an integer such that $$$x$$$ is divisible by $$$p^k$$$. For example:  $$$g(45, 3) = 9$$$ ($$$45$$$ is divisible by $$$3^2=9$$$ but not divisible by $$$3^3=27$$$),  $$$g(63, 7) = 7$$$ ($$$63$$$ is divisible by $$$7^1=7$$$ but not divisible by $$$7^2=49$$$). Let $$$f(x, y)$$$ be the product of $$$g(y, p)$$$ for all $$$p$$$ in $$$prime(x)$$$. For example:  $$$f(30, 70) = g(70, 2) \cdot g(70, 3) \cdot g(70, 5) = 2^1 \cdot 3^0 \cdot 5^1 = 10$$$,  $$$f(525, 63) = g(63, 3) \cdot g(63, 5) \cdot g(63, 7) = 3^2 \cdot 5^0 \cdot 7^1 = 63$$$. You have integers $$$x$$$ and $$$n$$$. Calculate $$$f(x, 1) \cdot f(x, 2) \cdot \ldots \cdot f(x, n) \bmod{(10^{9} + 7)}$$$.

NoteIn the first example, $$$f(10, 1) = g(1, 2) \cdot g(1, 5) = 1$$$, $$$f(10, 2) = g(2, 2) \cdot g(2, 5) = 2$$$.In the second example, actual value of formula is approximately $$$1.597 \cdot 10^{171}$$$. Make sure you print the answer modulo $$$(10^{9} + 7)$$$.In the third example, be careful about overflow issue.

The only line contains integers $$$x$$$ and $$$n$$$ ($$$2 \le x \le 10^{9}$$$, $$$1 \le n \le 10^{18}$$$) — the numbers used in formula.

Input: 10 2

Output: 2

Input: 20190929 1605

Output: 363165664

Input: 947 987654321987654321

Output: 593574252

Input: 2 1

Output: 1

Input: 1000000000 1000000000000000000

Output: 997440007

Input: 688829161 296569860304026304

Output: 388155331

Input: 666010979 443570624148538441

Output: 886507301

Input: 62459 243660471368579

Output: 842535934

Input: 7946761 48034259999420806

Output: 286862630

Input: 651423529 424352614134813841

Output: 408736200

Input: 9 188

Output: 954137859

Input: 670514203 852730801385798525

Output: 355832385

Input: 610455946 416624575433175279

Output: 338494046

Input: 49 79792266297612001

Output: 444608448

Input: 3 450283905890997363

Output: 137055211

Input: 46957 103538299629493

Output: 516798047

Input: 732253291 788822690846812980

Output: 73304767

Input: 97073 914735122128017

Output: 829607048

Input: 17282811 699905460125739623

Output: 59360995

Input: 181 6364290927201661

Output: 475029602

Input: 858913688 891530069762947837

Output: 647838042

Input: 967354019 885482785588887131

Output: 808625396

Input: 266771957 238077331412324150

Output: 739449215

Input: 830311913 317759021041529386

Output: 693455621

Input: 848817679 656378982730193530

Output: 62821476

Input: 195871858 768946182432660488

Output: 392505530

Input: 711775563 733987980910045529

Output: 162577667

Input: 525248617 82607938303742375

Output: 23639347

Input: 143742939 719404683072701713

Output: 302790025

Input: 28436 878968615689292495

Output: 214265329

Input: 84649 916822936406978638

Output: 246601699

Input: 87620 877857688202236881

Output: 744263233

Input: 593239213 160216936483594374

Output: 304167038

Input: 701679551 498836898172258517

Output: 430076831

Input: 570117590 448352800956119696

Output: 137534751

Input: 955489921 180523632657788226

Output: 983910063

Input: 292681 817149800101377878

Output: 608820127

Input: 1369 886139189349580965

Output: 84873742

Input: 354907921 125959632388542241

Output: 911890209

Input: 844561 602411242538130481

Output: 731875446

Input: 841 353814783205469041

Output: 865189676

Input: 602555209 363072779893033681

Output: 506211588

Input: 822649 556728843703025449

Output: 339554911

Input: 307371493 799006685782884121

Output: 29424494

Input: 2 576460752303423488

Output: 222384588

Input: 5 298023223876953125

Output: 570366926

Input: 31891 32434291280971

Output: 947227318

Input: 2 576460752303423487

Output: 198832797

Input: 183 183

Output: 387952563

Input: 139 1000000000000000000

Output: 141180258


Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every $$$a$$$ and $$$b$$$ such that $$$1 \leq a \leq b \leq 6$$$, there is exactly one domino with $$$a$$$ dots on one half and $$$b$$$ dots on the other half. The set contains exactly $$$21$$$ dominoes. Here is an exact illustration of his set:  Also, Anadi has an undirected graph without self-loops and multiple edges. He wants to choose some dominoes and place them on the edges of this graph. He can use at most one domino of each type. Each edge can fit at most one domino. It's not necessary to place a domino on each edge of the graph.When placing a domino on an edge, he also chooses its direction. In other words, one half of any placed domino must be directed toward one of the endpoints of the edge and the other half must be directed toward the other endpoint. There's a catch: if there are multiple halves of dominoes directed toward the same vertex, each of these halves must contain the same number of dots.How many dominoes at most can Anadi place on the edges of his graph?

NoteHere is an illustration of Anadi's graph from the first sample test:  And here is one of the ways to place a domino on each of its edges:  Note that each vertex is faced by the halves of dominoes with the same number of dots. For instance, all halves directed toward vertex $$$1$$$ have three dots.

Output one integer which denotes the maximum number of dominoes which Anadi can place on the edges of the graph.

The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 7$$$, $$$0 \leq m \leq \frac{n\cdot(n-1)}{2}$$$) — the number of vertices and the number of edges in the graph. The next $$$m$$$ lines contain two integers each. Integers in the $$$i$$$-th line are $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a, b \leq n$$$, $$$a \neq b$$$) and denote that there is an edge which connects vertices $$$a_i$$$ and $$$b_i$$$. The graph might be disconnected. It's however guaranteed that the graph doesn't contain any self-loops, and that there is at most one edge between any pair of vertices.

Input:
4 4
1 2
2 3
3 4
4 1

Output: 4

Input: 7 0

Output: 0

Input:
3 1
1 3

Output: 1

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

Output: 16

Input:
4 4
4 2
2 3
3 4
2 1

Output: 4

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

Output: 7

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

Output: 9

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

Output: 5

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

Output: 13

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

Output: 14

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

Output: 16

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

Output: 13

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

Output: 10

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

Output: 15

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

Output: 14

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

Output: 10

Input: 1 0

Output: 0

Input: 2 0

Output: 0

Input:
2 1
2 1

Output: 1

Input: 3 0

Output: 0

Input:
3 2
2 3
1 3

Output: 2

Input:
3 3
1 2
2 3
1 3

Output: 3

Input: 4 0

Output: 0

Input:
4 2
2 4
1 3

Output: 2

Input:
4 6
2 1
1 4
2 4
3 1
3 2
3 4

Output: 6

Input: 5 0

Output: 0

Input:
5 3
5 1
1 4
5 4

Output: 3

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

Output: 10

Input: 6 0

Output: 0

Input:
6 3
4 2
5 4
4 3

Output: 3

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

Output: 6

Input:
6 15
4 3
2 1
3 6
1 3
4 1
2 3
3 5
4 5
6 1
2 5
1 5
2 6
6 4
5 6
4 2

Output: 15

Input:
6 12
2 1
4 3
1 5
6 4
6 2
3 6
1 6
2 4
1 4
2 5
5 4
1 3

Output: 12

Input:
7 1
5 3

Output: 1

Input:
7 2
5 1
3 5

Output: 2

Input:
7 3
1 5
5 7
2 7

Output: 3

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

Output: 4

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

Output: 6

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

Output: 7

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

Output: 8

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

Output: 9

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

Output: 11

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

Output: 12

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

Output: 13

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

Output: 15

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

Output: 16

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

Output: 16

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

Output: 16

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

Output: 16

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

Output: 12

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

Output: 7

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

Output: 6

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

Output: 13

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

Output: 15

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

Output: 16

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

Output: 15

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

Output: 11


Melody Pond was stolen from her parents as a newborn baby by Madame Kovarian, to become a weapon of the Silence in their crusade against the Doctor. Madame Kovarian changed Melody's name to River Song, giving her a new identity that allowed her to kill the Eleventh Doctor.Heidi figured out that Madame Kovarian uses a very complicated hashing function in order to change the names of the babies she steals. In order to prevent this from happening to future Doctors, Heidi decided to prepare herself by learning some basic hashing techniques.The first hashing function she designed is as follows.Given two positive integers $$$(x, y)$$$ she defines $$$H(x,y):=x^2+2xy+x+1$$$.Now, Heidi wonders if the function is reversible. That is, given a positive integer $$$r$$$, can you find a pair $$$(x, y)$$$ (of positive integers) such that $$$H(x, y) = r$$$?If multiple such pairs exist, output the one with smallest possible $$$x$$$. If there is no such pair, output "NO".

Output integers $$$x, y$$$ such that $$$H(x,y) = r$$$ and $$$x$$$ is smallest possible, or "NO" if no such pair exists.

The first and only line contains an integer $$$r$$$ ($$$1 \le r \le 10^{12}$$$).

Output: 1 8

Output: NO

Output: NO

Output: NO

Output: NO

Output: NO

Output: 1 1

Output: NO

Output: 1 2

Output: NO

Output: 1 3

Output: NO

Output: 1 4

Output: NO

Output: 1 5

Output: NO

Output: 1 6

Output: 1 7

Output: NO

Output: NO

Output: 1 9

Output: NO

Output: 1 125438957286

Output: NO

Output: 1 270012489721

Output: NO

Output: 1 481311845039

Output: 1 27216966722

Output: 1 8238095313

Output: 1 213131351747

Output: NO

Output: 1 326254668074

Output: 1 107641736080

Output: 1 14808958

Output: 1 3752647541

Output: 1 74945464857

Output: 1 92794535371

Output: 1 209725418

Output: 1 259698839699

Output: 1 471723986317

Output: 1 27168154584

Output: 1 344186525357

Output: 1 78115826635

Output: 1 11872249199

Output: 1 384203699087

Output: 1 481880599199

Output: 1 120470149799


You are given a regular polygon with $$$n$$$ vertices labeled from $$$1$$$ to $$$n$$$ in counter-clockwise order. The triangulation of a given polygon is a set of triangles such that each vertex of each triangle is a vertex of the initial polygon, there is no pair of triangles such that their intersection has non-zero area, and the total area of all triangles is equal to the area of the given polygon. The weight of a triangulation is the sum of weigths of triangles it consists of, where the weight of a triagle is denoted as the product of labels of its vertices.Calculate the minimum weight among all triangulations of the polygon.

NoteAccording to Wiki: polygon triangulation is the decomposition of a polygonal area (simple polygon) $$$P$$$ into a set of triangles, i. e., finding a set of triangles with pairwise non-intersecting interiors whose union is $$$P$$$.In the first example the polygon is a triangle, so we don't need to cut it further, so the answer is $$$1 \cdot 2 \cdot 3 = 6$$$.In the second example the polygon is a rectangle, so it should be divided into two triangles. It's optimal to cut it using diagonal $$$1-3$$$ so answer is $$$1 \cdot 2 \cdot 3 + 1 \cdot 3 \cdot 4 = 6 + 12 = 18$$$.

Print one integer — the minimum weight among all triangulations of the given polygon.

The first line contains single integer $$$n$$$ ($$$3 \le n \le 500$$$) — the number of vertices in the regular polygon.


Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market!In the morning, there are $$$n$$$ opportunities to buy shares. The $$$i$$$-th of them allows to buy as many shares as you want, each at the price of $$$s_i$$$ bourles.In the evening, there are $$$m$$$ opportunities to sell shares. The $$$i$$$-th of them allows to sell as many shares as you want, each at the price of $$$b_i$$$ bourles. You can't sell more shares than you have.It's morning now and you possess $$$r$$$ bourles and no shares.What is the maximum number of bourles you can hold after the evening?

NoteIn the first example test, you have $$$11$$$ bourles in the morning. It's optimal to buy $$$5$$$ shares of a stock at the price of $$$2$$$ bourles in the morning, and then to sell all of them at the price of $$$5$$$ bourles in the evening. It's easy to verify that you'll have $$$26$$$ bourles after the evening.In the second example test, it's optimal not to take any action.

Output a single integer — the maximum number of bourles you can hold after the evening.

The first line of the input contains three integers $$$n, m, r$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq m \leq 30$$$, $$$1 \leq r \leq 1000$$$) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now. The next line contains $$$n$$$ integers $$$s_1, s_2, \dots, s_n$$$ ($$$1 \leq s_i \leq 1000$$$); $$$s_i$$$ indicates the opportunity to buy shares at the price of $$$s_i$$$ bourles. The following line contains $$$m$$$ integers $$$b_1, b_2, \dots, b_m$$$ ($$$1 \leq b_i \leq 1000$$$); $$$b_i$$$ indicates the opportunity to sell shares at the price of $$$b_i$$$ bourles.

Input:
3 4 11
4 2 5
4 4 5 4

Output: 26

Input:
2 2 50
5 7
4 2

Output: 50

Input:
1 1 1
1
1

Output: 1

Input:
1 1 35
5
7

Output: 49

Input:
1 1 36
5
7

Output: 50

Input:
3 5 20
1000 4 6
1 2 7 6 5

Output: 35

Input:
5 3 20
5 4 3 2 1
6 7 1000

Output: 20000

Input:
30 30 987
413 937 166 77 749 925 792 353 773 88 218 863 71 186 753 306 952 966 236 501 84 163 767 99 887 380 435 888 589 761
68 501 323 916 506 952 411 813 664 49 860 151 120 543 168 944 302 521 245 517 464 734 205 235 173 893 109 655 346 837

Output: 12440

Input:
30 22 1000
999 953 947 883 859 857 775 766 723 713 696 691 659 650 597 474 472 456 455 374 367 354 347 215 111 89 76 76 59 55
172 188 223 247 404 445 449 489 493 554 558 587 588 627 686 714 720 744 747 786 830 953

Output: 17164

Input:
28 29 1000
555 962 781 562 856 700 628 591 797 873 950 607 526 513 552 954 768 823 863 650 984 653 741 548 676 577 625 902
185 39 223 383 221 84 165 492 79 53 475 410 314 489 59 138 395 346 91 258 14 354 410 25 41 394 463 432 325

Output: 1000

Input:
30 29 999
993 982 996 992 988 984 981 982 981 981 992 997 982 996 995 981 995 982 994 996 988 986 990 991 987 993 1000 989 998 991
19 12 14 5 20 11 15 11 7 14 12 8 1 9 7 15 6 20 15 20 17 15 20 1 4 13 2 2 17

Output: 999

Input:
30 30 999
19 8 6 1 4 12 14 12 8 14 14 2 13 11 10 15 13 14 2 5 15 17 18 16 9 4 2 14 12 9
993 987 993 998 998 987 980 986 995 987 998 989 981 982 983 981 997 991 989 989 993 990 984 997 995 984 982 994 990 984

Output: 997002

Input:
28 30 1000
185 184 177 171 165 162 162 154 150 136 133 127 118 111 106 106 95 92 86 85 77 66 65 40 28 10 10 4
305 309 311 313 319 321 323 338 349 349 349 351 359 373 378 386 405 409 420 445 457 462 463 466 466 471 473 479 479 482

Output: 120500

Input:
1 1 10
11
1000

Output: 10

Input:
29 30 989
450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450
451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451

Output: 991

Input:
25 30 989
153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153
153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153 153

Output: 989

Input:
30 26 997
499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499 499
384 384 384 384 384 384 384 384 384 384 384 384 384 384 384 384 384 384 384 384 384 384 384 384 384 384

Output: 997

Input:
30 30 1000
1 4 2 2 2 1 2 2 2 3 3 3 1 4 2 4 3 1 2 2 3 2 4 2 3 4 2 4 3 2
1000 999 997 1000 999 998 999 999 1000 1000 997 997 999 997 999 997 997 999 1000 999 997 998 998 998 997 997 999 1000 998 998

Output: 1000000

Input:
30 29 42
632 501 892 532 293 47 45 669 129 616 322 92 812 499 205 115 889 442 589 34 681 944 49 546 134 625 937 179 1000 69
837 639 443 361 323 493 639 573 645 55 711 190 905 628 627 278 967 926 398 479 71 829 960 916 360 43 341 337 90

Output: 975

Input:
30 30 1000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
962 987 940 905 911 993 955 994 984 994 923 959 923 993 959 925 922 909 932 911 994 1000 994 976 915 979 928 999 993 956

Output: 1000000

Input:
1 1 100
90
91

Output: 101

Input:
1 1 1000
501
502

Output: 1001

Input:
2 1 8
3 4
5

Output: 12

Input:
1 3 10
2
4 5 10

Output: 50

Input:
4 4 50
12 11 30 30
12 12 12 12

Output: 54

Input:
5 10 10
2 2 2 2 2
2 2 2 2 2 2 2 2 2 3

Output: 15

Input:
1 2 100
1
1 100

Output: 10000

Input:
9 7 999
999 999 999 999 999 999 999 999 999
999 999 999 999 999 999 999

Output: 999

Input:
1 3 10
2
2 3 5

Output: 25

Input:
1 1 4
3
4

Output: 5

Input:
1 1 100
99
100

Output: 101

Input:
1 2 5
1
2 5

Output: 25

Input:
3 3 10
10 12 15
30 50 50

Output: 50

Input:
1 1 13
11
12

Output: 14

Input:
1 2 2
1
1 10

Output: 20

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

Output: 50

Input:
2 16 729
831 752
331 882 112 57 754 314 781 390 193 285 109 301 308 750 39 94

Output: 729

Input:
1 1 7
5
6

Output: 8

Input:
3 3 1000
600 600 600
999 999 999

Output: 1399

Input:
1 1 10
4
5

Output: 12

Input:
1 1 7
5
7

Output: 9

Input:
1 1 5
5
6

Output: 6

Input:
2 3 100
2 2
2 2 10

Output: 500

Input:
1 5 10
2
1 1 1 1 10

Output: 50

Input:
2 4 2
1 1
1 1 1 100

Output: 200

Input:
1 2 100
1
1 2

Output: 200

Input:
1 1 15
6
7

Output: 17

Input:
2 5 100
10 10
2 2 2 100 100

Output: 1000

Input:
1 2 4
3
4 1

Output: 5

Input:
1 2 100
50
50 100

Output: 200

Input:
1 2 10
1
2 10

Output: 100

Input:
2 4 100
1 1
1 1 1 100

Output: 10000

Input:
1 1 10
10
20

Output: 20

Input:
1 1 4
4
5

Output: 5

Input:
1 28 10
5
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10

Output: 20

Input:
1 1 3
3
20

Output: 20

Input:
2 1 1000
52 51
53

Output: 1038

Input:
2 1 7
5 4
10

Output: 13

Input:
2 1 10
5 4
100

Output: 202

Input:
2 1 11
5 4
6

Output: 15

Input:
1 30 1
1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Output: 1

Input:
1 1 5
5
10

Output: 10

Input:
1 1 5
5
20

Output: 20

Input:
2 2 50
5 7
6 2

Output: 60

Input:
2 1 8
6 5
10

Output: 13

Input:
2 1 17
8 7
10

Output: 23

Input:
2 3 8
4 3
10 20 30

Output: 62

Input:
1 2 2
2
1 3

Output: 3

Input:
1 2 10
1
1 5

Output: 50

Input:
1 1 100
1000
10

Output: 100

Input:
2 3 100
5 5
1 1 100

Output: 2000

Input:
1 1 10
20
30

Output: 10

Input:
1 2 4
1
1 2

Output: 8

Input:
1 3 1
1
1 1 100

Output: 100

Input:
1 1 999
500
501

Output: 1000

Input:
1 2 10
1
1 2

Output: 20

Input:
1 1 10
7
9

Output: 12

Input:
2 5 100
2 2
2 2 2 2 5

Output: 250

Input:
2 3 10
1 1
1 1 2

Output: 20

Input:
1 2 10
1
9 8

Output: 90

Input:
2 5 10
2 2
2 2 2 2 5

Output: 25

Input:
5 6 8
7 7 10 5 5
5 6 2 8 1 8

Output: 11

Input:
1 1 5
1
4

Output: 20

Input:
12 21 30
24 15 29 5 16 29 12 17 6 19 16 11
8 15 12 10 15 20 21 27 18 18 22 15 28 21 29 13 13 9 13 5 3

Output: 174

Input:
1 3 5
1
1 2 1

Output: 10

Input:
1 3 1000
10
10 30 20

Output: 3000

Input:
1 1 15
4
5

Output: 18

Input:
1 1 4
8
7

Output: 4

Input:
1 1 12
10
11

Output: 13

Input:
2 4 7
1 1
1 1 1 10

Output: 70

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

Output: 70

Input:
1 2 5
3
2 10

Output: 12

Input:
2 3 11
2 2
3 3 5

Output: 26

Input:
1 3 50
10
10 30 20

Output: 150

Input:
1 5 10
5
1 1 1 1 10

Output: 20

Input:
1 2 19
10
1 11

Output: 20

Input:
1 3 4
1
1 5 2

Output: 20

Input:
1 2 100
2
1 10

Output: 500

Input:
1 1 12
9
10

Output: 13

Input:
3 4 11
4 2 5
4 4 4 5

Output: 26

Input:
1 1 8
6
7

Output: 9

Input:
1 1 7
4
5

Output: 8

Input:
1 5 10
1
5 5 5 5 10

Output: 100

Input:
1 2 10
1
1 20

Output: 200

Input:
1 2 5
1
2 3

Output: 15

Input:
1 3 100
5
1 1 1000

Output: 20000

Input:
2 1 11
5 4
5

Output: 13

Input:
4 3 11
1 2 3 4
1 2 3

Output: 33

Input:
1 2 5
2
2 100

Output: 201

Input:
1 5 10
2
1 1 1 1 100

Output: 500

Input:
3 3 11
4 5 6
1 2 5

Output: 13

Input:
2 3 5
1 1
2 2 5

Output: 25

Input:
3 4 10
5 3 1
10 10 10 1000

Output: 10000

Input:
1 1 13
5
6

Output: 15

Input:
1 1 1000
51
52

Output: 1019

Input:
1 2 10
1
3 10

Output: 100

Input:
3 4 2
5 3 5
10 10 10 1000

Output: 2

Input:
1 1 11
8
9

Output: 12

Input:
1 2 5
5
5 10

Output: 10

Input:
1 5 10
1
2 2 2 2 5

Output: 50

Input:
1 2 1
1
1 2

Output: 2

Input:
3 5 100
1 1 1
2 2 2 2 7

Output: 700

Input:
1 2 10
2
2 10

Output: 50

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

Output: 90


Getting closer and closer to a mathematician, Serval becomes a university student on math major in Japari University. On the Calculus class, his teacher taught him how to calculate the expected length of a random subsegment of a given segment. Then he left a bonus problem as homework, with the award of a garage kit from IOI. The bonus is to extend this problem to the general case as follows.You are given a segment with length $$$l$$$. We randomly choose $$$n$$$ segments by choosing two points (maybe with non-integer coordinates) from the given segment equiprobably and the interval between the two points forms a segment. You are given the number of random segments $$$n$$$, and another integer $$$k$$$. The $$$2n$$$ endpoints of the chosen segments split the segment into $$$(2n+1)$$$ intervals. Your task is to calculate the expected total length of those intervals that are covered by at least $$$k$$$ segments of the $$$n$$$ random segments.You should find the answer modulo $$$998244353$$$.

NoteIn the first example, the expected total length is $$$\int_0^1 \int_0^1 |x-y| \,\mathrm{d}x\,\mathrm{d}y = {1\over 3}$$$, and $$$3^{-1}$$$ modulo $$$998244353$$$ is $$$332748118$$$.

Output one integer — the expected total length of all the intervals covered by at least $$$k$$$ segments of the $$$n$$$ random segments modulo $$$998244353$$$. Formally, let $$$M = 998244353$$$. It can be shown that the answer can be expressed as an irreducible fraction $$$\frac{p}{q}$$$, where $$$p$$$ and $$$q$$$ are integers and $$$q \not \equiv 0 \pmod{M}$$$. Output the integer equal to $$$p \cdot q^{-1} \bmod M$$$. In other words, output such an integer $$$x$$$ that $$$0 \le x < M$$$ and $$$x \cdot q \equiv p \pmod{M}$$$.

First line contains three space-separated positive integers $$$n$$$, $$$k$$$ and $$$l$$$ ($$$1\leq k \leq n \leq 2000$$$, $$$1\leq l\leq 10^9$$$).

Input: 1 1 1

Output: 332748118

Input: 6 2 1

Output: 760234711

Input: 7 5 3

Output: 223383352

Input: 97 31 9984524

Output: 267137618

Input: 2000 1 772197283

Output: 905584809

Input: 2000 2 76039754

Output: 855496918

Input: 2000 3 40337285

Output: 782495326

Input: 2000 2000 773356966

Output: 104351589

Input: 2000 1999 239479112

Output: 620815507

Input: 2000 1998 334042678

Output: 322694394

Input: 2000 976 671942688

Output: 767696001

Input: 2000 1415 40371690

Output: 171032298

Input: 2000 1000 1000000000

Output: 491672258

Input: 1998 1001 998244353

Output: 0

Input: 2000 4 136878315

Output: 880870575

Input: 2000 5 558837462

Output: 18859862

Input: 2000 1997 525997660

Output: 843278067

Input: 2000 1996 45458693

Output: 772786701

Input: 2000 1947 62604662

Output: 540795249

Input: 2000 1728 63723796

Output: 421421553

Input: 1961 206 931072038

Output: 794464980

Input: 1948 978 501529426

Output: 50139353

Input: 1878 1529 66841298

Output: 880727658

Input: 1900 1 495084177

Output: 338668438

Input: 1885 2 286102770

Output: 443099162

Input: 1928 3 200575371

Output: 291241927

Input: 1978 4 436588015

Output: 282947523

Input: 1987 1987 191667504

Output: 627381301

Input: 1821 1820 866603455

Output: 318623064

Input: 1824 1822 151884700

Output: 462069981

Input: 1486 1 170331068

Output: 692176218

Input: 1424 1 217388653

Output: 56808622

Input: 1703 1 803103605

Output: 660333930

Input: 1555 1 700556118

Output: 615656029

Input: 1224 1 71403225

Output: 128242924

Input: 1492 1 599215694

Output: 195441337

Input: 1281 1 415457117

Output: 111407914

Input: 1664 1 517151944

Output: 126430274

Input: 1771 1 555450393

Output: 280416119

Input: 1045 1 375567139

Output: 983012429

Input: 1025 1025 871316577

Output: 266993477

Input: 1243 1243 296556443

Output: 209836419

Input: 1240 1240 846679367

Output: 744376915

Input: 1946 1946 432053608

Output: 329055332

Input: 1806 1806 174417450

Output: 287857698

Input: 1321 1321 774237640

Output: 573916469

Input: 1205 1205 972407779

Output: 970505824

Input: 1063 1063 497812546

Output: 203394740

Input: 1443 1443 784034214

Output: 489871338

Input: 1099 1099 548018740

Output: 530449224

Input: 1334 667 998244356

Output: 123570327

Input: 1621 810 998244355

Output: 334476739

Input: 1253 626 998244353

Output: 0

Input: 1217 608 998244355

Output: 465345479

Input: 1966 983 998244357

Output: 81898103

Input: 1471 735 998244354

Output: 399941190

Input: 1496 748 998244357

Output: 419593982

Input: 1307 653 998244355

Output: 823060783

Input: 1706 853 998244357

Output: 627644358

Input: 1025 512 998244357

Output: 120622427


Young Teodor enjoys drawing. His favourite hobby is drawing segments with integer borders inside his huge [1;m] segment. One day Teodor noticed that picture he just drawn has one interesting feature: there doesn't exist an integer point, that belongs each of segments in the picture. Having discovered this fact, Teodor decided to share it with Sasha.Sasha knows that Teodor likes to show off so he never trusts him. Teodor wants to prove that he can be trusted sometimes, so he decided to convince Sasha that there is no such integer point in his picture, which belongs to each segment. However Teodor is lazy person and neither wills to tell Sasha all coordinates of segments' ends nor wills to tell him their amount, so he suggested Sasha to ask him series of questions 'Given the integer point xi, how many segments in Fedya's picture contain that point?', promising to tell correct answers for this questions.Both boys are very busy studying and don't have much time, so they ask you to find out how many questions can Sasha ask Teodor, that having only answers on his questions, Sasha can't be sure that Teodor isn't lying to him. Note that Sasha doesn't know amount of segments in Teodor's picture. Sure, Sasha is smart person and never asks about same point twice.

NoteFirst example shows situation where Sasha can never be sure that Teodor isn't lying to him, because even if one knows cnt(xi) for each point in segment [1;4], he can't distinguish this case from situation Teodor has drawn whole [1;4] segment.In second example Sasha can ask about 5 points e.g. 1, 2, 3, 5, 6, still not being sure if Teodor haven't lied to him. But once he knows information about all points in [1;6] segment, Sasha can be sure that Teodor haven't lied to him.

Single line of output should contain one integer number k – size of largest set (xi, cnt(xi)) where all xi are different, 1 ≤ xi ≤ m, and cnt(xi) is amount of segments, containing point with coordinate xi, such that one can't be sure that there doesn't exist point, belonging to all of segments in initial picture, if he knows only this set(and doesn't know n).

First line of input contains two integer numbers: n and m (1 ≤ n, m ≤ 100 000) — amount of segments of Teodor's picture and maximal coordinate of point that Sasha can ask about. ith of next n lines contains two integer numbers li and ri (1 ≤ li ≤ ri ≤ m) — left and right ends of ith segment in the picture. Note that that left and right ends of segment can be the same point. It is guaranteed that there is no integer point, that belongs to all segments.

Input:
2 4
1 2
3 4

Output: 4

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

Output: 5

Input:
70 1495
148 339
470 596
859 1322
214 443
74 1320
995 1246
266 1261
147 1240
690 1439
1178 1455
789 1478
563 1206
68 1490
339 467
1324 1471
681 1289
346 822
72 1080
126 1326
382 910
267 1168
101 119
382 666
79 1176
358 1185
958 1426
590 989
80 539
273 617
1129 1343
210 1071
144 1484
210 609
397 1077
950 1112
523 1343
396 888
640 1281
491 729
704 761
1208 1276
357 1139
341 772
1111 1453
893 1482
718 1200
67 547
302 494
98 949
17 69
353 1146
346 534
997 132...

Output: 1108

Input:
85 1596
125 264
823 1193
811 1042
278 1556
257 1311
273 586
210 576
443 1082
16 639
460 1206
580 1521
636 1128
729 1299
1257 1387
428 1577
838 979
1019 1422
342 344
1222 1316
1045 1352
136 463
280 1558
199 763
126 1248
281 713
803 1476
1230 1493
190 693
1137 1417
383 615
236 1243
271 1500
174 488
316 1500
132 1199
298 1251
47 336
117 1310
619 668
272 1239
11 870
501 1535
1041 1105
906 1119
251 525
578 1393
820 1182
854 1141
77 610
566 1210
320 969
114 312...

Output: 1249

Input:
458 1408
530 595
182 831
180 1002
874 1012
135 990
718 879
618 778
582 891
630 825
491 1239
941 1140
659 683
109 272
144 1228
985 1349
1012 1273
67 1349
236 1019
827 1066
24 1105
198 1348
227 473
697 1337
405 952
186 902
138 555
277 1192
1126 1229
436 684
890 946
432 913
15 1059
868 1346
525 879
59 189
367 1400
224 1131
419 603
1130 1265
833 1323
267 1024
846 1085
809 1212
611 759
203 595
716 1203
196 1228
406 1332
73 501
354 849
98 498
85 900
403 916
2...

Output: 1051

Input:
43 1319
750 1030
857 946
941 1203
407 1034
947 1290
546 585
630 1201
72 342
693 1315
34 719
176 1097
36 931
198 973
5 1025
892 1054
461 1287
195 1273
832 1039
308 955
642 866
770 838
440 777
289 948
98 814
458 768
82 265
300 596
182 706
368 1225
237 626
36 348
100 222
46 937
364 396
288 668
1158 1243
31 1108
570 1000
435 619
339 1007
132 734
281 441
636 1319

Output: 1082

Input:
31 1600
643 1483
8 475
15 472
49 81
300 1485
627 682
44 443
1191 1541
478 732
1112 1202
741 1341
475 1187
1218 1463
523 1513
355 477
1259 1559
384 928
487 766
227 1224
1102 1268
833 1240
872 1342
666 1075
734 874
32 880
1411 1536
520 778
179 1003
51 313
1148 1288
1467 1509

Output: 1181

Input:
246 1909
1155 1906
27 1495
81 1780
101 1799
1102 1601
247 1036
65 1175
197 1672
286 1632
548 1899
125 1384
666 1798
1638 1831
659 1548
71 141
623 701
375 1252
1321 1786
993 1574
677 911
469 1030
351 1256
18 1550
252 1088
709 1427
965 1309
845 850
1259 1292
669 1664
1017 1690
1022 1527
282 454
1272 1831
598 1394
1394 1631
583 1165
1447 1565
855 1441
1415 1551
860 1046
737 1081
1064 1123
775 816
915 1287
1350 1790
272 330
52 758
975 1730
1441 1590
1185 1426
...

Output: 1412

Input:
376 1479
1008 1198
916 1363
56 164
526 1196
467 1199
143 822
115 1143
70 921
668 1332
1261 1377
547 660
368 1009
799 865
646 1001
1111 1449
323 517
1314 1454
973 1449
227 1131
1187 1391
319 944
421 1435
1211 1284
341 708
1074 1387
1109 1187
266 668
148 1423
418 1416
685 946
104 1268
865 1296
385 994
1128 1400
133 1016
548 992
154 843
216 316
497 1101
103 606
820 1030
172 770
212 351
285 1225
1228 1284
1171 1427
251 1272
424 564
699 1068
548 741
616 798
10...

Output: 1159

Input:
38 1109
61 332
429 756
260 272
57 991
420 985
143 219
399 925
486 1079
69 881
75 447
678 774
973 1016
983 1059
518 1049
393 853
375 1101
475 946
300 427
294 715
504 798
211 1066
730 815
114 515
589 1001
464 1014
451 757
370 1017
225 619
452 988
611 955
349 1029
73 165
759 951
574 803
253 1045
545 565
603 773
226 453

Output: 996

Input:
199 1078
78 174
98 428
34 127
114 767
309 593
402 794
626 857
227 810
26 456
338 353
706 1040
134 347
169 605
736 776
49 714
437 535
468 973
138 951
260 705
457 1043
368 1015
63 405
67 723
265 470
46 953
456 941
49 380
918 1034
96 958
559 915
334 1024
178 789
200 1025
283 926
137 837
28 824
753 987
105 248
56 880
462 758
509 1032
4 873
104 110
84 385
242 260
538 689
242 318
240 401
406 438
629 1068
170 1048
312 768
432 525
302 600
317 361
769 958
456...

Output: 903

Input:
222 1469
59 98
310 1337
71 958
184 662
818 1304
1118 1306
337 743
428 1015
1179 1259
56 605
223 1003
134 767
1173 1215
467 659
170 214
514 736
443 1048
361 1243
70 808
212 387
69 872
1000 1204
630 726
1011 1293
843 1106
253 1084
101 999
429 998
464 1118
517 1196
986 1058
536 1045
671 1049
633 1000
307 998
571 610
547 1038
979 1135
508 1432
33 274
403 1053
1167 1361
453 1172
131 678
366 1271
366 1023
54 343
604 1013
382 805
744 848
953 1082
492 920
890 12...

Output: 1202

Input:
3665 47536
29107 29576
5669 21584
588 28996
8681 28973
3052 40821
23760 42122
11972 35644
18419 29768
17490 22057
34072 35088
25800 38221
10359 18371
11606 23348
6336 12337
6468 44124
22085 25312
28336 32658
24047 35510
11709 33575
27181 35984
19832 24987
5999 41385
7066 22633
5583 25044
10325 40347
49 35579
22204 41523
15757 19103
41583 45307
5762 47471
15277 23228
6810 35085
28474 30491
10811 25376
13704 36285
1963 30108
20351 26419
20408 41907
28446 37908
265 2082...

Output: 35778

Input:
1499 45851
10181 21404
1966 7385
19615 28911
11553 43310
12326 36312
22271 31416
4833 9767
7985 27367
464 20180
18411 25016
1334 20248
9942 13129
14063 23736
1189 6219
35143 39805
4584 33201
5153 34260
10265 27394
6413 44069
20573 23355
16462 22025
22037 42475
30388 37994
736 35432
19522 29316
18487 28222
6662 33023
24214 40678
5630 33991
27695 35149
6209 24457
26647 34001
15481 39910
22245 29105
21835 27115
30341 45253
36615 42341
5670 22393
5738 36571
12737 19092
...

Output: 35846

Input:
2258 19241
4359 17588
2093 4590
6074 12281
3923 14014
6944 9336
10465 15161
2134 11530
9775 10665
3396 13176
8279 12652
10572 16513
5587 11258
11496 18524
4254 12592
607 9497
6978 13316
6504 6585
643 11185
4394 9337
7264 9620
5468 13435
12216 18261
4055 14381
4967 11426
1838 10900
7910 17191
2572 3402
2275 11822
2878 16684
5202 15567
6776 14652
9178 11824
3310 11876
1771 9994
2226 14389
3848 18669
2533 9122
7040 15865
4887 14401
12340 18617
3793 18998
7485 11035
8...

Output: 14826

Input:
3337 45896
192 3432
22664 28148
12757 33609
18666 31615
24499 35758
14904 15580
8087 33344
7709 11509
40433 44158
3240 37286
9600 41506
33038 34132
15939 26379
13291 22343
7856 38730
10104 19193
30755 36531
21039 35683
25770 31728
15936 28625
8855 15613
37215 40978
19371 29832
19980 36385
24175 38960
15417 38256
30149 35338
13510 40857
10884 23967
20398 34214
10376 12024
1137 13736
10061 24003
8781 40862
40523 43550
1409 13019
19866 40704
12963 17262
2140 3071
2835 4...

Output: 34393

Input:
3333 49268
26757 32783
1709 49045
33010 44913
36698 47691
11312 32974
6901 33873
7932 39905
14474 31209
14198 34040
765 40652
16447 23024
12550 39264
5648 45690
17538 45078
21819 22602
19346 47164
16948 34247
880 1006
1899 5997
18765 31006
11671 47755
1079 48978
11623 35845
3842 20079
24980 47772
15945 26345
22478 31704
1770 25425
27614 40478
17875 40583
7618 18900
7273 27958
31515 48209
5584 42062
34147 41502
67 49127
4911 45520
14658 42783
40840 48802
22782 45645
...

Output: 37104

Input:
1761 36010
28478 31193
2530 7425
12650 18703
9236 14644
10740 33418
24381 29269
23646 27946
13450 28743
16446 23470
27272 35366
21622 31287
20994 30543
2316 21172
5061 8700
312 2985
6540 9393
4046 18568
18890 26811
937 34306
1665 24627
664 19865
16895 27159
27361 27560
26014 30714
5647 28092
7156 26264
31302 31727
14088 27624
13841 33864
9342 27828
13305 31183
12720 20665
12039 16207
2626 23659
4055 21474
7849 17176
25730 35672
26631 30685
13049 20263
32498 35498
13...

Output: 27748

Input:
3062 35932
385 16746
4927 34748
6848 20735
15837 17051
1436 16701
5212 28534
12160 34793
33136 33176
1984 32010
3481 33738
17834 18491
18153 25467
13778 19432
5418 31891
16135 30379
4222 12814
10311 30958
13431 25946
9361 19316
4643 11797
27420 31459
14870 24631
16307 23383
1362 22027
1887 5615
2129 5439
7345 17601
17731 29883
1746 22065
9204 33118
12725 24961
18299 29552
4740 24224
9141 32835
9758 11607
1473 6852
16982 32227
16734 30576
17897 26896
27433 34674
2768...

Output: 27194

Input:
3271 41871
5402 38721
2695 6849
7380 22612
7772 34282
27408 39485
1864 32125
1132 19947
20238 23584
6305 35812
8093 21048
19794 36050
6 17072
2545 18055
10978 29927
16460 40836
23922 37856
9725 18603
14231 32675
616 31713
9740 32661
22261 38444
11503 29921
17632 39882
26526 30579
4568 23459
2235 27170
4254 33342
5587 6003
3048 32478
31149 31222
10106 10513
20188 20665
7492 18485
861 8629
32745 38070
10893 14811
9799 19478
33144 33704
12861 21997
7023 21439
32433 373...

Output: 31014

Input:
2253 13790
4137 4887
11861 12084
4999 9382
4640 12935
1024 4456
3845 7372
4243 7942
445 1777
2997 4670
7543 12734
9040 13354
1988 11290
6831 13131
1973 6348
2251 4236
3952 11610
2394 4403
7896 9690
9391 13110
4253 6997
7556 9037
2327 11540
1033 12157
5964 11380
5384 12915
10086 12109
2765 13198
6585 11832
2858 10329
7932 13739
5071 6049
5993 7297
2126 5238
1444 9773
4574 10406
8955 11075
2875 10912
8343 11901
1212 9834
3939 10833
7732 8463
1650 11529
1467 13645
4...

Output: 10475

Input:
4211 49769
37864 40008
18673 34312
14576 38933
29321 39751
29302 39586
19615 39878
29784 43056
21432 27318
10852 41059
2979 27063
19814 38625
8043 38433
33841 41207
10218 38755
42082 49745
6250 11678
7544 12643
16471 31695
28415 32994
883 8043
33245 46403
9174 29504
26582 48166
2546 13867
7271 35607
8814 26515
23991 44396
11184 14948
32166 49281
17503 38458
21626 22645
35623 48142
4574 40304
5897 12782
29481 38908
12967 38298
8395 14014
3587 15947
4556 21579
12602 23...

Output: 36561

Input:
91503 95156
34333 89352
488 44104
2371 67097
7028 7779
22486 47671
60877 81552
38103 88842
33002 39466
33202 90944
14413 91554
33173 66651
25683 81313
73431 95020
23303 94858
20738 53404
33391 93725
30763 30861
45631 93425
26998 55668
69731 93932
54914 59586
16681 39239
32447 61420
52879 70548
2662 28344
60982 64050
20945 66221
42052 43668
3820 26758
12685 41675
36092 67557
76742 86973
23959 37772
15584 62433
57728 78157
37269 69495
29807 86461
42315 71480
16571 51327...

Output: 73149

Input:
54866 91453
14931 34343
50995 87828
47478 67758
27714 56742
80637 81447
11233 62356
14696 46203
14117 27042
8753 84450
14901 39901
16149 62555
32482 78085
14922 35193
20838 77887
20454 60487
32817 74027
12121 43712
9223 57931
21673 77894
45372 90556
63252 87654
44165 81020
34994 82045
46964 59875
22476 68723
48748 69112
24046 49749
1967 34279
3269 62669
70912 79014
20599 48355
5275 28293
62831 70257
12546 21286
24377 58658
32252 69168
40893 41631
26365 27909
17275 398...

Output: 68968

Input:
100000 100000
13036 23902
9482 71466
78471 98728
2470 22915
5999 53211
3996 25994
11349 30511
17277 56448
18316 78308
38636 42069
26256 63127
57249 63985
58305 64366
17839 28518
18980 95945
6076 36316
69530 96509
6039 6940
41847 56048
41054 82118
49670 95896
45891 74636
75413 90736
27251 87730
66202 68344
51666 71879
8985 42722
43845 49000
4961 44614
64751 97655
79361 80091
12747 20934
9188 74058
8454 93662
79516 91323
33567 42656
44392 58833
86157 93051
10398 79297
...

Output: 77461

Input:
2082 31492
8124 21423
8573 25478
9682 22408
19967 23818
4330 8983
14435 20568
12603 20160
23017 23436
25845 28196
11447 24484
13249 17370
407 21337
15516 22770
8322 28421
10718 12194
21061 25102
2847 2914
12083 14456
1471 29335
13981 14283
3275 6566
5744 8447
5298 6662
5046 6306
8666 13765
2492 27103
12201 30518
262 13450
7296 21010
11508 21863
8203 10303
17460 18065
5484 6387
9096 9587
9854 31179
734 31453
2980 16136
2199 5769
2837 21325
8645 30363
733 17991
12228...

Output: 23604

Input:
1738 29888
2359 27953
12852 25588
11661 23733
6189 28878
3853 21060
1727 8350
10666 28184
2869 24410
3403 7008
8918 19364
23969 26407
6402 17261
4453 19675
1868 12637
2851 7037
10560 11464
10668 26481
7137 13748
19326 20693
2999 29067
2999 4369
21788 22476
11377 18554
15000 29487
5676 21218
11990 12533
3265 20463
755 1999
6389 17731
133 6626
3686 25034
4818 16395
13787 21429
9767 18883
12217 26490
29312 29568
13135 23311
10241 12280
14284 24438
6141 29210
3075 17837...

Output: 23733

Input:
2045 38392
8287 38249
21446 23477
1314 5016
25610 30776
20118 37629
10437 10955
1638 19760
15959 35278
16758 25625
20840 30695
9962 35406
20321 34024
22449 23405
929 6733
8715 30432
11953 18615
14374 19140
7239 26933
6321 12216
25896 34276
2555 32740
3689 20060
9511 24059
441 24086
9032 12870
3305 6161
8488 8772
2423 26413
22130 32246
7477 22055
5868 33185
869 13726
32241 36470
30767 36457
9054 13204
12754 21303
16806 32368
20883 36258
2993 6857
13489 28019
29912 31...

Output: 28328

Input:
3327 18192
1900 16595
1320 9601
7867 10945
4907 9091
2644 16872
6868 9861
7289 11430
88 12757
4251 17343
285 7511
750 7377
3233 13314
1430 14285
656 9475
7812 10481
4344 10466
15040 17774
651 15175
7961 11620
5021 8240
4980 7045
8826 9374
12049 17487
3011 11380
13834 15153
4238 4436
11388 14845
4536 5943
8444 8692
9554 16806
3720 9800
10880 16801
1218 15695
8172 14761
13619 14941
15418 16669
1587 7124
6115 6432
14180 14192
1336 2067
97 2798
4545 12874
1110 16399
...

Output: 13907

Input:
4084 21389
8585 11875
1783 20895
5390 8596
5035 16072
2165 18145
13255 17908
7011 8601
2412 11288
13232 17068
8013 16679
2120 3820
7792 14949
12560 18353
869 5049
2911 11872
19102 20787
4910 14319
10507 20349
8404 13203
6811 8463
1893 13311
12313 18857
4946 17046
7698 19111
3801 4874
3284 11162
10754 17880
9741 17124
542 4896
6380 15782
4138 11206
10237 11401
4190 19921
5497 7976
12667 20397
8209 10358
14455 15268
11982 19240
1121 3321
8603 13703
1453 13565
771 164...

Output: 15979

Input:
2344 41826
8815 37791
700 29553
12107 16515
13735 34424
28205 29893
8259 12603
27039 39817
20715 39767
17573 40401
19058 26363
12502 22923
7624 28093
1346 16780
26062 36158
11466 30357
24588 34403
19932 41018
12445 22897
17692 38150
21617 28390
13220 34682
38139 41179
9348 14763
28448 36941
4290 20132
31322 36353
783 36963
15237 20693
28188 30547
3951 21828
8693 39637
23676 25996
1341 28759
23145 40930
23149 31796
30177 40462
13497 40115
15136 30811
9172 28103
4405 4...

Output: 31604

Input:
1160 33800
6967 29159
8264 33328
14519 24396
17142 24660
3103 24533
14087 32381
15177 20428
10048 13774
11852 20526
20280 27940
5553 26729
18916 19856
23813 27548
20264 30035
3840 25773
24161 25055
6774 15565
1861 5135
5154 20486
12754 24103
26723 31238
7013 12547
2191 28702
10485 21301
17036 17442
12446 20723
3480 24717
15715 19931
6699 8890
2468 25239
19032 20444
10594 26949
1711 26015
19152 32694
1156 4070
19084 19434
14489 16371
10013 19078
5823 6020
1249 12749
...

Output: 25564

Input:
3729 30209
10200 21741
16819 29074
9458 11821
28109 29423
14288 28011
22033 27532
2324 9014
15533 22927
1186 17429
11515 26232
9524 28586
5729 25381
586 1357
11366 15423
5948 26418
19296 22354
17112 23126
4176 8418
12507 19409
7994 10873
1988 21059
257 18633
13919 27249
3606 20272
21265 23180
18528 29413
1627 14239
24506 26072
4916 30108
11934 13605
5028 21469
6609 14871
823 2474
9189 21012
22460 26662
6978 15846
15689 22265
3282 19431
5273 27407
4606 5737
1090 4603...

Output: 23263

Input:
4439 24373
15436 19385
3974 17179
1211 16522
1754 14472
11213 16104
3285 22382
9705 16144
10048 14000
724 1155
10759 19834
3092 22446
9593 15960
5534 13015
19768 22870
4110 17313
3475 17599
13473 22712
5681 15561
2726 23925
12308 14407
6631 6844
3057 4974
7137 15329
17908 18111
11776 21483
185 22676
12895 22820
17308 18038
8185 9661
14404 18091
6419 21977
11256 23113
4261 15134
13707 23057
8022 11705
18343 19579
2527 10489
15704 18684
16685 23613
6745 13820
3449 811...

Output: 18603

Input:
2755 28236
417 11040
21622 25993
5547 11001
6143 27149
9376 19956
8309 16342
4805 5350
181 2446
5443 17667
2594 26264
15793 19032
10639 15438
6639 25269
8489 27558
14712 27133
11277 13973
18079 23475
21941 23237
3929 26490
10164 12319
18746 24233
5996 10022
2907 22418
1012 1397
4892 27261
2061 5605
21828 24261
15927 16890
16002 21439
7980 15455
193 27175
13947 26407
4597 19017
6807 13492
2251 20998
21152 27899
11198 15271
14955 16574
8102 18644
21601 27074
13603 201...

Output: 21486

Input:
57085 95915
16138 31980
2959 69176
484 53844
49465 75425
19660 21700
8220 84606
25871 55685
35357 71747
37049 41397
34057 89401
70124 81855
4544 80433
41688 56108
46883 48121
20406 47993
47726 77541
53345 87508
27741 41991
49216 76231
32290 53539
8544 72285
47722 55847
3876 32309
786 49509
31272 76010
5919 9798
63907 66594
61110 65271
23482 68173
91047 91970
443 13852
42426 68410
41235 66075
37437 64985
60009 64507
2244 64111
15723 42433
64713 70462
22559 62818
24177...

Output: 72843

Input:
77241 82069
39127 47748
11494 25676
72547 73052
12725 81069
17874 50659
5932 13583
55455 72964
15929 42693
12071 16216
20328 32804
28482 54430
35090 41583
19427 33973
21816 68205
53588 60141
12787 32100
60785 72622
12811 44375
24243 34543
16833 79773
30527 68457
59733 65239
2563 21904
19582 70853
17873 21137
12586 77463
22387 25493
5967 39319
11516 66208
41135 79004
8500 37166
17364 56912
20576 33913
57487 68289
11575 12257
52983 75286
22997 45977
36370 80574
28709 77...

Output: 62734

Input:
77248 97173
65919 80791
35313 45326
3798 34873
8247 53450
24184 96979
15002 64861
38526 54189
32535 81860
14354 59810
35859 70570
82861 96759
81740 96529
48081 62558
80309 83059
10366 85699
19 28946
20037 48147
89322 89996
35400 62267
17080 52747
40159 57279
29806 49861
13374 89033
37341 63678
13005 42410
28490 47846
54139 79434
32972 56207
30467 85675
6726 14401
59447 62192
24673 77467
59046 79109
9785 45912
9130 74009
58237 78606
11574 44793
14012 84229
46621 50786
...

Output: 74212

Input:
66853 82485
17690 48410
3919 36713
21385 60159
39024 68102
47066 63421
18251 40576
39787 68753
13467 78012
34444 47422
14836 29860
28872 56534
3123 15332
10528 80517
32445 37799
58853 65478
8970 40649
29539 30816
3444 31466
2530 9530
40443 80291
15276 73485
23497 42059
38491 67279
6048 37514
30175 67295
53865 81777
39254 67208
17537 55082
46547 70611
13350 75756
32 40220
12338 37921
27727 70788
9634 58935
15389 68231
41676 66682
58907 61829
19401 23491
12715 68365
22...

Output: 63065

Input:
59635 97816
47579 86827
15159 61964
3210 45414
27135 27329
38045 74784
2932 86395
832 24745
13790 72565
55090 63278
75406 75992
30035 30743
5030 47258
57402 95536
54196 80421
7130 80339
10050 34202
52040 92802
67999 75971
16527 53614
42817 74436
48574 97583
82708 84936
6898 24668
9308 47902
6717 22951
36152 69745
75525 95329
1164 40116
1972 2709
21938 82056
26624 54513
8348 37042
10102 71400
6008 50792
14527 19283
58195 70054
16942 87278
29083 85245
53642 59887
9026 ...

Output: 74340

Input:
92793 88333
42616 74872
54141 85690
42062 59359
24292 37682
41786 49100
38110 60457
1703 48473
4003 65392
33866 81040
55879 71432
32527 37012
50119 63769
23578 48730
27555 66039
40185 62709
76021 88332
30516 52505
79445 82384
34012 69986
9034 51729
46074 81724
41162 80407
37484 50740
53248 63158
37210 41520
8931 81086
22037 52566
80692 84901
33623 44774
19598 80283
44859 84997
53108 54338
30475 72962
61223 78515
3797 30539
14097 46224
53607 86328
23827 44592
1905 7205...

Output: 68106

Input:
66471 86093
40599 41179
13329 42461
30797 62465
19801 24394
13976 28959
25228 76677
47175 63717
23699 35087
9388 68807
2831 22435
17097 22146
25680 80679
31434 66814
24923 75751
50794 65533
6376 31614
28111 72456
6022 77054
31738 67370
9903 82269
61602 63239
12976 61538
64555 74421
42824 70641
13116 69978
40535 40956
34103 42248
10144 43873
70224 77288
42957 62460
9480 28299
56991 75015
18949 27590
27342 52951
46017 71865
1633 26674
4729 82349
7036 61345
6164 42479
6...

Output: 65527

Input:
71235 85445
3239 23614
50662 72054
69943 78235
12419 18613
42249 53618
11842 33072
34920 35233
35608 81390
7188 35353
33556 80880
29281 51523
12104 59772
60939 78038
21990 56334
54932 56615
67328 70668
33300 60616
51548 84338
48366 62011
14619 78042
31719 37698
44547 55424
3763 60634
56900 68252
27801 57030
23613 67316
8936 24206
22027 64002
3918 50038
41734 49090
43693 60092
13949 78413
44811 80092
61778 81523
8222 51348
72620 74282
2189 64165
36780 64107
7829 65240
...

Output: 65523

Input:
52603 81157
16889 25334
41836 73978
13496 67234
31847 63624
15860 74969
12382 61565
19568 78762
19579 55432
1075 32213
22741 38473
9807 58754
9324 80579
9038 59462
52566 77687
56424 79294
21091 32659
39997 70527
6678 28014
49703 60460
18666 42815
24857 73974
62242 77717
56703 78265
28039 36817
6009 43436
46938 73775
6093 52041
35928 72074
46910 79583
29901 64853
31716 48370
11571 65682
64410 67222
32144 43362
8546 46547
68661 80080
36213 74307
30667 60134
11016 38318
...

Output: 61566

Input:
59525 89384
22351 37316
65890 74214
28398 69995
7467 43872
55064 76804
17923 40495
62371 74803
4078 41237
5070 74654
38831 68938
34960 50130
6497 10295
20711 72215
358 62798
20330 76559
31787 44161
58696 68851
41746 60647
862 24831
6657 41239
23616 39414
63285 88377
78268 81666
77321 83615
14826 49605
17298 58135
61310 66378
41532 60393
7443 42799
10376 67040
10755 23961
27367 46089
11675 88260
16142 17354
6602 42235
37343 83132
17087 49236
33715 43589
41925 85734
25...

Output: 67524

Input:
99143 93090
50949 54195
32798 34537
17211 79559
36749 92805
13116 39671
67088 71043
22544 47957
26386 35771
37980 37987
9822 61785
8101 73845
5149 8215
47380 80113
20561 86349
52610 71366
43269 57659
41120 52324
32491 73474
35902 90128
5725 71756
27877 35227
11910 90238
32044 70574
10722 72856
15517 54617
6547 8884
47616 61104
53770 57368
16732 26101
7105 64634
61970 77705
10903 29752
18239 66216
65594 66758
82949 89760
8633 48276
77048 88335
38243 65802
10328 51408
...

Output: 72086

Input:
80038 95220
27728 33168
83975 94946
76876 85129
14236 79899
6047 54365
9883 68142
31694 74447
42889 94287
2440 72173
2946 6315
25159 28719
4559 66970
28291 64140
35011 46851
54309 89457
38510 40730
39559 43176
43629 62353
30265 48534
3953 63839
30212 54534
12094 63189
51397 51837
4583 37642
89248 94413
737 76815
24524 72921
10358 63341
6131 26984
25453 46820
38211 46668
44254 86369
39007 84346
10570 15013
21086 64657
53177 57118
10582 23461
28625 85735
81544 90724
28...

Output: 73158

Input:
62566 97927
68317 77647
21653 94931
7414 64175
998 48021
11329 57019
4429 79689
63794 85527
62731 76214
66545 79506
18043 32928
34373 56177
61044 78810
1286 95569
30285 63149
43609 48993
3798 75012
18286 52430
45974 66319
65151 65727
91617 97765
14752 17033
4498 87772
6188 27320
85342 86948
27865 65647
27855 49251
14868 58888
33808 43690
43321 86031
32626 95314
63421 94544
262 50279
4267 88940
27526 71711
20509 61941
17617 93054
35039 57388
24592 65582
7713 41455
393...

Output: 74433

Input:
65563 90360
5917 72615
1527 10076
21803 22289
36217 75333
17621 20343
71805 85391
1295 50612
49982 90286
53712 69340
32990 41756
59756 68713
38135 39485
31019 50729
59732 65657
56770 61017
1089 58646
423 72757
795 16334
8304 58577
82708 87667
61234 77087
9132 62236
44889 49543
16031 21015
14643 54441
1804 88183
26959 86411
15435 83636
21892 24019
56029 69807
4552 38176
19898 23801
62208 88196
2744 14470
44354 45484
54899 68475
10739 46722
3359 64876
41128 53716
69030...

Output: 68828

Input:
58242 95875
50628 88159
10216 42194
24797 75311
35327 94418
10294 41016
74579 81427
2681 20988
43652 85835
22030 87583
15623 83335
7167 41731
39891 82405
13018 95058
29503 89074
16348 84112
44981 46647
44355 74204
47555 60988
3502 77623
30152 42128
11686 87903
4261 9361
8147 29496
10263 87608
36553 62806
14753 27358
31756 60790
13952 69174
4623 54241
36090 92900
84953 89229
40187 53301
41345 83109
17296 92667
7741 57946
61708 93175
27516 86322
36765 90186
6476 9807
3...

Output: 72658

Input:
58571 94052
18089 88936
2964 47107
300 70501
51871 89730
43263 84195
63464 64360
41784 57811
13956 49997
45205 67429
14439 59561
8396 89897
15925 25159
7612 54254
25352 55548
37823 88837
65531 85460
24387 77030
8884 16625
18167 36805
54449 55664
80274 86111
42838 44052
49963 79598
5276 46778
43604 53916
71609 83318
5997 17697
14843 26608
46229 80954
2081 81328
22502 59827
3741 87969
80446 80495
74921 79210
65941 81086
68241 86906
22428 91169
38976 44477
560 33035
136...

Output: 70990

Input:
11 3
1 1
1 1
1 1
1 1
2 2
2 2
2 2
3 3
3 3
3 3
3 3

Output: 2


You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be  of them.You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis. Find the minimal number of layers you have to use for the given N.

NoteAs an example, here are the segments and their optimal arrangement into layers for N = 4.

Output a single integer - the minimal number of layers required to draw the segments for the given N.

The only input line contains a single integer N (1 ≤ N ≤ 100).


Given an integer $$$x$$$. Your task is to find out how many positive integers $$$n$$$ ($$$1 \leq n \leq x$$$) satisfy $$$$$$n \cdot a^n \equiv b \quad (\textrm{mod}\;p),$$$$$$ where $$$a, b, p$$$ are all known constants.

NoteIn the first sample, we can see that $$$n=2$$$ and $$$n=8$$$ are possible answers.

Print a single integer: the number of possible answers $$$n$$$.

The only line contains four integers $$$a,b,p,x$$$ ($$$2 \leq p \leq 10^6+3$$$, $$$1 \leq a,b < p$$$, $$$1 \leq x \leq 10^{12}$$$). It is guaranteed that $$$p$$$ is a prime.

Input: 2 3 5 8

Output: 2

Input: 4 6 7 13

Output: 1

Input: 233 233 10007 1

Output: 1

Input: 338792 190248 339821 152634074578

Output: 449263

Input: 629260 663548 739463 321804928248

Output: 434818

Input: 656229 20757 818339 523535590429

Output: 639482

Input: 1000002 1000002 1000003 1000000000000

Output: 999998

Input: 345 2746 1000003 5000000

Output: 4

Input: 802942 824238 836833 605503824329

Output: 723664

Input: 1 1 2 880336470888

Output: 440168235444

Input: 2 2 3 291982585081

Output: 97327528361

Input: 699601 39672 1000003 391631540387

Output: 391905

Input: 9 1 11 792412106895

Output: 72037464262

Input: 85 535 541 680776274925

Output: 1258366493

Input: 3153 4504 7919 903755230811

Output: 114124839

Input: 10021 18448 20719 509684975746

Output: 24599907

Input: 66634 64950 66889 215112576953

Output: 3215965

Input: 585128 179390 836839 556227387547

Output: 664796

Input: 299973 381004 1000003 140225320941

Output: 140481

Input: 941641 359143 1000003 851964325687

Output: 851984

Input: 500719 741769 1000003 596263138944

Output: 596056

Input: 142385 83099 1000003 308002143690

Output: 307937

Input: 891986 300056 999983 445202944465

Output: 445451

Input: 620328 378284 999983 189501757723

Output: 189574

Input: 524578 993938 999979 535629124351

Output: 535377

Input: 419620 683571 999979 243073161801

Output: 243611

Input: 339138 549930 999883 962863668031

Output: 962803

Input: 981603 635385 999233 143056117417

Output: 143126

Input: 416133 340425 998561 195227456237

Output: 195090

Input: 603835 578057 996323 932597132292

Output: 936103

Input: 997998 999323 1000003 999968459613

Output: 999964

Input: 997642 996418 999983 999997055535

Output: 1000007

Input: 812415 818711 820231 999990437063

Output: 1219017

Input: 994574 993183 1000003 999974679059

Output: 999965

Input: 999183 998981 999979 999970875649

Output: 999996

Input: 1 1 2 1

Output: 1

Input: 699601 39672 1000003 1

Output: 0

Input: 4 1 5 15

Output: 2

Input: 912896 91931 999983 236754

Output: 1

Input: 154814 35966 269041 1234567

Output: 4

Input: 1 2 5 470854713201

Output: 94170942640

Input: 3 27 29 968042258975

Output: 33380767549

Input: 473 392 541 108827666667

Output: 201160200

Input: 8 27 29 193012366642

Output: 6655598851

Input: 1302 504 1987 842777827450

Output: 424145863

Input: 693528 398514 1000003 1000000000000

Output: 999995

Input: 533806 514846 1000003 999999999999

Output: 999997

Input: 812509 699256 1000003 999999999999

Output: 999997

Input: 28361 465012 1000003 1000000000000

Output: 999996

Input: 28361 465012 1000003 12693229

Output: 1

Input: 28361 465012 1000003 13271836

Output: 2

Input: 28361 465012 1000003 13271835

Output: 1

Input: 28361 465012 1000003 13421000

Output: 4

Input: 28361 465012 1000003 19609900

Output: 9

Input: 28361 465012 1000003 12693228

Output: 0

Input: 1 1 2 1000000000000

Output: 500000000000

Input: 1 1000002 1000003 1000000000000

Output: 999997

Input: 1 44444 1000003 999999999998

Output: 999997

Input: 2 1000002 1000003 1000000000000

Output: 1000001

Input: 2 23333 1000003 1000000000000

Output: 999999


Imp is in a magic forest, where xorangles grow (wut?)  A xorangle of order n is such a non-degenerate triangle, that lengths of its sides are integers not exceeding n, and the xor-sum of the lengths is equal to zero. Imp has to count the number of distinct xorangles of order n to get out of the forest. Formally, for a given integer n you have to find the number of such triples (a, b, c), that:  1 ≤ a ≤ b ≤ c ≤ n;  , where  denotes the bitwise xor of integers x and y.  (a, b, c) form a non-degenerate (with strictly positive area) triangle.

NoteThe only xorangle in the first sample is (3, 5, 6).

Print the number of xorangles of order n.

The only line contains a single integer n (1 ≤ n ≤ 2500).


Mahmoud and Ehab play a game called the even-odd game. Ehab chooses his favorite integer n and then they take turns, starting from Mahmoud. In each player's turn, he has to choose an integer a and subtract it from n such that:  1 ≤ a ≤ n.  If it's Mahmoud's turn, a has to be even, but if it's Ehab's turn, a has to be odd. If the current player can't choose any number satisfying the conditions, he loses. Can you determine the winner if they both play optimally?

NoteIn the first sample, Mahmoud can't choose any integer a initially because there is no positive even integer less than or equal to 1 so Ehab wins.In the second sample, Mahmoud has to choose a = 2 and subtract it from n. It's Ehab's turn and n = 0. There is no positive odd integer less than or equal to 0 so Mahmoud wins.

Output "Mahmoud" (without quotes) if Mahmoud wins and "Ehab" (without quotes) otherwise.

The only line contains an integer n (1 ≤ n ≤ 109), the number at the beginning of the game.

Output: Ehab

Output: Mahmoud

Output: Mahmoud

Output: Ehab

Output: Ehab

Output: Mahmoud

Output: Ehab

Output: Ehab

Output: Ehab

Output: Mahmoud

Output: Ehab

Output: Mahmoud

Output: Mahmoud

Output: Ehab

Output: Mahmoud

Output: Ehab

Output: Mahmoud

Output: Mahmoud

Output: Ehab

Output: Ehab


Katie, Kuro and Shiro are best friends. They have known each other since kindergarten. That's why they often share everything with each other and work together on some very hard problems.Today is Shiro's birthday. She really loves pizza so she wants to invite her friends to the pizza restaurant near her house to celebrate her birthday, including her best friends Katie and Kuro.She has ordered a very big round pizza, in order to serve her many friends. Exactly $$$n$$$ of Shiro's friends are here. That's why she has to divide the pizza into $$$n + 1$$$ slices (Shiro also needs to eat). She wants the slices to be exactly the same size and shape. If not, some of her friends will get mad and go home early, and the party will be over.Shiro is now hungry. She wants to cut the pizza with minimum of straight cuts. A cut is a straight segment, it might have ends inside or outside the pizza. But she is too lazy to pick up the calculator.As usual, she will ask Katie and Kuro for help. But they haven't come yet. Could you help Shiro with this problem?

NoteTo cut the round pizza into quarters one has to make two cuts through the center with angle $$$90^{\circ}$$$ between them.To cut the round pizza into five equal parts one has to make five cuts.

A single integer — the number of straight cuts Shiro needs.

A single line contains one non-negative integer $$$n$$$ ($$$0 \le n \leq 10^{18}$$$) — the number of Shiro's friends. The circular pizza has to be sliced into $$$n + 1$$$ pieces.


Today on Informatics class Nastya learned about GCD and LCM (see links below). Nastya is very intelligent, so she solved all the tasks momentarily and now suggests you to solve one of them as well.We define a pair of integers (a, b) good, if GCD(a, b) = x and LCM(a, b) = y, where GCD(a, b) denotes the greatest common divisor of a and b, and LCM(a, b) denotes the least common multiple of a and b.You are given two integers x and y. You are to find the number of good pairs of integers (a, b) such that l ≤ a, b ≤ r. Note that pairs (a, b) and (b, a) are considered different if a ≠ b.

NoteIn the first example there are two suitable good pairs of integers (a, b): (1, 2) and (2, 1).In the second example there are four suitable good pairs of integers (a, b): (1, 12), (12, 1), (3, 4) and (4, 3).In the third example there are good pairs of integers, for example, (3, 30), but none of them fits the condition l ≤ a, b ≤ r.

In the only line print the only integer — the answer for the problem.

The only line contains four integers l, r, x, y (1 ≤ l ≤ r ≤ 109, 1 ≤ x ≤ y ≤ 109).

Input: 1 2 1 2

Output: 2

Input: 1 12 1 12

Output: 4

Input: 50 100 3 30

Output: 0

Input: 1 1000000000 1 1000000000

Output: 4

Input: 1 1000000000 158260522 200224287

Output: 0

Input: 1 1000000000 2 755829150

Output: 8

Input: 1 1000000000 158260522 158260522

Output: 1

Input: 1 1000000000 877914575 877914575

Output: 1

Input: 232 380232688 116 760465376

Output: 30

Input: 47259 3393570 267 600661890

Output: 30

Input: 1 1000000000 1 672672000

Output: 64

Input: 1000000000 1000000000 1000000000 1000000000

Output: 1

Input: 1 1000000000 1 649209600

Output: 32

Input: 1 1000000000 1 682290000

Output: 32

Input: 1 1000000000 1 228614400

Output: 16

Input: 1 1000000000 1 800280000

Output: 32

Input: 1 1000000000 1 919987200

Output: 16

Input: 1 1000000000 1 456537870

Output: 64

Input: 1 1000000000 1 7198102

Output: 8

Input: 1 1000000000 1 58986263

Output: 16

Input: 1 1000000000 1 316465536

Output: 16

Input: 1 1000000000 1 9558312

Output: 16

Input: 1 1000000000 1 5461344

Output: 16

Input: 58 308939059 29 617878118

Output: 62

Input: 837 16262937 27 504151047

Output: 28

Input: 47275 402550 25 761222050

Output: 12

Input: 22 944623394 22 944623394

Output: 32

Input: 1032 8756124 12 753026664

Output: 18

Input: 7238 939389 11 618117962

Output: 10

Input: 58351 322621 23 818489477

Output: 6

Input: 3450 7068875 25 975504750

Output: 86

Input: 13266 1606792 22 968895576

Output: 14

Input: 21930 632925 15 925336350

Output: 42

Input: 2193 4224517 17 544962693

Output: 42

Input: 526792 39807152 22904 915564496

Output: 8

Input: 67728 122875524 16932 491502096

Output: 12

Input: 319813 63298373 24601 822878849

Output: 6

Input: 572464 23409136 15472 866138032

Output: 4

Input: 39443 809059020 19716 777638472

Output: 12

Input: 2544768 8906688 27072 837228672

Output: 0

Input: 413592 46975344 21768 892531536

Output: 10

Input: 11349 816231429 11349 816231429

Output: 8

Input: 16578 939956022 16578 939956022

Output: 4

Input: 2783175 6882425 21575 887832825

Output: 2

Input: 2862252 7077972 22188 913058388

Output: 2

Input: 1856828 13124976 25436 958123248

Output: 6

Input: 100 1000000000 158260522 158260522

Output: 1

Input: 100 1000000000 877914575 877914575

Output: 1

Input: 100 1000000000 602436426 602436426

Output: 1

Input: 100 1000000000 24979445 24979445

Output: 1

Input: 1 1000000000 18470 112519240

Output: 4

Input: 1 1000000000 22692 2201124

Output: 2

Input: 1 1000000000 24190 400949250

Output: 16

Input: 1 1000000000 33409 694005157

Output: 2

Input: 1 1000000000 24967 470827686

Output: 16

Input: 1 1000000000 35461 152517761

Output: 8

Input: 2 1000000000 158260522 200224287

Output: 0

Input: 2 1000000000 602436426 611751520

Output: 0

Input: 2 1000000000 861648772 942726551

Output: 0

Input: 2 1000000000 433933447 485982495

Output: 0

Input: 2 1000000000 262703497 480832794

Output: 0

Input: 2672374 422235092 1336187 844470184

Output: 2

Input: 1321815 935845020 1321815 935845020

Output: 8

Input: 29259607 69772909 2250739 907047817

Output: 2

Input: 11678540 172842392 2335708 864211960

Output: 4

Input: 297 173688298 2876112 851329152

Output: 2

Input: 7249 55497026 659 610467286

Output: 28

Input: 398520 1481490 810 728893080

Output: 4

Input: 2354 369467362 1177 738934724

Output: 14

Input: 407264 2497352 1144 889057312

Output: 2

Input: 321399 1651014 603 879990462

Output: 4

Input: 475640 486640 440 526057840

Output: 2

Input: 631714 179724831 1136 717625968

Output: 0

Input: 280476 1595832 588 761211864

Output: 8

Input: 10455 39598005 615 673166085

Output: 6

Input: 24725 19759875 575 849674625

Output: 22

Input: 22 158 2 1738

Output: 2

Input: 1 2623 1 2623

Output: 4

Input: 7 163677675 3 18

Output: 0

Input: 159 20749927 1 158

Output: 0

Input: 5252 477594071 1 5251

Output: 0

Input: 2202 449433679 3 6603

Output: 0

Input: 6 111 3 222

Output: 2

Input: 26 46 2 598

Output: 2

Input: 26 82 2 1066

Output: 2

Input: 1 2993 1 2993

Output: 4

Input: 17 17 1 289

Output: 0

Input: 177 267 3 15753

Output: 2

Input: 7388 22705183 1 7387

Output: 0

Input: 1 100 3 100

Output: 0

Input: 1 1000 6 1024

Output: 0

Input: 1 100 2 4

Output: 2

Input: 1 10000 2 455

Output: 0

Input: 1 1000000000 250000000 1000000000

Output: 2

Input: 3 3 1 1

Output: 0

Input: 1 1000000000 100000000 1000000000

Output: 4

Input: 5 10 3 3

Output: 0

Input: 1 1000 5 13

Output: 0

Input: 2 2 3 3

Output: 0

Input: 1 1000000000 499999993 999999986

Output: 2

Input: 1 1 1 10

Output: 0

Input: 1 10 10 100

Output: 0

Input: 1 1000 4 36

Output: 2

Input: 1 1000000000 10000000 20000000

Output: 2

Input: 100 100 5 5

Output: 0

Input: 3 3 3 9

Output: 0

Input: 36 200 24 144

Output: 2

Input: 1 100 3 10

Output: 0