For an array of integers $$$a$$$, let's define $$$|a|$$$ as the number of elements in it.Let's denote two functions: $$$F(a, k)$$$ is a function that takes an array of integers $$$a$$$ and a positive integer $$$k$$$. The result of this function is the array containing $$$|a|$$$ first elements of the array that you get by replacing each element of $$$a$$$ with exactly $$$k$$$ copies of that element.For example, $$$F([2, 2, 1, 3, 5, 6, 8], 2)$$$ is calculated as follows: first, you replace each element of the array with $$$2$$$ copies of it, so you obtain $$$[2, 2, 2, 2, 1, 1, 3, 3, 5, 5, 6, 6, 8, 8]$$$. Then, you take the first $$$7$$$ elements of the array you obtained, so the result of the function is $$$[2, 2, 2, 2, 1, 1, 3]$$$. $$$G(a, x, y)$$$ is a function that takes an array of integers $$$a$$$ and two different integers $$$x$$$ and $$$y$$$. The result of this function is the array $$$a$$$ with every element equal to $$$x$$$ replaced by $$$y$$$, and every element equal to $$$y$$$ replaced by $$$x$$$.For example, $$$G([1, 1, 2, 3, 5], 3, 1) = [3, 3, 2, 1, 5]$$$.An array $$$a$$$ is a parent of the array $$$b$$$ if:  either there exists a positive integer $$$k$$$ such that $$$F(a, k) = b$$$;  or there exist two different integers $$$x$$$ and $$$y$$$ such that $$$G(a, x, y) = b$$$. An array $$$a$$$ is an ancestor of the array $$$b$$$ if there exists a finite sequence of arrays $$$c_0, c_1, \dots, c_m$$$ ($$$m \ge 0$$$) such that $$$c_0$$$ is $$$a$$$, $$$c_m$$$ is $$$b$$$, and for every $$$i \in [1, m]$$$, $$$c_{i-1}$$$ is a parent of $$$c_i$$$.And now, the problem itself.You are given two integers $$$n$$$ and $$$k$$$. Your goal is to construct a sequence of arrays $$$s_1, s_2, \dots, s_m$$$ in such a way that:  every array $$$s_i$$$ contains exactly $$$n$$$ elements, and all elements are integers from $$$1$$$ to $$$k$$$;  for every array $$$a$$$ consisting of exactly $$$n$$$ integers from $$$1$$$ to $$$k$$$, the sequence contains at least one array $$$s_i$$$ such that $$$s_i$$$ is an ancestor of $$$a$$$. Print the minimum number of arrays in such sequence.

Print one integer — the minimum number of elements in a sequence of arrays meeting the constraints. Since the answer can be large, output it modulo $$$998244353$$$.

The only line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 2 \cdot 10^5$$$).

Input: 3 2

Output: 2

Output: 2

Output: 2

Input: 4 10

Output: 12

Output: 12

Output: 12

Input: 13 37

Output: 27643508

Output: 27643508

Output: 27643508

Input: 1337 42

Output: 211887828

Output: 211887828

Output: 211887828

Input: 198756 123456

Output: 159489391

Output: 159489391

Output: 159489391

Input: 123456 198756

Output: 460526614

Output: 460526614

Output: 460526614

Input: 200000 199999

Output: 271480816

Output: 271480816

Output: 271480816

Input: 200000 200000

Output: 271480817

Output: 271480817

Output: 271480817

Input: 199999 200000

Output: 873716273

Output: 873716273

Output: 873716273

Input: 1 1

Output: 1

Output: 1

Output: 1

Input: 1 5

Output: 1

Output: 1

Output: 1

Input: 1 200000

Output: 1

Output: 1

Output: 1

Input: 5 1

Output: 1

Output: 1

Output: 1

Input: 200000 1

Output: 1

Output: 1

Output: 1

Input: 199999 199999

Output: 873716273

Output: 873716273

Output: 873716273

Input: 198654 189954

Output: 75960792

Output: 75960792

Output: 75960792

Input: 199562 200000

Output: 261864171

Output: 261864171

Output: 261864171


You have a rectangular board of size $$$n\times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The $$$n$$$ rows are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the $$$m$$$ columns are numbered from $$$1$$$ to $$$m$$$ from left to right. The cell at the intersection of row $$$i$$$ and column $$$j$$$ contains the number $$$i^j$$$ ($$$i$$$ raised to the power of $$$j$$$). For example, if $$$n=3$$$ and $$$m=3$$$ the board is as follows:  Find the number of distinct integers written on the board.

Print one integer, the number of distinct integers on the board.

NoteThe statement shows the board for the first test case. In this case there are $$$7$$$ distinct integers: $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$8$$$, $$$9$$$, and $$$27$$$.In the second test case, the board is as follows:  There are $$$5$$$ distinct numbers: $$$1$$$, $$$2$$$, $$$4$$$, $$$8$$$ and $$$16$$$.In the third test case, the board is as follows:  There are $$$6$$$ distinct numbers: $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$9$$$ and $$$16$$$.

The only line contains two integers $$$n$$$ and $$$m$$$ ($$$1\le n,m\le 10^6$$$) — the number of rows and columns of the board.

Input: 3 3

Output: 7

Output: 7

Output: 7

Output: 7

Output: 7

Output: 7

Output: 7

Input: 2 4

Output: 5

Output: 5

Output: 5

Output: 5

Output: 5

Output: 5

Output: 5

Input: 4 2

Output: 6

Output: 6

Output: 6

Output: 6

Output: 6

Output: 6

Output: 6

Input: 1000000 1000000

Output: 999439867182

Output: 999439867182

Output: 999439867182

Output: 999439867182

Output: 999439867182

Output: 999439867182

Output: 999439867182

Input: 1000000 999999

Output: 999438868220

Output: 999438868220

Output: 999438868220

Output: 999438868220

Output: 999438868220

Output: 999438868220

Output: 999438868220

Input: 1000000 20

Output: 19988861

Output: 19988861

Output: 19988861

Output: 19988861

Output: 19988861

Output: 19988861

Output: 19988861

Input: 1000000 19

Output: 18989892

Output: 18989892

Output: 18989892

Output: 18989892

Output: 18989892

Output: 18989892

Output: 18989892

Input: 1000000 4

Output: 3997789

Output: 3997789

Output: 3997789

Output: 3997789

Output: 3997789

Output: 3997789

Output: 3997789

Input: 1000000 3

Output: 2998810

Output: 2998810

Output: 2998810

Output: 2998810

Output: 2998810

Output: 2998810

Output: 2998810

Input: 1000000 2

Output: 1999000

Output: 1999000

Output: 1999000

Output: 1999000

Output: 1999000

Output: 1999000

Output: 1999000

Input: 1000000 1

Output: 1000000

Output: 1000000

Output: 1000000

Output: 1000000

Output: 1000000

Output: 1000000

Output: 1000000

Input: 1000000 997763

Output: 997204120850

Output: 997204120850

Output: 997204120850

Output: 997204120850

Output: 997204120850

Output: 997204120850

Output: 997204120850

Input: 1 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 1 2

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 1 3

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 2 1

Output: 2

Output: 2

Output: 2

Output: 2

Output: 2

Output: 2

Output: 2

Input: 2 2

Output: 3

Output: 3

Output: 3

Output: 3

Output: 3

Output: 3

Output: 3

Input: 2 3

Output: 4

Output: 4

Output: 4

Output: 4

Output: 4

Output: 4

Output: 4

Input: 3 1

Output: 3

Output: 3

Output: 3

Output: 3

Output: 3

Output: 3

Output: 3

Input: 3 2

Output: 5

Output: 5

Output: 5

Output: 5

Output: 5

Output: 5

Output: 5

Input: 999999 1000000

Output: 999439500515

Output: 999439500515

Output: 999439500515

Output: 999439500515

Output: 999439500515

Output: 999439500515

Output: 999439500515

Input: 999999 999999

Output: 999438501554

Output: 999438501554

Output: 999438501554

Output: 999438501554

Output: 999438501554

Output: 999438501554

Output: 999438501554

Input: 999999 20

Output: 19988853

Output: 19988853

Output: 19988853

Output: 19988853

Output: 19988853

Output: 19988853

Output: 19988853

Input: 999999 19

Output: 18989885

Output: 18989885

Output: 18989885

Output: 18989885

Output: 18989885

Output: 18989885

Output: 18989885

Input: 999999 4

Output: 3997787

Output: 3997787

Output: 3997787

Output: 3997787

Output: 3997787

Output: 3997787

Output: 3997787

Input: 999999 3

Output: 2998809

Output: 2998809

Output: 2998809

Output: 2998809

Output: 2998809

Output: 2998809

Output: 2998809

Input: 999999 2

Output: 1998999

Output: 1998999

Output: 1998999

Output: 1998999

Output: 1998999

Output: 1998999

Output: 1998999

Input: 999999 1

Output: 999999

Output: 999999

Output: 999999

Output: 999999

Output: 999999

Output: 999999

Output: 999999

Input: 999999 999880

Output: 999319567827

Output: 999319567827

Output: 999319567827

Output: 999319567827

Output: 999319567827

Output: 999319567827

Output: 999319567827

Input: 998001 1000000

Output: 997441500515

Output: 997441500515

Output: 997441500515

Output: 997441500515

Output: 997441500515

Output: 997441500515

Output: 997441500515

Input: 998001 999999

Output: 997440503552

Output: 997440503552

Output: 997440503552

Output: 997440503552

Output: 997440503552

Output: 997440503552

Output: 997440503552

Input: 998001 20

Output: 19948893

Output: 19948893

Output: 19948893

Output: 19948893

Output: 19948893

Output: 19948893

Output: 19948893

Input: 998001 19

Output: 18951923

Output: 18951923

Output: 18951923

Output: 18951923

Output: 18951923

Output: 18951923

Output: 18951923

Input: 998001 4

Output: 3989795

Output: 3989795

Output: 3989795

Output: 3989795

Output: 3989795

Output: 3989795

Output: 3989795

Input: 998001 3

Output: 2992815

Output: 2992815

Output: 2992815

Output: 2992815

Output: 2992815

Output: 2992815

Output: 2992815

Input: 998001 2

Output: 1995003

Output: 1995003

Output: 1995003

Output: 1995003

Output: 1995003

Output: 1995003

Output: 1995003

Input: 998001 1

Output: 998001

Output: 998001

Output: 998001

Output: 998001

Output: 998001

Output: 998001

Output: 998001

Input: 998001 994254

Output: 991710201741

Output: 991710201741

Output: 991710201741

Output: 991710201741

Output: 991710201741

Output: 991710201741

Output: 991710201741

Input: 4 1000000

Output: 2500001

Output: 2500001

Output: 2500001

Output: 2500001

Output: 2500001

Output: 2500001

Output: 2500001

Input: 4 999999

Output: 2499999

Output: 2499999

Output: 2499999

Output: 2499999

Output: 2499999

Output: 2499999

Output: 2499999

Input: 4 20

Output: 51

Output: 51

Output: 51

Output: 51

Output: 51

Output: 51

Output: 51

Input: 4 19

Output: 49

Output: 49

Output: 49

Output: 49

Output: 49

Output: 49

Output: 49

Input: 4 4

Output: 11

Output: 11

Output: 11

Output: 11

Output: 11

Output: 11

Output: 11

Input: 4 3

Output: 9

Output: 9

Output: 9

Output: 9

Output: 9

Output: 9

Output: 9

Input: 4 1

Output: 4

Output: 4

Output: 4

Output: 4

Output: 4

Output: 4

Output: 4

Input: 4 997339

Output: 2493349

Output: 2493349

Output: 2493349

Output: 2493349

Output: 2493349

Output: 2493349

Output: 2493349

Input: 3 1000000

Output: 2000001

Output: 2000001

Output: 2000001

Output: 2000001

Output: 2000001

Output: 2000001

Output: 2000001

Input: 3 999999

Output: 1999999

Output: 1999999

Output: 1999999

Output: 1999999

Output: 1999999

Output: 1999999

Output: 1999999

Input: 3 20

Output: 41

Output: 41

Output: 41

Output: 41

Output: 41

Output: 41

Output: 41

Input: 3 19

Output: 39

Output: 39

Output: 39

Output: 39

Output: 39

Output: 39

Output: 39

Input: 3 4

Output: 9

Output: 9

Output: 9

Output: 9

Output: 9

Output: 9

Output: 9

Input: 3 991812

Output: 1983625

Output: 1983625

Output: 1983625

Output: 1983625

Output: 1983625

Output: 1983625

Output: 1983625

Input: 2 1000000

Output: 1000001

Output: 1000001

Output: 1000001

Output: 1000001

Output: 1000001

Output: 1000001

Output: 1000001

Input: 2 999999

Output: 1000000

Output: 1000000

Output: 1000000

Output: 1000000

Output: 1000000

Output: 1000000

Output: 1000000

Input: 2 20

Output: 21

Output: 21

Output: 21

Output: 21

Output: 21

Output: 21

Output: 21

Input: 2 19

Output: 20

Output: 20

Output: 20

Output: 20

Output: 20

Output: 20

Output: 20

Input: 2 994127

Output: 994128

Output: 994128

Output: 994128

Output: 994128

Output: 994128

Output: 994128

Output: 994128

Input: 1 1000000

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 1 999999

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 1 20

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 1 19

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 1 4

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 1 998600

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 64 44

Output: 2547

Output: 2547

Output: 2547

Output: 2547

Output: 2547

Output: 2547

Output: 2547

Input: 73 313

Output: 20914

Output: 20914

Output: 20914

Output: 20914

Output: 20914

Output: 20914

Output: 20914

Input: 95 3809

Output: 336023

Output: 336023

Output: 336023

Output: 336023

Output: 336023

Output: 336023

Output: 336023

Input: 81 41687

Output: 3093877

Output: 3093877

Output: 3093877

Output: 3093877

Output: 3093877

Output: 3093877

Output: 3093877

Input: 55 623754

Output: 30834243

Output: 30834243

Output: 30834243

Output: 30834243

Output: 30834243

Output: 30834243

Output: 30834243

Input: 889 45

Output: 39109

Output: 39109

Output: 39109

Output: 39109

Output: 39109

Output: 39109

Output: 39109

Input: 890 391

Output: 340121

Output: 340121

Output: 340121

Output: 340121

Output: 340121

Output: 340121

Output: 340121

Input: 229 8937

Output: 1945996

Output: 1945996

Output: 1945996

Output: 1945996

Output: 1945996

Output: 1945996

Output: 1945996

Input: 469 89548

Output: 40621001

Output: 40621001

Output: 40621001

Output: 40621001

Output: 40621001

Output: 40621001

Output: 40621001

Input: 107 344838

Output: 34386098

Output: 34386098

Output: 34386098

Output: 34386098

Output: 34386098

Output: 34386098

Output: 34386098

Input: 5724 46

Output: 261075

Output: 261075

Output: 261075

Output: 261075

Output: 261075

Output: 261075

Output: 261075

Input: 2926 953

Output: 2753815

Output: 2753815

Output: 2753815

Output: 2753815

Output: 2753815

Output: 2753815

Output: 2753815

Input: 4475 7897

Output: 34994821

Output: 34994821

Output: 34994821

Output: 34994821

Output: 34994821

Output: 34994821

Output: 34994821

Input: 9801 65596

Output: 638730094

Output: 638730094

Output: 638730094

Output: 638730094

Output: 638730094

Output: 638730094

Output: 638730094

Input: 9113 354453

Output: 3208449379

Output: 3208449379

Output: 3208449379

Output: 3208449379

Output: 3208449379

Output: 3208449379

Output: 3208449379

Input: 58891 23

Output: 1351315

Output: 1351315

Output: 1351315

Output: 1351315

Output: 1351315

Output: 1351315

Output: 1351315

Input: 78683 541

Output: 42477810

Output: 42477810

Output: 42477810

Output: 42477810

Output: 42477810

Output: 42477810

Output: 42477810

Input: 31411 5095

Output: 159487079

Output: 159487079

Output: 159487079

Output: 159487079

Output: 159487079

Output: 159487079

Output: 159487079

Input: 41911 91438

Output: 3820959092

Output: 3820959092

Output: 3820959092

Output: 3820959092

Output: 3820959092

Output: 3820959092

Output: 3820959092

Input: 34356 728700

Output: 24952884366

Output: 24952884366

Output: 24952884366

Output: 24952884366

Output: 24952884366

Output: 24952884366

Output: 24952884366

Input: 432781 33

Output: 14269698

Output: 14269698

Output: 14269698

Output: 14269698

Output: 14269698

Output: 14269698

Output: 14269698

Input: 132885 445

Output: 59039084

Output: 59039084

Output: 59039084

Output: 59039084

Output: 59039084

Output: 59039084

Output: 59039084

Input: 751454 3478

Output: 2611861896

Output: 2611861896

Output: 2611861896

Output: 2611861896

Output: 2611861896

Output: 2611861896

Output: 2611861896

Input: 821285 52879

Output: 43401791118

Output: 43401791118

Output: 43401791118

Output: 43401791118

Output: 43401791118

Output: 43401791118

Output: 43401791118

Input: 393768 295587

Output: 116286732011

Output: 116286732011

Output: 116286732011

Output: 116286732011

Output: 116286732011

Output: 116286732011

Output: 116286732011

Input: 8 1000000

Output: 6000001

Output: 6000001

Output: 6000001

Output: 6000001

Output: 6000001

Output: 6000001

Output: 6000001

Input: 8 999856

Output: 5999137

Output: 5999137

Output: 5999137

Output: 5999137

Output: 5999137

Output: 5999137

Output: 5999137

Input: 16 1000000

Output: 12916667

Output: 12916667

Output: 12916667

Output: 12916667

Output: 12916667

Output: 12916667

Output: 12916667

Input: 16 991512

Output: 12807031

Output: 12807031

Output: 12807031

Output: 12807031

Output: 12807031

Output: 12807031

Output: 12807031

Input: 32 1000000

Output: 27433333

Output: 27433333

Output: 27433333

Output: 27433333

Output: 27433333

Output: 27433333

Output: 27433333

Input: 32 991669

Output: 27204792

Output: 27204792

Output: 27204792

Output: 27204792

Output: 27204792

Output: 27204792

Output: 27204792

Input: 64 1000000

Output: 57800000

Output: 57800000

Output: 57800000

Output: 57800000

Output: 57800000

Output: 57800000

Output: 57800000

Input: 64 999341

Output: 57761915

Output: 57761915

Output: 57761915

Output: 57761915

Output: 57761915

Output: 57761915

Output: 57761915

Input: 128 1000000

Output: 119245238

Output: 119245238

Output: 119245238

Output: 119245238

Output: 119245238

Output: 119245238

Output: 119245238

Input: 128 990812

Output: 118149618

Output: 118149618

Output: 118149618

Output: 118149618

Output: 118149618

Output: 118149618

Output: 118149618

Input: 256 1000000

Output: 243622617

Output: 243622617

Output: 243622617

Output: 243622617

Output: 243622617

Output: 243622617

Output: 243622617

Input: 256 991306

Output: 241504564

Output: 241504564

Output: 241504564

Output: 241504564

Output: 241504564

Output: 241504564

Output: 241504564

Input: 512 1000000

Output: 495538093

Output: 495538093

Output: 495538093

Output: 495538093

Output: 495538093

Output: 495538093

Output: 495538093

Input: 512 997393

Output: 494246243

Output: 494246243

Output: 494246243

Output: 494246243

Output: 494246243

Output: 494246243

Output: 494246243

Input: 1024 1000000

Output: 1001676982

Output: 1001676982

Output: 1001676982

Output: 1001676982

Output: 1001676982

Output: 1001676982

Output: 1001676982

Input: 1024 992311

Output: 993975114

Output: 993975114

Output: 993975114

Output: 993975114

Output: 993975114

Output: 993975114

Output: 993975114

Input: 2048 1000000

Output: 2017642710

Output: 2017642710

Output: 2017642710

Output: 2017642710

Output: 2017642710

Output: 2017642710

Output: 2017642710

Input: 2048 991392

Output: 2000274849

Output: 2000274849

Output: 2000274849

Output: 2000274849

Output: 2000274849

Output: 2000274849

Output: 2000274849

Input: 4096 1000000

Output: 4053402231

Output: 4053402231

Output: 4053402231

Output: 4053402231

Output: 4053402231

Output: 4053402231

Output: 4053402231

Input: 4096 991653

Output: 4019568518

Output: 4019568518

Output: 4019568518

Output: 4019568518

Output: 4019568518

Output: 4019568518

Output: 4019568518

Input: 8192 1000000

Output: 8133332917

Output: 8133332917

Output: 8133332917

Output: 8133332917

Output: 8133332917

Output: 8133332917

Output: 8133332917

Input: 8192 997739

Output: 8114943520

Output: 8114943520

Output: 8114943520

Output: 8114943520

Output: 8114943520

Output: 8114943520

Output: 8114943520

Input: 16384 1000000

Output: 16303881737

Output: 16303881737

Output: 16303881737

Output: 16303881737

Output: 16303881737

Output: 16303881737

Output: 16303881737

Input: 16384 999572

Output: 16296903709

Output: 16296903709

Output: 16296903709

Output: 16296903709

Output: 16296903709

Output: 16296903709

Output: 16296903709

Input: 32768 1000000

Output: 32657014078

Output: 32657014078

Output: 32657014078

Output: 32657014078

Output: 32657014078

Output: 32657014078

Output: 32657014078

Input: 32768 999663

Output: 32646008758

Output: 32646008758

Output: 32646008758

Output: 32646008758

Output: 32646008758

Output: 32646008758

Output: 32646008758

Input: 65536 1000000

Output: 65383397506

Output: 65383397506

Output: 65383397506

Output: 65383397506

Output: 65383397506

Output: 65383397506

Output: 65383397506

Input: 65536 998454

Output: 65282314806

Output: 65282314806

Output: 65282314806

Output: 65282314806

Output: 65282314806

Output: 65282314806

Output: 65282314806

Input: 131072 1000000

Output: 130860123875

Output: 130860123875

Output: 130860123875

Output: 130860123875

Output: 130860123875

Output: 130860123875

Output: 130860123875

Input: 131072 990328

Output: 129594444777

Output: 129594444777

Output: 129594444777

Output: 129594444777

Output: 129594444777

Output: 129594444777

Output: 129594444777

Input: 262144 1000000

Output: 261848753430

Output: 261848753430

Output: 261848753430

Output: 261848753430

Output: 261848753430

Output: 261848753430

Output: 261848753430

Input: 262144 991098

Output: 259517775897

Output: 259517775897

Output: 259517775897

Output: 259517775897

Output: 259517775897

Output: 259517775897

Output: 259517775897

Input: 524288 1000000

Output: 523876974330

Output: 523876974330

Output: 523876974330

Output: 523876974330

Output: 523876974330

Output: 523876974330

Output: 523876974330

Input: 524288 995897

Output: 521727507546

Output: 521727507546

Output: 521727507546

Output: 521727507546

Output: 521727507546

Output: 521727507546

Output: 521727507546

Input: 9 1000000

Output: 6500001

Output: 6500001

Output: 6500001

Output: 6500001

Output: 6500001

Output: 6500001

Output: 6500001

Input: 9 997540

Output: 6484011

Output: 6484011

Output: 6484011

Output: 6484011

Output: 6484011

Output: 6484011

Output: 6484011

Input: 27 1000000

Output: 22916667

Output: 22916667

Output: 22916667

Output: 22916667

Output: 22916667

Output: 22916667

Output: 22916667

Input: 27 992281

Output: 22739777

Output: 22739777

Output: 22739777

Output: 22739777

Output: 22739777

Output: 22739777

Output: 22739777

Input: 81 1000000

Output: 74216666

Output: 74216666

Output: 74216666

Output: 74216666

Output: 74216666

Output: 74216666

Output: 74216666

Input: 81 990221

Output: 73490907

Output: 73490907

Output: 73490907

Output: 73490907

Output: 73490907

Output: 73490907

Output: 73490907

Input: 243 1000000

Output: 231261904

Output: 231261904

Output: 231261904

Output: 231261904

Output: 231261904

Output: 231261904

Output: 231261904

Input: 243 998333

Output: 230876402

Output: 230876402

Output: 230876402

Output: 230876402

Output: 230876402

Output: 230876402

Output: 230876402

Input: 729 1000000

Output: 709821426

Output: 709821426

Output: 709821426

Output: 709821426

Output: 709821426

Output: 709821426

Output: 709821426

Input: 729 990999

Output: 703432332

Output: 703432332

Output: 703432332

Output: 703432332

Output: 703432332

Output: 703432332

Output: 703432332

Input: 2187 1000000

Output: 2155671282

Output: 2155671282

Output: 2155671282

Output: 2155671282

Output: 2155671282

Output: 2155671282

Output: 2155671282

Input: 2187 998439

Output: 2152306290

Output: 2152306290

Output: 2152306290

Output: 2152306290

Output: 2152306290

Output: 2152306290

Output: 2152306290

Input: 6561 1000000

Output: 6508762944

Output: 6508762944

Output: 6508762944

Output: 6508762944

Output: 6508762944

Output: 6508762944

Output: 6508762944

Input: 6561 997683

Output: 6493682186

Output: 6493682186

Output: 6493682186

Output: 6493682186

Output: 6493682186

Output: 6493682186

Output: 6493682186

Input: 19683 1000000

Output: 19595313879

Output: 19595313879

Output: 19595313879

Output: 19595313879

Output: 19595313879

Output: 19595313879

Output: 19595313879

Input: 19683 995484

Output: 19506821474

Output: 19506821474

Output: 19506821474

Output: 19506821474

Output: 19506821474

Output: 19506821474

Output: 19506821474

Input: 59049 1000000

Output: 58904069633

Output: 58904069633

Output: 58904069633

Output: 58904069633

Output: 58904069633

Output: 58904069633

Output: 58904069633

Input: 59049 990384

Output: 58337648127

Output: 58337648127

Output: 58337648127

Output: 58337648127

Output: 58337648127

Output: 58337648127

Output: 58337648127

Input: 177147 1000000

Output: 176902106269

Output: 176902106269

Output: 176902106269

Output: 176902106269

Output: 176902106269

Output: 176902106269

Output: 176902106269

Input: 177147 993862

Output: 175816281180

Output: 175816281180

Output: 175816281180

Output: 175816281180

Output: 175816281180

Output: 175816281180

Output: 175816281180

Input: 531441 1000000

Output: 531027271947

Output: 531027271947

Output: 531027271947

Output: 531027271947

Output: 531027271947

Output: 531027271947

Output: 531027271947

Input: 531441 999874

Output: 530960362592

Output: 530960362592

Output: 530960362592

Output: 530960362592

Output: 530960362592

Output: 530960362592

Output: 530960362592


Consider a playoff tournament where $$$2^n$$$ athletes compete. The athletes are numbered from $$$1$$$ to $$$2^n$$$.The tournament is held in $$$n$$$ stages. In each stage, the athletes are split into pairs in such a way that each athlete belongs exactly to one pair. In each pair, the athletes compete against each other, and exactly one of them wins. The winner of each pair advances to the next stage, the athlete who was defeated gets eliminated from the tournament.The pairs are formed as follows:  in the first stage, athlete $$$1$$$ competes against athlete $$$2$$$; $$$3$$$ competes against $$$4$$$; $$$5$$$ competes against $$$6$$$, and so on;  in the second stage, the winner of the match "$$$1$$$–$$$2$$$" competes against the winner of the match "$$$3$$$–$$$4$$$"; the winner of the match "$$$5$$$–$$$6$$$" competes against the winner of the match "$$$7$$$–$$$8$$$", and so on;  the next stages are held according to the same rules. When athletes $$$x$$$ and $$$y$$$ compete, the winner is decided as follows:  if $$$x+y$$$ is odd, the athlete with the lower index wins (i. e. if $$$x < y$$$, then $$$x$$$ wins, otherwise $$$y$$$ wins);  if $$$x+y$$$ is even, the athlete with the higher index wins. The following picture describes the way the tournament with $$$n = 3$$$ goes.  Your task is the following one: given the integer $$$n$$$, determine the index of the athlete who wins the tournament.

For each test case, print one integer — the index of the winner of the tournament.

NoteThe case $$$n = 3$$$ is shown in the picture from the statement.If $$$n = 1$$$, then there's only one match between athletes $$$1$$$ and $$$2$$$. Since $$$1 + 2 = 3$$$ is an odd number, the athlete with the lower index wins. So, the athlete $$$1$$$ is the winner.

The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Each test case consists of one line containing one integer $$$n$$$ ($$$1 \le n \le 30$$$).

Input:
2
3
1

Output:
7
1

Output:
7
1

Output:
7

1

Output:
7
1

Output:
7
1

Output:
7
1

Output:
7
1

Output: 7	1

Output:
7
1

Output:
7

1

Output: 7 1

Output:
7
1

Output:
7
1

Input:
30
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

Output:
1
3
7
15
31
63
127
255
511
1023
2047
4095
8191
16383
32767
65535
131071
262143
524287
1048575
2097151
4194303
8388607
16777215
33554431
67108863
134217727
268435455
536870911
1073741823

Output:
1
3
7
15
31
63
127
255
511
1023
2047
4095
8191
16383
32767
65535
131071
262143
524287
1048575
2097151
4194303
8388607
16777215
33554431
67108863
134217727
268435455
536870911
1073741823

Output:
1
3
7
15
31
63
127
255
511
1023
2047
4095
8191
16383
32767
65535
131071
262143
524287
1048575
2097151
4194303
8388607
16777215
33554431
67108863
134217727
268435455
536870911
1073741823

Output:
1
3
7
15
31
63
127
255
511
1023
2047
4095
8191
16383
32767
65535
131071
262143
524287
1048575
2097151
4194303
8388607
16777215
33554431
67108863
134217727
268435455
536870911
1073741823

Output:
1
3
7
15
31
63
127
255
511
1023
2047
4095
8191
16383
32767
65535
131071
262143
524287
1048575
2097151
4194303
8388607
16777215
33554431
67108863
134217727
268435455
536870911
1073741823

Output:
1
3
7
15
31
63
127
255
511
1023
2047
4095
8191
16383
32767
65535
131071
262143
524287
1048575
2097151
4194303
8388607
16777215
33554431
67108863
134217727
268435455
536870911
1073741823

Output:
1
3
7
15
31
63
127
255
511
1023
2047
4095
8191
16383
32767
65535
131071
262143
524287
1048575
2097151
4194303
8388607
16777215
33554431
67108863
134217727
268435455
536870911
1073741823

Output:
1
3
7
15
31
63
127
255
511
1023
2047
4095
8191
16383
32767
65535
131071
262143
524287
1048575
2097151
4194303
8388607
16777215
33554431
67108863
134217727
268435455
536870911
1073741823

Output: 1 3 7 15 31 63 127 255 511 1023 2047 4095 8191 16383 32767 65535 131071 262143 524287 1048575 2097151 4194303 8388607 16777215 33554431 67108863 134217727 268435455 536870911 1073741823

Output:
1
3
7
15
31
63
127
255
511
1023
2047
4095
8191
16383
32767
65535
131071
262143
524287
1048575
2097151
4194303
8388607
16777215
33554431
67108863
134217727
268435455
536870911
1073741823

Input:
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30
30

Output:
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823

Output: 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823

Output:
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823

Output:
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823

Output:
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823

Output:
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823

Output:
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823

Output:
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823

Output:
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823

Output:
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823
1073741823

Input:
9
2
2
2
2
2
2
2
2
2

Output:
3
3
3
3
3
3
3
3
3

Output:
3
3
3
3
3
3
3
3
3

Output:
3
3
3
3
3
3
3
3
3

Output: 3 3 3 3 3 3 3 3 3

Output:
3
3
3
3
3
3
3
3
3

Output:
3
3
3
3
3
3
3
3
3

Output:
3
3
3
3
3
3
3
3
3

Output:
3
3
3
3
3
3
3
3
3

Output:
3
3
3
3
3
3
3
3
3

Output:
3
3
3
3
3
3
3
3
3


In this problem, we will consider complete undirected graphs consisting of $$$n$$$ vertices with weighted edges. The weight of each edge is an integer from $$$1$$$ to $$$k$$$.An undirected graph is considered beautiful if the sum of weights of all edges incident to vertex $$$1$$$ is equal to the weight of MST in the graph. MST is the minimum spanning tree — a tree consisting of $$$n-1$$$ edges of the graph, which connects all $$$n$$$ vertices and has the minimum sum of weights among all such trees; the weight of MST is the sum of weights of all edges in it.Calculate the number of complete beautiful graphs having exactly $$$n$$$ vertices and the weights of edges from $$$1$$$ to $$$k$$$. Since the answer might be large, print it modulo $$$998244353$$$.

Print one integer — the number of complete beautiful graphs having exactly $$$n$$$ vertices and the weights of edges from $$$1$$$ to $$$k$$$. Since the answer might be large, print it modulo $$$998244353$$$.

The only line contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 250$$$; $$$1 \le k \le 250$$$).

Input: 3 2

Output: 5

Output: 5

Output: 5

Output: 5

Output: 5

Input: 4 4

Output: 571

Output: 571

Output: 571

Output: 571

Output: 571

Input: 6 9

Output: 310640163

Output: 310640163

Output: 310640163

Output: 310640163

Output: 310640163

Input: 42 13

Output: 136246935

Output: 136246935

Output: 136246935

Output: 136246935

Output: 136246935

Input: 100 100

Output: 396999832

Output: 396999832

Output: 396999832

Output: 396999832

Output: 396999832

Input: 200 200

Output: 695088803

Output: 695088803

Output: 695088803

Output: 695088803

Output: 695088803

Input: 250 250

Output: 625600394

Output: 625600394

Output: 625600394

Output: 625600394

Output: 625600394

Input: 249 250

Output: 338527968

Output: 338527968

Output: 338527968

Output: 338527968

Output: 338527968

Input: 250 249

Output: 111668628

Output: 111668628

Output: 111668628

Output: 111668628

Output: 111668628

Input: 2 250

Output: 250

Output: 250

Output: 250

Output: 250

Output: 250

Input: 250 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 250 2

Output: 794327741

Output: 794327741

Output: 794327741

Output: 794327741

Output: 794327741

Input: 2 78

Output: 78

Output: 78

Output: 78

Output: 78

Output: 78

Input: 2 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 2 2

Output: 2

Output: 2

Output: 2

Output: 2

Output: 2

Input: 2 3

Output: 3

Output: 3

Output: 3

Output: 3

Output: 3

Input: 2 4

Output: 4

Output: 4

Output: 4

Output: 4

Output: 4

Input: 2 5

Output: 5

Output: 5

Output: 5

Output: 5

Output: 5

Input: 2 6

Output: 6

Output: 6

Output: 6

Output: 6

Output: 6

Input: 2 7

Output: 7

Output: 7

Output: 7

Output: 7

Output: 7

Input: 2 8

Output: 8

Output: 8

Output: 8

Output: 8

Output: 8

Input: 2 9

Output: 9

Output: 9

Output: 9

Output: 9

Output: 9

Input: 2 10

Output: 10

Output: 10

Output: 10

Output: 10

Output: 10

Input: 2 11

Output: 11

Output: 11

Output: 11

Output: 11

Output: 11

Input: 2 12

Output: 12

Output: 12

Output: 12

Output: 12

Output: 12

Input: 2 13

Output: 13

Output: 13

Output: 13

Output: 13

Output: 13

Input: 2 14

Output: 14

Output: 14

Output: 14

Output: 14

Output: 14

Input: 2 15

Output: 15

Output: 15

Output: 15

Output: 15

Output: 15

Input: 2 16

Output: 16

Output: 16

Output: 16

Output: 16

Output: 16

Input: 2 17

Output: 17

Output: 17

Output: 17

Output: 17

Output: 17

Input: 2 18

Output: 18

Output: 18

Output: 18

Output: 18

Output: 18

Input: 2 19

Output: 19

Output: 19

Output: 19

Output: 19

Output: 19

Input: 2 20

Output: 20

Output: 20

Output: 20

Output: 20

Output: 20

Input: 2 21

Output: 21

Output: 21

Output: 21

Output: 21

Output: 21

Input: 2 22

Output: 22

Output: 22

Output: 22

Output: 22

Output: 22

Input: 2 23

Output: 23

Output: 23

Output: 23

Output: 23

Output: 23

Input: 2 24

Output: 24

Output: 24

Output: 24

Output: 24

Output: 24

Input: 2 25

Output: 25

Output: 25

Output: 25

Output: 25

Output: 25

Input: 2 26

Output: 26

Output: 26

Output: 26

Output: 26

Output: 26

Input: 2 27

Output: 27

Output: 27

Output: 27

Output: 27

Output: 27

Input: 2 28

Output: 28

Output: 28

Output: 28

Output: 28

Output: 28

Input: 2 29

Output: 29

Output: 29

Output: 29

Output: 29

Output: 29

Input: 2 30

Output: 30

Output: 30

Output: 30

Output: 30

Output: 30

Input: 2 31

Output: 31

Output: 31

Output: 31

Output: 31

Output: 31

Input: 2 32

Output: 32

Output: 32

Output: 32

Output: 32

Output: 32

Input: 2 33

Output: 33

Output: 33

Output: 33

Output: 33

Output: 33

Input: 2 34

Output: 34

Output: 34

Output: 34

Output: 34

Output: 34

Input: 2 35

Output: 35

Output: 35

Output: 35

Output: 35

Output: 35

Input: 2 36

Output: 36

Output: 36

Output: 36

Output: 36

Output: 36

Input: 2 37

Output: 37

Output: 37

Output: 37

Output: 37

Output: 37

Input: 2 38

Output: 38

Output: 38

Output: 38

Output: 38

Output: 38

Input: 2 39

Output: 39

Output: 39

Output: 39

Output: 39

Output: 39

Input: 2 40

Output: 40

Output: 40

Output: 40

Output: 40

Output: 40

Input: 2 41

Output: 41

Output: 41

Output: 41

Output: 41

Output: 41

Input: 2 42

Output: 42

Output: 42

Output: 42

Output: 42

Output: 42

Input: 2 43

Output: 43

Output: 43

Output: 43

Output: 43

Output: 43

Input: 2 44

Output: 44

Output: 44

Output: 44

Output: 44

Output: 44

Input: 2 45

Output: 45

Output: 45

Output: 45

Output: 45

Output: 45

Input: 2 46

Output: 46

Output: 46

Output: 46

Output: 46

Output: 46

Input: 2 47

Output: 47

Output: 47

Output: 47

Output: 47

Output: 47

Input: 2 48

Output: 48

Output: 48

Output: 48

Output: 48

Output: 48

Input: 2 49

Output: 49

Output: 49

Output: 49

Output: 49

Output: 49

Input: 2 50

Output: 50

Output: 50

Output: 50

Output: 50

Output: 50

Input: 2 51

Output: 51

Output: 51

Output: 51

Output: 51

Output: 51

Input: 2 52

Output: 52

Output: 52

Output: 52

Output: 52

Output: 52

Input: 2 53

Output: 53

Output: 53

Output: 53

Output: 53

Output: 53

Input: 2 54

Output: 54

Output: 54

Output: 54

Output: 54

Output: 54

Input: 2 55

Output: 55

Output: 55

Output: 55

Output: 55

Output: 55

Input: 2 56

Output: 56

Output: 56

Output: 56

Output: 56

Output: 56

Input: 2 57

Output: 57

Output: 57

Output: 57

Output: 57

Output: 57

Input: 2 58

Output: 58

Output: 58

Output: 58

Output: 58

Output: 58

Input: 2 59

Output: 59

Output: 59

Output: 59

Output: 59

Output: 59

Input: 2 60

Output: 60

Output: 60

Output: 60

Output: 60

Output: 60

Input: 2 61

Output: 61

Output: 61

Output: 61

Output: 61

Output: 61

Input: 2 62

Output: 62

Output: 62

Output: 62

Output: 62

Output: 62

Input: 2 63

Output: 63

Output: 63

Output: 63

Output: 63

Output: 63

Input: 2 64

Output: 64

Output: 64

Output: 64

Output: 64

Output: 64

Input: 2 65

Output: 65

Output: 65

Output: 65

Output: 65

Output: 65

Input: 2 66

Output: 66

Output: 66

Output: 66

Output: 66

Output: 66

Input: 2 67

Output: 67

Output: 67

Output: 67

Output: 67

Output: 67

Input: 2 68

Output: 68

Output: 68

Output: 68

Output: 68

Output: 68

Input: 2 69

Output: 69

Output: 69

Output: 69

Output: 69

Output: 69

Input: 2 70

Output: 70

Output: 70

Output: 70

Output: 70

Output: 70

Input: 2 71

Output: 71

Output: 71

Output: 71

Output: 71

Output: 71

Input: 2 72

Output: 72

Output: 72

Output: 72

Output: 72

Output: 72

Input: 2 73

Output: 73

Output: 73

Output: 73

Output: 73

Output: 73

Input: 2 74

Output: 74

Output: 74

Output: 74

Output: 74

Output: 74

Input: 2 75

Output: 75

Output: 75

Output: 75

Output: 75

Output: 75

Input: 2 76

Output: 76

Output: 76

Output: 76

Output: 76

Output: 76

Input: 2 77

Output: 77

Output: 77

Output: 77

Output: 77

Output: 77


Consider an array $$$a$$$ of length $$$n$$$ with elements numbered from $$$1$$$ to $$$n$$$. It is possible to remove the $$$i$$$-th element of $$$a$$$ if $$$gcd(a_i, i) = 1$$$, where $$$gcd$$$ denotes the greatest common divisor. After an element is removed, the elements to the right are shifted to the left by one position.An array $$$b$$$ with $$$n$$$ integers such that $$$1 \le b_i \le n - i + 1$$$ is a removal sequence for the array $$$a$$$ if it is possible to remove all elements of $$$a$$$, if you remove the $$$b_1$$$-th element, then the $$$b_2$$$-th, ..., then the $$$b_n$$$-th element. For example, let $$$a = [42, 314]$$$:  $$$[1, 1]$$$ is a removal sequence: when you remove the $$$1$$$-st element of the array, the condition $$$gcd(42, 1) = 1$$$ holds, and the array becomes $$$[314]$$$; when you remove the $$$1$$$-st element again, the condition $$$gcd(314, 1) = 1$$$ holds, and the array becomes empty.  $$$[2, 1]$$$ is not a removal sequence: when you try to remove the $$$2$$$-nd element, the condition $$$gcd(314, 2) = 1$$$ is false. An array is ambiguous if it has at least two removal sequences. For example, the array $$$[1, 2, 5]$$$ is ambiguous: it has removal sequences $$$[3, 1, 1]$$$ and $$$[1, 2, 1]$$$. The array $$$[42, 314]$$$ is not ambiguous: the only removal sequence it has is $$$[1, 1]$$$.You are given two integers $$$n$$$ and $$$m$$$. You have to calculate the number of ambiguous arrays $$$a$$$ such that the length of $$$a$$$ is from $$$1$$$ to $$$n$$$ and each $$$a_i$$$ is an integer from $$$1$$$ to $$$m$$$.

Print one integer — the number of ambiguous arrays $$$a$$$ such that the length of $$$a$$$ is from $$$1$$$ to $$$n$$$ and each $$$a_i$$$ is an integer from $$$1$$$ to $$$m$$$. Since the answer can be very large, print it modulo $$$998244353$$$.

The only line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n \le 3 \cdot 10^5$$$; $$$1 \le m \le 10^{12}$$$).

Input: 2 3

Output: 6

Output: 6

Output: 6

Output: 6

Output: 6

Output: 6

Output: 6

Output: 6

Output: 6

Input: 4 2

Output: 26

Output: 26

Output: 26

Output: 26

Output: 26

Output: 26

Output: 26

Output: 26

Output: 26

Input: 4 6

Output: 1494

Output: 1494

Output: 1494

Output: 1494

Output: 1494

Output: 1494

Output: 1494

Output: 1494

Output: 1494

Input: 1337 424242424242

Output: 119112628

Output: 119112628

Output: 119112628

Output: 119112628

Output: 119112628

Output: 119112628

Output: 119112628

Output: 119112628

Output: 119112628

Input: 300000 1000000000

Output: 590856313

Output: 590856313

Output: 590856313

Output: 590856313

Output: 590856313

Output: 590856313

Output: 590856313

Output: 590856313

Output: 590856313

Input: 300000 1

Output: 299999

Output: 299999

Output: 299999

Output: 299999

Output: 299999

Output: 299999

Output: 299999

Output: 299999

Output: 299999

Input: 2 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 2 1000000000000

Output: 138131255

Output: 138131255

Output: 138131255

Output: 138131255

Output: 138131255

Output: 138131255

Output: 138131255

Output: 138131255

Output: 138131255

Input: 17957 2

Output: 653647969

Output: 653647969

Output: 653647969

Output: 653647969

Output: 653647969

Output: 653647969

Output: 653647969

Output: 653647969

Output: 653647969


Monocarp is playing a video game. In the game, he controls a spaceship and has to destroy an enemy spaceship.Monocarp has two lasers installed on his spaceship. Both lasers $$$1$$$ and $$$2$$$ have two values:   $$$p_i$$$ — the power of the laser;  $$$t_i$$$ — the reload time of the laser. When a laser is fully charged, Monocarp can either shoot it or wait for the other laser to charge and shoot both of them at the same time.An enemy spaceship has $$$h$$$ durability and $$$s$$$ shield capacity. When Monocarp shoots an enemy spaceship, it receives $$$(P - s)$$$ damage (i. e. $$$(P - s)$$$ gets subtracted from its durability), where $$$P$$$ is the total power of the lasers that Monocarp shoots (i. e. $$$p_i$$$ if he only shoots laser $$$i$$$ and $$$p_1 + p_2$$$ if he shoots both lasers at the same time). An enemy spaceship is considered destroyed when its durability becomes $$$0$$$ or lower.Initially, both lasers are zero charged.What's the lowest amount of time it can take Monocarp to destroy an enemy spaceship?

Print a single integer — the lowest amount of time it can take Monocarp to destroy an enemy spaceship.

NoteIn the first example, Monocarp waits for both lasers to charge, then shoots both lasers at $$$10$$$, they deal $$$(5 + 4 - 1) = 8$$$ damage. Then he waits again and shoots lasers at $$$20$$$, dealing $$$8$$$ more damage.In the second example, Monocarp doesn't wait for the second laser to charge. He just shoots the first laser $$$25$$$ times, dealing $$$(10 - 9) = 1$$$ damage each time.

The first line contains two integers $$$p_1$$$ and $$$t_1$$$ ($$$2 \le p_1 \le 5000$$$; $$$1 \le t_1 \le 10^{12}$$$) — the power and the reload time of the first laser. The second line contains two integers $$$p_2$$$ and $$$t_2$$$ ($$$2 \le p_2 \le 5000$$$; $$$1 \le t_2 \le 10^{12}$$$) — the power and the reload time of the second laser. The third line contains two integers $$$h$$$ and $$$s$$$ ($$$1 \le h \le 5000$$$; $$$1 \le s < \min(p_1, p_2)$$$) — the durability and the shield capacity of an enemy spaceship. Note that the last constraint implies that Monocarp will always be able to destroy an enemy spaceship.

Input:
5 10
4 9
16 1

Output: 20

Output: 20

Output: 20

Output: 20

Output: 20

Output: 20

Input:
10 1
5000 100000
25 9

Output: 25

Output: 25

Output: 25

Output: 25

Output: 25

Output: 25

Input:
4 2
5 20
5 3

Output: 10

Output: 10

Output: 10

Output: 10

Output: 10

Output: 10

Input:
2 15
2 19
23 1

Output: 152

Output: 152

Output: 152

Output: 152

Output: 152

Input:
3 19
4 29
11 2

Output: 67

Output: 67

Output: 67

Output: 67

Output: 67

Input:
2 49
2 21
21 1

Output: 259

Output: 259

Output: 259

Output: 259

Output: 259

Input:
3 9
3 13
25 1

Output: 63

Output: 63

Output: 63

Output: 63

Output: 63

Input:
4 12
2 17
12 1

Output: 36

Output: 36

Output: 36

Output: 36

Output: 36

Input:
4123 824182019519
1135 578639730525
816 156

Output: 578639730525

Output: 578639730525

Output: 578639730525

Output: 578639730525

Output: 578639730525

Input:
3041 779755568364
1724 743515616899
3785 317

Output: 779755568364

Output: 779755568364

Output: 779755568364

Output: 779755568364

Output: 779755568364

Input:
3420 735329117208
3800 953836213673
4858 402

Output: 953836213673

Output: 953836213673

Output: 953836213673

Output: 953836213673

Output: 953836213673

Input:
3799 727757441860
4388 155566875854
3635 1973

Output: 311133751708

Output: 311133751708

Output: 311133751708

Output: 311133751708

Output: 311133751708

Input:
2717 683330990705
1439 361592505332
3900 424

Output: 723185010664

Output: 723185010664

Output: 723185010664

Output: 723185010664

Output: 723185010664

Input:
4123 824182019519
1135 578639730525
4484 1134

Output: 1648364039038

Output: 1648364039038

Output: 1648364039038

Output: 1648364039038

Output: 1648364039038

Input:
3041 779755568364
1724 743515616899
3738 1723

Output: 1559511136728

Output: 1559511136728

Output: 1559511136728

Output: 1559511136728

Output: 1559511136728

Input:
3420 735329117208
3800 953836213673
3799 3419

Output: 953836213673

Output: 953836213673

Output: 953836213673

Output: 953836213673

Output: 953836213673

Input:
3799 727757441860
4388 155566875854
349 3798

Output: 155566875854

Output: 155566875854

Output: 155566875854

Output: 155566875854

Output: 155566875854

Input:
2717 683330990705
1439 361592505332
4602 1438

Output: 1366661981410

Output: 1366661981410

Output: 1366661981410

Output: 1366661981410

Output: 1366661981410

Input:
7 118163468459
18 636222762017
3471 1

Output: 44665791077502

Output: 44665791077502

Output: 44665791077502

Output: 44665791077502

Output: 44665791077502

Input:
42 69442050008
21 842248391495
3736 2

Output: 6249784500720

Output: 6249784500720

Output: 6249784500720

Output: 6249784500720

Output: 6249784500720

Input:
48 29310566148
15 43979053676
2513 12

Output: 1700012836584

Output: 1700012836584

Output: 1700012836584

Output: 1700012836584

Output: 1700012836584

Input:
7 118163468459
18 636222762017
2609 6

Output: 72529394869938

Output: 72529394869938

Output: 72529394869938

Output: 72529394869938

Output: 72529394869938

Input:
42 69442050008
21 842248391495
1862 20

Output: 5485921950632

Output: 5485921950632

Output: 5485921950632

Output: 5485921950632

Output: 5485921950632

Input:
48 29310566148
15 43979053676
1924 14

Output: 1377596608956

Output: 1377596608956

Output: 1377596608956

Output: 1377596608956

Output: 1377596608956

Input:
5 833664655648
2 250565002790
606 1

Output: 63358513829248

Output: 63358513829248

Output: 63358513829248

Output: 63358513829248

Output: 63358513829248

Input:
5 826092980300
3 456590632268
4383 2

Output: 572042123158656

Output: 572042123158656

Output: 572042123158656

Output: 572042123158656

Output: 572042123158656

Input:
5 781666529145
5 662616261745
4648 2

Output: 454148253433245

Output: 454148253433245

Output: 454148253433245

Output: 454148253433245

Output: 454148253433245

Input:
5 737240077989
2 827492148119
3425 1

Output: 472498016575949

Output: 472498016575949

Output: 472498016575949

Output: 472498016575949

Output: 472498016575949

Input:
5 692813626833
4 33517777597
4497 2

Output: 67404250747567

Output: 67404250747567

Output: 67404250747567

Output: 67404250747567

Output: 67404250747567

Input:
5 652682142974
2 235248439778
170 1

Output: 15208017967188

Output: 15208017967188

Output: 15208017967188

Output: 15208017967188

Output: 15208017967188

Input:
2 608255691818
3 441274069256
3947 1

Output: 580609364316764

Output: 580609364316764

Output: 580609364316764

Output: 580609364316764

Output: 580609364316764

Input:
2 600684016470
5 643004731437
20 1

Output: 2572018925748

Output: 2572018925748

Output: 2572018925748

Output: 2572018925748

Output: 2572018925748

Input:
2 556257565315
3 812175585107
2989 1

Output: 606995501620452

Output: 606995501620452

Output: 606995501620452

Output: 606995501620452

Output: 606995501620452

Input:
2 511831114159
4 13906247289
1765 1

Output: 8051717180331

Output: 8051717180331

Output: 8051717180331

Output: 8051717180331

Output: 8051717180331

Input:
5 833664655648
2 250565002790
2175 1

Output: 226756786336256

Output: 226756786336256

Output: 226756786336256

Output: 226756786336256

Output: 226756786336256

Input:
5 826092980300
3 456590632268
2236 2

Output: 291869651514576

Output: 291869651514576

Output: 291869651514576

Output: 291869651514576

Output: 291869651514576

Input:
5 781666529145
5 662616261745
1490 4

Output: 194634965757105

Output: 194634965757105

Output: 194634965757105

Output: 194634965757105

Output: 194634965757105

Input:
5 737240077989
2 827492148119
743 1

Output: 102609026366756

Output: 102609026366756

Output: 102609026366756

Output: 102609026366756

Output: 102609026366756

Input:
5 692813626833
4 33517777597
805 3

Output: 21809013512943

Output: 21809013512943

Output: 21809013512943

Output: 21809013512943

Output: 21809013512943

Input:
2 1000000000000
2 999999999999
2000 1

Output: 667000000000000

Output: 667000000000000

Output: 667000000000000

Output: 667000000000000

Output: 667000000000000

Input:
2 1000000000000
2 1000000000000
2000 1

Output: 667000000000000

Output: 667000000000000

Output: 667000000000000

Output: 667000000000000

Output: 667000000000000

Input:
2 1000000000000
2 749999999999
2000 1

Output: 666999999999996

Output: 666999999999996

Output: 666999999999996

Output: 666999999999996

Output: 666999999999996

Input:
2 999999999999
3 1000000000000
2000 1

Output: 500000000000000

Output: 500000000000000

Output: 500000000000000

Output: 500000000000000

Output: 500000000000000

Input:
2 1000000000000
2 999999999999
200 1

Output: 67000000000000

Output: 67000000000000

Output: 67000000000000

Output: 67000000000000

Output: 67000000000000

Input:
2 1000000000000
2 999999999999
5000 1

Output: 1667000000000000

Output: 1667000000000000

Output: 1667000000000000

Output: 1667000000000000

Output: 1667000000000000

Input:
2 1000000000000
2 1000000000000
5000 1

Output: 1667000000000000

Output: 1667000000000000

Output: 1667000000000000

Output: 1667000000000000

Output: 1667000000000000

Input:
2 1000000000000
2 749999999999
5000 1

Output: 1666999999999996

Output: 1666999999999996

Output: 1666999999999996

Output: 1666999999999996

Output: 1666999999999996

Input:
2 999999999999
3 1000000000000
5000 1

Output: 1250000000000000

Output: 1250000000000000

Output: 1250000000000000

Output: 1250000000000000

Output: 1250000000000000

Input:
3550 513137846814
1341 691
3688 400

Output: 2764

Output: 2764

Output: 2764

Output: 2764

Output: 2764

Input:
3929 468711395659
3390 169
1657 2089

Output: 338

Output: 338

Output: 338

Output: 338

Output: 338

Input:
4308 461139720311
4005 350
2730 3735

Output: 3850

Output: 3850

Output: 3850

Output: 3850

Output: 3850

Input:
2650 400
1555 376506610232
981 914

Output: 400

Output: 400

Output: 400

Output: 400

Output: 400

Input:
1568 245
2169 578237272414
2054 40

Output: 490

Output: 490

Output: 490

Output: 490

Output: 490

Input:
1947 385
4219 784262901891
23 1317

Output: 385

Output: 385

Output: 385

Output: 385

Output: 385

Input:
32 25827209469
1287 326
1870 25

Output: 652

Output: 652

Output: 652

Output: 652

Output: 652

Input:
5000 1000000000000
5000 999999999999
5000 1

Output: 1000000000000

Output: 1000000000000

Output: 1000000000000

Output: 1000000000000

Output: 1000000000000

Input:
38 977105791017
441 508
2135 1

Output: 2540

Output: 2540

Output: 2540

Output: 2540

Output: 2540

Input:
34 973829082966
2490 985
912 29

Output: 985

Output: 985

Output: 985

Output: 985

Output: 985

Input:
4162 118655898594
12 402
1395 10

Output: 280596

Output: 280596

Output: 280596

Output: 280596

Output: 280596

Input:
3080 74229447439
14 880
172 12

Output: 75680

Output: 75680

Output: 75680

Output: 75680

Output: 75680

Input:
4920 34097963579
18 62
3949 2

Output: 15314

Output: 15314

Output: 15314

Output: 15314

Output: 15314

Input:
33 55
40 293348890275
3755 23

Output: 20680

Output: 20680

Output: 20680

Output: 20680

Output: 20680

Input:
19 603
2115 499374519753
1724 7

Output: 86832

Output: 86832

Output: 86832

Output: 86832

Output: 86832

Input:
25 744
2704 701105181934
3205 2

Output: 104160

Output: 104160

Output: 104160

Output: 104160

Output: 104160

Input:
756 512
40 265176401699
2425 13

Output: 2048

Output: 2048

Output: 2048

Output: 2048

Output: 2048

Input:
4673 356
33 434347255368
1202 9

Output: 356

Output: 356

Output: 356

Output: 356

Output: 356

Input:
3591 8
46 636077917550
2275 41

Output: 8

Output: 8

Output: 8

Output: 8

Output: 8

Input:
2 1
2 1
1 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input:
2 1
2 999999999999
5000 1

Output: 5000

Output: 5000

Output: 5000

Output: 5000

Output: 5000

Input:
2 1000000000000
2 639999999999
5000 1

Output: 1599999999997500

Output: 1599999999997500

Output: 1599999999997500

Output: 1599999999997500

Output: 1599999999997500


You are given three integers $$$n$$$, $$$k$$$ and $$$f$$$.Consider all binary strings (i. e. all strings consisting of characters $$$0$$$ and/or $$$1$$$) of length from $$$1$$$ to $$$n$$$. For every such string $$$s$$$, you need to choose an integer $$$c_s$$$ from $$$0$$$ to $$$k$$$.A multiset of binary strings of length exactly $$$n$$$ is considered beautiful if for every binary string $$$s$$$ with length from $$$1$$$ to $$$n$$$, the number of strings in the multiset such that $$$s$$$ is their prefix is not exceeding $$$c_s$$$.For example, let $$$n = 2$$$, $$$c_{0} = 3$$$, $$$c_{00} = 1$$$, $$$c_{01} = 2$$$, $$$c_{1} = 1$$$, $$$c_{10} = 2$$$, and $$$c_{11} = 3$$$. The multiset of strings $$$\{11, 01, 00, 01\}$$$ is beautiful, since:  for the string $$$0$$$, there are $$$3$$$ strings in the multiset such that $$$0$$$ is their prefix, and $$$3 \le c_0$$$;  for the string $$$00$$$, there is one string in the multiset such that $$$00$$$ is its prefix, and $$$1 \le c_{00}$$$;  for the string $$$01$$$, there are $$$2$$$ strings in the multiset such that $$$01$$$ is their prefix, and $$$2 \le c_{01}$$$;  for the string $$$1$$$, there is one string in the multiset such that $$$1$$$ is its prefix, and $$$1 \le c_1$$$;  for the string $$$10$$$, there are $$$0$$$ strings in the multiset such that $$$10$$$ is their prefix, and $$$0 \le c_{10}$$$;  for the string $$$11$$$, there is one string in the multiset such that $$$11$$$ is its prefix, and $$$1 \le c_{11}$$$. Now, for the problem itself. You have to calculate the number of ways to choose the integer $$$c_s$$$ for every binary string $$$s$$$ of length from $$$1$$$ to $$$n$$$ in such a way that the maximum possible size of a beautiful multiset is exactly $$$f$$$.

Print one integer — the number of ways to choose the integer $$$c_s$$$ for every binary string $$$s$$$ of length from $$$1$$$ to $$$n$$$ in such a way that the maximum possible size of a beautiful multiset is exactly $$$f$$$. Since it can be huge, print it modulo $$$998244353$$$.

NoteIn the first example, the three ways to choose the integers $$$c_s$$$ are:  $$$c_0 = 0$$$, $$$c_1 = 2$$$, then the maximum beautiful multiset is $$$\{1, 1\}$$$;  $$$c_0 = 1$$$, $$$c_1 = 1$$$, then the maximum beautiful multiset is $$$\{0, 1\}$$$;  $$$c_0 = 2$$$, $$$c_1 = 0$$$, then the maximum beautiful multiset is $$$\{0, 0\}$$$.

The only line of input contains three integers $$$n$$$, $$$k$$$ and $$$f$$$ ($$$1 \le n \le 15$$$; $$$1 \le k, f \le 2 \cdot 10^5$$$).

Input: 1 42 2

Output: 3

Output: 3

Output: 3

Output: 3

Input: 2 37 13

Output: 36871576

Output: 36871576

Output: 36871576

Output: 36871576

Input: 4 1252 325

Output: 861735572

Output: 861735572

Output: 861735572

Output: 861735572

Input: 6 153 23699

Output: 0

Output: 0

Output: 0

Output: 0

Input: 15 200000 198756

Output: 612404746

Output: 612404746

Output: 612404746

Output: 612404746

Input: 1 1 1

Output: 2

Output: 2

Output: 2

Output: 2

Input: 1 1 100000

Output: 0

Output: 0

Output: 0

Output: 0

Input: 1 1 200000

Output: 0

Output: 0

Output: 0

Output: 0

Input: 1 100000 1

Output: 2

Output: 2

Output: 2

Output: 2

Input: 1 100000 100000

Output: 100001

Output: 100001

Output: 100001

Output: 100001

Input: 1 100000 200000

Output: 1

Output: 1

Output: 1

Output: 1

Input: 1 200000 1

Output: 2

Output: 2

Output: 2

Output: 2

Input: 1 200000 100000

Output: 100001

Output: 100001

Output: 100001

Output: 100001

Input: 1 200000 200000

Output: 200001

Output: 200001

Output: 200001

Output: 200001

Input: 7 1 1

Output: 10802803

Output: 10802803

Output: 10802803

Output: 10802803

Input: 7 1 100000

Output: 0

Output: 0

Output: 0

Output: 0

Input: 7 1 200000

Output: 0

Output: 0

Output: 0

Output: 0

Input: 7 100000 1

Output: 477825325

Output: 477825325

Output: 477825325

Output: 477825325

Input: 7 100000 100000

Output: 569581672

Output: 569581672

Output: 569581672

Output: 569581672

Input: 7 100000 200000

Output: 136436465

Output: 136436465

Output: 136436465

Output: 136436465

Input: 7 200000 1

Output: 90602327

Output: 90602327

Output: 90602327

Output: 90602327

Input: 7 200000 100000

Output: 331190498

Output: 331190498

Output: 331190498

Output: 331190498

Input: 7 200000 200000

Output: 343099201

Output: 343099201

Output: 343099201

Output: 343099201

Input: 15 1 1

Output: 240127335

Output: 240127335

Output: 240127335

Output: 240127335

Input: 15 1 100000

Output: 0

Output: 0

Output: 0

Output: 0

Input: 15 1 200000

Output: 0

Output: 0

Output: 0

Output: 0

Input: 15 100000 1

Output: 737847906

Output: 737847906

Output: 737847906

Output: 737847906

Input: 15 100000 100000

Output: 607648863

Output: 607648863

Output: 607648863

Output: 607648863

Input: 15 100000 200000

Output: 816613688

Output: 816613688

Output: 816613688

Output: 816613688

Input: 15 200000 1

Output: 836547474

Output: 836547474

Output: 836547474

Output: 836547474

Input: 15 200000 100000

Output: 63705590

Output: 63705590

Output: 63705590

Output: 63705590

Input: 15 200000 200000

Output: 894782321

Output: 894782321

Output: 894782321

Output: 894782321

Input: 15 199999 200000

Output: 437780341

Output: 437780341

Output: 437780341

Output: 437780341


Madoka decided to entrust the organization of a major computer game tournament "OSU"!In this tournament, matches are held according to the "Olympic system". In other words, there are $$$2^n$$$ participants in the tournament, numbered with integers from $$$1$$$ to $$$2^n$$$. There are $$$n$$$ rounds in total in the tournament. In the $$$i$$$-th round there are $$$2^{n - i}$$$ matches between two players (one of whom is right, the other is left), after which the winners go further along the tournament grid, and the losing participants are eliminated from the tournament. Herewith, the relative order in the next round does not change. And the winner of the tournament — is the last remaining participant.But the smaller the participant's number, the more he will pay Madoka if he wins, so Madoka wants the participant with the lowest number to win. To do this, she can arrange the participants in the first round as she likes, and also determine for each match who will win — the participant on the left or right.But Madoka knows that tournament sponsors can change the winner in matches no more than $$$k$$$ times. (That is, if the participant on the left won before the change, then the participant on the right will win after the change, and if the participant on the right won, then the participant on the left will win after the change).  So, the first image shows the tournament grid that Madoka made, where the red lines denote who should win the match. And the second one shows the tournament grid, after one change in the outcome of the match by sponsors (a match between $$$1$$$ and $$$3$$$ players). Print the minimum possible number of the winner in the tournament, which Madoka can get regardless of changes in sponsors. But since the answer can be very large, output it modulo $$$10^9 + 7$$$. Note that we need to minimize the answer, and only then take it modulo.

Print exactly one integer — the minimum number of the winner modulo $$$10^9 + 7$$$

NoteIn the first example, there is only one match between players $$$1$$$ and $$$2$$$, so the sponsors can always make player $$$2$$$ wins.The tournament grid from the second example is shown in the picture in the statement.

The first and the only line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 10^5, 1 \le k \le \min(2^n - 1, 10^9)$$$) — the number of rounds in the tournament and the number of outcomes that sponsors can change.

Input: 1 1

Output: 2

Output: 2

Output: 2

Output: 2

Output: 2

Output: 2

Output: 2

Output: 2

Input: 2 1

Output: 3

Output: 3

Output: 3

Output: 3

Output: 3

Output: 3

Output: 3

Output: 3

Output: 3

Input: 3 2

Output: 7

Output: 7

Output: 7

Output: 7

Output: 7

Output: 7

Output: 7

Output: 7

Output: 7

Input: 5 3

Output: 26

Output: 26

Output: 26

Output: 26

Output: 26

Output: 26

Output: 26

Output: 26

Output: 26

Input: 5 5

Output: 32

Output: 32

Output: 32

Output: 32

Output: 32

Output: 32

Output: 32

Output: 32

Input: 5 31

Output: 32

Output: 32

Output: 32

Output: 32

Output: 32

Output: 32

Output: 32

Output: 32

Input: 11994 11995

Output: 685385528

Output: 685385528

Output: 685385528

Output: 685385528

Output: 685385528

Output: 685385528

Output: 685385528

Output: 685385528

Input: 99999 3123

Output: 575224395

Output: 575224395

Output: 575224395

Output: 575224395

Output: 575224395

Output: 575224395

Output: 575224395

Output: 575224395

Output: 575224395

Input: 100000 1000000000

Output: 607723520

Output: 607723520

Output: 607723520

Output: 607723520

Output: 607723520

Output: 607723520

Output: 607723520

Output: 607723520

Input: 100000 1

Output: 100001

Output: 100001

Output: 100001

Output: 100001

Output: 100001

Output: 100001

Output: 100001

Output: 100001

Output: 100001

Input: 100000 13

Output: 185515077

Output: 185515077

Output: 185515077

Output: 185515077

Output: 185515077

Output: 185515077

Output: 185515077

Output: 185515077

Output: 185515077

Input: 100000 53228

Output: 871774727

Output: 871774727

Output: 871774727

Output: 871774727

Output: 871774727

Output: 871774727

Output: 871774727

Output: 871774727

Output: 871774727

Input: 87532 32150

Output: 165162987

Output: 165162987

Output: 165162987

Output: 165162987

Output: 165162987

Output: 165162987

Output: 165162987

Output: 165162987

Output: 165162987

Input: 30 99999999

Output: 73741817

Output: 73741817

Output: 73741817

Output: 73741817

Output: 73741817

Output: 73741817

Output: 73741817

Output: 73741817


Madoka wants to enter to "Novosibirsk State University", but in the entrance exam she came across a very difficult task:Given an integer $$$n$$$, it is required to calculate $$$\sum{\operatorname{lcm}(c, \gcd(a, b))}$$$, for all triples of positive integers $$$(a, b, c)$$$, where $$$a + b + c = n$$$.In this problem $$$\gcd(x, y)$$$ denotes the greatest common divisor of $$$x$$$ and $$$y$$$, and $$$\operatorname{lcm}(x, y)$$$ denotes the least common multiple of $$$x$$$ and $$$y$$$.Solve this problem for Madoka and help her to enter to the best university!

Print exactly one interger — $$$\sum{\operatorname{lcm}(c, \gcd(a, b))}$$$. Since the answer can be very large, then output it modulo $$$10^9 + 7$$$.

NoteIn the first example, there is only one suitable triple $$$(1, 1, 1)$$$. So the answer is $$$\operatorname{lcm}(1, \gcd(1, 1)) = \operatorname{lcm}(1, 1) = 1$$$.In the second example, $$$\operatorname{lcm}(1, \gcd(3, 1)) + \operatorname{lcm}(1, \gcd(2, 2)) + \operatorname{lcm}(1, \gcd(1, 3)) + \operatorname{lcm}(2, \gcd(2, 1)) + \operatorname{lcm}(2, \gcd(1, 2)) + \operatorname{lcm}(3, \gcd(1, 1)) = \operatorname{lcm}(1, 1) + \operatorname{lcm}(1, 2) + \operatorname{lcm}(1, 1) + \operatorname{lcm}(2, 1) + \operatorname{lcm}(2, 1) + \operatorname{lcm}(3, 1) = 1 + 2 + 1 + 2 + 2 + 3 = 11$$$

The first and the only line contains a single integer $$$n$$$ ($$$3 \le n \le 10^5$$$).


Pak Chanek has a grid that has $$$N$$$ rows and $$$M$$$ columns. Each row is numbered from $$$1$$$ to $$$N$$$ from top to bottom. Each column is numbered from $$$1$$$ to $$$M$$$ from left to right.Each tile in the grid contains a number. The numbers are arranged as follows:   Row $$$1$$$ contains integers from $$$1$$$ to $$$M$$$ from left to right.  Row $$$2$$$ contains integers from $$$M+1$$$ to $$$2 \times M$$$ from left to right.  Row $$$3$$$ contains integers from $$$2 \times M+1$$$ to $$$3 \times M$$$ from left to right.  And so on until row $$$N$$$. A domino is defined as two different tiles in the grid that touch by their sides. A domino is said to be tight if and only if the two numbers in the domino have a difference of exactly $$$1$$$. Count the number of distinct tight dominoes in the grid.Two dominoes are said to be distinct if and only if there exists at least one tile that is in one domino, but not in the other.

An integer representing the number of distinct tight dominoes in the grid.

NoteThe picture below is the grid that Pak Chanek has in the first example.  The picture below is an example of a tight domino in the grid.

The only line contains two integers $$$N$$$ and $$$M$$$ ($$$1 \leq N, M \leq 10^9$$$) — the number of rows and columns in the grid.

Input: 3 4

Output: 9

Output: 9

Output: 9

Output: 9

Output: 9

Output: 9

Output: 9

Output: 9

Output: 9

Input: 2 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 1 1

Output: 0

Output: 0

Output: 0

Output: 0

Output: 0

Output: 0

Output: 0

Output: 0

Input: 1 2

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 2 2

Output: 2

Output: 2

Output: 2

Output: 2

Output: 2

Output: 2

Output: 2

Output: 2

Output: 2

Input: 1 1000000000

Output: 999999999

Output: 999999999

Output: 999999999

Output: 999999999

Output: 999999999

Output: 999999999

Output: 999999999

Input: 1 999999997

Output: 999999996

Output: 999999996

Output: 999999996

Output: 999999996

Output: 999999996

Output: 999999996

Output: 999999996

Input: 1 589284012

Output: 589284011

Output: 589284011

Output: 589284011

Output: 589284011

Output: 589284011

Output: 589284011

Output: 589284011

Input: 1000000000 1

Output: 999999999

Output: 999999999

Output: 999999999

Output: 999999999

Output: 999999999

Output: 999999999

Output: 999999999

Input: 999999999 1

Output: 999999998

Output: 999999998

Output: 999999998

Output: 999999998

Output: 999999998

Output: 999999998

Output: 999999998

Input: 636562060 1

Output: 636562059

Output: 636562059

Output: 636562059

Output: 636562059

Output: 636562059

Output: 636562059

Output: 636562059

Input: 2 1000000000

Output: 1999999998

Output: 1999999998

Output: 1999999998

Output: 1999999998

Output: 1999999998

Output: 1999999998

Output: 1999999998

Input: 1000000000 2

Output: 1000000000

Output: 1000000000

Output: 1000000000

Output: 1000000000

Output: 1000000000

Output: 1000000000

Output: 1000000000

Input: 30001 30001

Output: 900030000

Output: 900030000

Output: 900030000

Output: 900030000

Output: 900030000

Output: 900030000

Output: 900030000

Input: 1000000000 1000000000

Output: 999999999000000000

Output: 999999999000000000

Output: 999999999000000000

Output: 999999999000000000

Output: 999999999000000000

Input: 767928735 1000000000

Output: 767928734232071265

Output: 767928734232071265

Output: 767928734232071265

Output: 767928734232071265

Output: 767928734232071265

Input: 1000000000 906523442

Output: 906523441000000000

Output: 906523441000000000

Output: 906523441000000000

Output: 906523441000000000

Output: 906523441000000000

Input: 647242241 921242095

Output: 596266797424092654

Output: 596266797424092654

Output: 596266797424092654

Output: 596266797424092654

Output: 596266797424092654


There is a binary string $$$t$$$ of length $$$10^{100}$$$, and initally all of its bits are $$$\texttt{0}$$$. You are given a binary string $$$s$$$, and perform the following operation some times:   Select some substring of $$$t$$$, and replace it with its XOR with $$$s$$$.$$$^\dagger$$$  After several operations, the string $$$t$$$ has exactly two bits $$$\texttt{1}$$$; that is, there are exactly two distinct indices $$$p$$$ and $$$q$$$ such that the $$$p$$$-th and $$$q$$$-th bits of $$$t$$$ are $$$\texttt{1}$$$, and the rest of the bits are $$$\texttt{0}$$$. Find the lexicographically largest$$$^\ddagger$$$ string $$$t$$$ satisfying these constraints, or report that no such string exists.$$$^\dagger$$$ Formally, choose an index $$$i$$$ such that $$$0 \leq i \leq 10^{100}-|s|$$$. For all $$$1 \leq j \leq |s|$$$, if $$$s_j = \texttt{1}$$$, then toggle $$$t_{i+j}$$$. That is, if $$$t_{i+j}=\texttt{0}$$$, set $$$t_{i+j}=\texttt{1}$$$. Otherwise if $$$t_{i+j}=\texttt{1}$$$, set $$$t_{i+j}=\texttt{0}$$$.$$$^\ddagger$$$ A binary string $$$a$$$ is lexicographically larger than a binary string $$$b$$$ of the same length if in the first position where $$$a$$$ and $$$b$$$ differ, the string $$$a$$$ has a bit $$$\texttt{1}$$$ and the corresponding bit in $$$b$$$ is $$$\texttt{0}$$$.

If no string $$$t$$$ exists as described in the statement, output -1. Otherwise, output the integers $$$p$$$ and $$$q$$$ ($$$1 \leq p < q \leq 10^{100}$$$) such that the $$$p$$$-th and $$$q$$$-th bits of the lexicographically maximal $$$t$$$ are $$$\texttt{1}$$$.

NoteIn the first test, you can perform the following operations. $$$$$$\texttt{00000}\ldots \to \color{red}{\texttt{1}}\texttt{0000}\ldots \to \texttt{1}\color{red}{\texttt{1}}\texttt{000}\ldots$$$$$$In the second test, you can perform the following operations. $$$$$$\texttt{00000}\ldots \to \color{red}{\texttt{001}}\texttt{00}\ldots \to \texttt{0}\color{red}{\texttt{011}}\texttt{0}\ldots$$$$$$In the third test, you can perform the following operations. $$$$$$\texttt{00000}\ldots \to \color{red}{\texttt{1111}}\texttt{0}\ldots \to \texttt{1}\color{red}{\texttt{0001}}\ldots$$$$$$It can be proven that these strings $$$t$$$ are the lexicographically largest ones.In the fourth test, you can't make a single bit $$$\texttt{1}$$$, so it is impossible.

The only line of each test contains a single binary string $$$s$$$ ($$$1 \leq |s| \leq 35$$$).

Output: 1 2

Output: 1 2

Output: 1 2

Output: 3 4

Output: 3 4

Output: 3 4

Output: 1 5

Output: 1 5

Output:
1
5

Output: 1 5

Output:
6
37452687

Output: 6 37452687

Output: 6 37452687

Output: 6 37452687

Output: 1 17179869184

Output: 1 17179869184

Output: 1 17179869184

Output:
1
17179869184

Output: 1 17179869184

Output: 1 17179869184

Output: 1 17179869184

Output:
1
17179869184

Output: 1 17179869184

Output: 1 17179869184

Output: 1 17179869184

Output:
1
17179869184

Output: 3 301989882

Output: 3 301989882

Output: 3 301989882

Output:
3
301989882

Output: 2 179692

Output: 2 179692

Output:
2
179692

Output: 2 179692

Output: 3 1073741826

Output: 3 1073741826

Output:
3
1073741826

Output: 3 1073741826

Output: 2 383

Output: 2 383

Output: 2 383

Output:
2
383

Output: 1 5726623062

Output: 1 5726623062

Output: 1 5726623062

Output:
1
5726623062

Output: 9 12

Output: 9 12

Output: 9 12

Output: 9 12

Output:
9
12

Output: 9 12

Output: 1 16777216

Output: 1 16777216

Output: 1 16777216

Output:
1
16777216

Output: 1 8371714

Output: 1 8371714

Output:
1
8371714

Output: 1 8371714

Output: 2 7512508425

Output: 2 7512508425

Output:
2
7512508425

Output: 2 7512508425

Output: 1 342

Output: 1 342

Output: 1 342

Output:
1
342

Output:
3
2146430981

Output: 3 2146430981

Output: 3 2146430981

Output: 3 2146430981

Output: 2 3

Output: 2 3

Output: 2 3

Output: 2 3

Output: 2 3

Output:
2
3

Output: 3 7776912

Output: 3 7776912

Output:
3
7776912

Output: 3 7776912

Output: 2 524288

Output: 2 524288

Output: 2 524288

Output:
2
524288

Output: 1 65

Output: 1 65

Output: 1 65


There is a field of size $$$2 \times 2$$$. Each cell of this field can either contain grass or be empty. The value $$$a_{i, j}$$$ is $$$1$$$ if the cell $$$(i, j)$$$ contains grass, or $$$0$$$ otherwise.In one move, you can choose one row and one column and cut all the grass in this row and this column. In other words, you choose the row $$$x$$$ and the column $$$y$$$, then you cut the grass in all cells $$$a_{x, i}$$$ and all cells $$$a_{i, y}$$$ for all $$$i$$$ from $$$1$$$ to $$$2$$$. After you cut the grass from a cell, it becomes empty (i. e. its value is replaced by $$$0$$$).Your task is to find the minimum number of moves required to cut the grass in all non-empty cells of the field (i. e. make all $$$a_{i, j}$$$ zeros).You have to answer $$$t$$$ independent test cases.

For each test case, print one integer — the minimum number of moves required to cut the grass in all non-empty cells of the field (i. e. make all $$$a_{i, j}$$$ zeros) in the corresponding test case.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 16$$$) — the number of test cases. Then $$$t$$$ test cases follow. The test case consists of two lines, each of these lines contains two integers. The $$$j$$$-th integer in the $$$i$$$-th row is $$$a_{i, j}$$$. If $$$a_{i, j} = 0$$$ then the cell $$$(i, j)$$$ is empty, and if $$$a_{i, j} = 1$$$ the cell $$$(i, j)$$$ contains grass.

Input:
3
0 0
0 0
1 0
0 1
1 1
1 1

Output:
0
1
2

Output:
0
1
2

Output:
0
1
2

Output:
0
1
2

Output:
0
1
2

Output:
0
1
2

Output:
0

1

2

Output: 0 1 2

Output:
0
1
2

Output:
0
1
2

Output:
0
1
2

Output: 0 1 2

Output:
0
1
2

Output:
0
1
2

Input:
16
0 0
1 1
0 1
1 0
1 0
0 1
0 0
0 0
0 0
0 1
0 1
1 1
1 1
0 0
0 1
0 1
1 1
0 1
1 0
0 0
1 1
1 0
1 1
1 1
0 1
0 0
0 0
1 0
1 0
1 1
1 0
1 0

Output:
1
1
1
0
1
1
1
1
1
1
1
2
1
1
1
1

Output:
1
1
1
0
1
1
1
1
1
1
1
2
1
1
1
1

Output: 1 1 1 0 1 1 1 1 1 1 1 2 1 1 1 1

Output:
1

1

1

0

1
1

1

1

1

1
1

2

1
1
1

1

Output:
1

1

1

0

1

1

1

1

1

1

1

2

1

1

1

1

Output:
1
1
1
0
1
1
1
1
1
1
1
2
1
1
1
1

Output:
1
1
1
0
1
1
1
1
1
1
1
2
1
1
1
1

Output:
1
1
1
0
1
1
1
1
1
1
1
2
1
1
1
1

Output:
1
1
1
0
1
1
1
1
1
1
1
2
1
1
1
1

Output:
1
1
1
0
1
1
1
1
1
1
1
2
1
1
1
1

Output:
1
1
1
0
1
1
1
1
1
1
1
2
 1
1
1
1

Output:
1
1
1
0
1
1
1
1
1
1
1
2
1
1
1
1

Output:
1
1
1
0
1
1
1
1
1
1
1
2
1
1
1
1

Input:
2
1 1
1 1
1 1
1 1

Output:
2
2

Output: 2 2

Output:
2
2

Output:
2
2

Output:
2
 2

Output:
2
2

Output:
2
2

Output:
2
2

Output:
2

2

Output:
2
2

Output:
2
2

Output:
2
2

Input:
4
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1

Output:
2
2
2
2

Output:
2
2
2
2

Output:
2
2
2
2

Output:
2
2
2
2

Output:
2
2
2
2

Output:
2
 2
 2
 2

Output: 2 2 2 2

Output:
2
2
2
2

Output:
2
2
2
2

Output:
2
2
2
2

Output:
2

2

2

2

Output:
2
2
2
2


This is the easy version of this problem. The difference between easy and hard versions is the constraint on $$$k$$$ and the time limit. Also, in this version of the problem, you only need to calculate the answer when $$$n=k$$$. You can make hacks only if both versions of the problem are solved.Cirno is playing a war simulator game with $$$n$$$ towers (numbered from $$$1$$$ to $$$n$$$) and $$$n$$$ bots (numbered from $$$1$$$ to $$$n$$$). The $$$i$$$-th tower is initially occupied by the $$$i$$$-th bot for $$$1 \le i \le n$$$.Before the game, Cirno first chooses a permutation $$$p = [p_1, p_2, \ldots, p_n]$$$ of length $$$n$$$ (A permutation of length $$$n$$$ is an array of length $$$n$$$ where each integer between $$$1$$$ and $$$n$$$ appears exactly once). After that, she can choose a sequence $$$a = [a_1, a_2, \ldots, a_n]$$$ ($$$1 \le a_i \le n$$$ and $$$a_i \ne i$$$ for all $$$1 \le i \le n$$$).The game has $$$n$$$ rounds of attacks. In the $$$i$$$-th round, if the $$$p_i$$$-th bot is still in the game, it will begin its attack, and as the result the $$$a_{p_i}$$$-th tower becomes occupied by the $$$p_i$$$-th bot; the bot that previously occupied the $$$a_{p_i}$$$-th tower will no longer occupy it. If the $$$p_i$$$-th bot is not in the game, nothing will happen in this round.After each round, if a bot doesn't occupy any towers, it will be eliminated and leave the game. Please note that no tower can be occupied by more than one bot, but one bot can occupy more than one tower during the game.At the end of the game, Cirno will record the result as a sequence $$$b = [b_1, b_2, \ldots, b_n]$$$, where $$$b_i$$$ is the number of the bot that occupies the $$$i$$$-th tower at the end of the game.However, as a mathematics master, she wants you to solve the following counting problem instead of playing games:Count the number of different pairs of sequences $$$a$$$ and $$$b$$$ that we can get from all possible choices of sequence $$$a$$$ and permutation $$$p$$$.Since this number may be large, output it modulo $$$M$$$.

Output a single integer — the number of different pairs of sequences for $$$n=k$$$ modulo $$$M$$$.

NoteFor $$$n=1$$$, no valid sequence $$$a$$$ exists. We regard the answer as $$$0$$$.For $$$n=2$$$, there is only one possible array $$$a$$$: $$$[2, 1]$$$.   For array $$$a$$$ is $$$[2, 1]$$$ and permutation $$$p$$$ is $$$[1, 2]$$$, the sequence $$$b$$$ will be $$$[1, 1]$$$ after all rounds have finished. The details for each rounds:   In the first round, the first bot will begin its attack and successfully capture the tower $$$2$$$. After this round, the second bot will be eliminated and leave the game as all of its towers are occupied by other bots.  In the second round, the second bot is not in the game.   For array $$$a$$$ is $$$[2, 1]$$$ and permutation $$$p$$$ is $$$[2, 1]$$$, the sequence $$$b$$$ will be $$$[2, 2]$$$ after all rounds have finished. The details for each rounds:   In the first round, the second bot will begin its attack and successfully capture the tower $$$1$$$. After this round, the first bot will be eliminated and leave the game as all of its towers are occupied by other bots.  In the second round, the first bot is not in the game.  So the number of different pairs of sequences $$$(a,b)$$$ is $$$2$$$ ($$$[2, 1]$$$, $$$[1, 1]$$$ and $$$[2, 1]$$$, $$$[2, 2]$$$) for $$$n=2$$$.

The only line contains two positive integers $$$k$$$ and $$$M$$$ ($$$1\le k\le 5000$$$, $$$2\le M\le 10^9$$$ ). It is guaranteed that $$$2^{18}$$$ is a divisor of $$$M-1$$$ and $$$M$$$ is a prime number. You need to calculate the answer for $$$n=k$$$.

Input: 1 998244353

Output: 0

Output: 0

Output: 0

Input: 2 998244353

Output: 2

Output: 2

Output: 2

Input: 3 998244353

Output: 24

Output: 24

Output: 24

Input: 8 998244353

Output: 123391016

Output: 123391016

Output: 123391016

Input: 2000 998244353

Output: 567618578

Output: 567618578

Output: 567618578

Input: 5000 825753601

Output: 371664895

Output: 371664895

Output: 371664895

Input: 2000 85196801

Output: 43917624

Output: 43917624

Output: 43917624

Input: 2000 285474817

Output: 144927889

Output: 144927889

Output: 144927889

Input: 1023 998244353

Output: 790426975

Output: 790426975

Output: 790426975

Input: 1024 998244353

Output: 340841823

Output: 340841823

Output: 340841823

Input: 2000 786433

Output: 768605

Output: 768605

Output: 768605

Input: 2000 447741953

Output: 17773730

Output: 17773730

Output: 17773730

Input: 5000 85196801

Output: 32012563

Output: 32012563

Output: 32012563

Input: 4999 285474817

Output: 66347236

Output: 66347236

Output: 66347236

Input: 4998 786433

Output: 103919

Output: 103919

Output: 103919

Input: 2000 605028353

Output: 112430648

Output: 112430648

Output: 112430648

Input: 2000 825753601

Output: 254101902

Output: 254101902

Output: 254101902

Input: 2000 950009857

Output: 595437455

Output: 595437455

Output: 595437455

Input: 5000 998244353

Output: 844270517

Output: 844270517

Output: 844270517

Input: 4102 825753601

Output: 433078699

Output: 433078699

Output: 433078699


There are three doors in front of you, numbered from $$$1$$$ to $$$3$$$ from left to right. Each door has a lock on it, which can only be opened with a key with the same number on it as the number on the door.There are three keys — one for each door. Two of them are hidden behind the doors, so that there is no more than one key behind each door. So two doors have one key behind them, one door doesn't have a key behind it. To obtain a key hidden behind a door, you should first unlock that door. The remaining key is in your hands.Can you open all the doors?

For each testcase, print "YES" if you can open all the doors. Otherwise, print "NO".

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 18$$$) — the number of testcases. The first line of each testcase contains a single integer $$$x$$$ ($$$1 \le x \le 3$$$) — the number on the key in your hands. The second line contains three integers $$$a, b$$$ and $$$c$$$ ($$$0 \le a, b, c \le 3$$$) — the number on the key behind each of the doors. If there is no key behind the door, the number is equal to $$$0$$$. Values $$$1, 2$$$ and $$$3$$$ appear exactly once among $$$x, a, b$$$ and $$$c$$$.

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

Output:
Yes
No
Yes
No

Output:
YES
NO
YES
NO

Output:
YES
NO
YES
NO

Output:
YES
NO
YES
NO

Output:
yes
NO
yes
NO

Output:
YES
NO
YES
NO

Output:
YES
NO
YES
NO

Output: YES NO YES NO

Output:
YES
No
YES
NO

Output:
YES

NO

YES

NO

Output:
yes
no
yes
no

Output:
yes
no
yes
no

Output:
Yes
No
Yes
No

Output:
YES
NO
YES
NO

Output:
Yes
No
Yes
No

Output:
YES

NO

YES

NO

Output:
yes
no
yes
NO

Output:
YES
NO
YES
NO

Output:
YES
NO
YES
NO

Output:
Yes
no
Yes
no

Output:
YES

NO

YES

NO

Output:
YES
NO
YES
NO

Output:
YES
NO
YES
NO

Output:
Yes
NO
Yes
NO

Output:
yes

no

yes

no

Output:
yes
No
yes
No

Output:
YES
No
YES
No

Input:
18
1
0 2 3
2
1 0 3
3
1 2 0
1
0 3 2
3
1 0 2
2
1 3 0
2
0 1 3
1
2 0 3
3
2 1 0
2
0 3 1
3
2 0 1
1
2 3 0
3
0 1 2
1
3 0 2
2
3 1 0
3
0 2 1
2
3 0 1
1
3 2 0

Output:
NO

NO

NO

NO

NO

NO

NO

NO

NO

YES

YES

YES

YES

YES

YES

NO

NO

NO

Output:
no

no

no

no

no

no

no

no

no

yes

yes

yes

yes

yes

yes

no

no

no

Output:
NO
NO
NO
NO
NO
NO
NO
NO
NO
yes
yes
yes
yes
yes
yes
NO
NO
NO

Output:
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO

Output:
No
No
No
No
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No

Output:
no
no
no
no
NO
NO
NO
NO
no
yes
yes
yes
yes
yes
yes
NO
no
NO

Output:
No
No
No
No
No
No
No
No
No
YES
YES
YES
YES
YES
YES
No
No
No

Output:
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO

Output:
no
no
no
no
no
no
no
no
no
yes
yes
yes
yes
yes
yes
no
no
no

Output:
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
yes
YES
YES
YES
NO
NO
NO

Output:
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO

Output: NO NO NO NO NO NO NO NO NO Yes YES YES YES YES YES NO NO NO

Output:
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO

Output:
no
no
no
no
no
no
no
no
no
yes
yes
yes
yes
yes
yes
no
no
no

Output:
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO

Output:
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO

Output:
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO

Output:
NO
NO
NO
NO
NO
NO
NO
NO
NO
Yes
Yes
Yes
Yes
Yes
Yes
NO
NO
NO

Output:
No
No
No
No
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No

Output:
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO

Output:
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO

Output:
No
No
No
No
No
No
No
No
No
yes
yes
yes
yes
yes
yes
No
No
No

Output:
NO

NO

NO

NO

NO

NO

NO

NO

NO

YES

YES

YES

YES

YES

YES

NO

NO

NO

Output: NO NO NO NO NO NO NO NO NO YES YES YES YES YES YES NO NO NO

Output:
NO
NO
NO
No
NO
NO
NO
NO
No
YES
YES
YES
YES
YES
YES
NO
No
NO

Output:
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO

Output:
NO

NO

NO

NO

NO

NO

NO

NO

NO

YES

YES

YES

YES

YES

YES

NO

NO

NO

Output:
no
no
no
no
no
no
no
no
no
Yes
Yes
Yes
Yes
Yes
Yes
no
no
no


Yura is a mathematician, and his cognition of the world is so absolute as if he have been solving formal problems a hundred of trillions of billions of years. This problem is just that!Consider all non-negative integers from the interval $$$[0, 10^{n})$$$. For convenience we complement all numbers with leading zeros in such way that each number from the given interval consists of exactly $$$n$$$ decimal digits.You are given a set of pairs $$$(u_i, v_i)$$$, where $$$u_i$$$ and $$$v_i$$$ are distinct decimal digits from $$$0$$$ to $$$9$$$.Consider a number $$$x$$$ consisting of $$$n$$$ digits. We will enumerate all digits from left to right and denote them as $$$d_1, d_2, \ldots, d_n$$$. In one operation you can swap digits $$$d_i$$$ and $$$d_{i + 1}$$$ if and only if there is a pair $$$(u_j, v_j)$$$ in the set such that at least one of the following conditions is satisfied:  $$$d_i = u_j$$$ and $$$d_{i + 1} = v_j$$$,  $$$d_i = v_j$$$ and $$$d_{i + 1} = u_j$$$. We will call the numbers $$$x$$$ and $$$y$$$, consisting of $$$n$$$ digits, equivalent if the number $$$x$$$ can be transformed into the number $$$y$$$ using some number of operations described above. In particular, every number is considered equivalent to itself.You are given an integer $$$n$$$ and a set of $$$m$$$ pairs of digits $$$(u_i, v_i)$$$. You have to find the maximum integer $$$k$$$ such that there exists a set of integers $$$x_1, x_2, \ldots, x_k$$$ ($$$0 \le x_i < 10^{n}$$$) such that for each $$$1 \le i < j \le k$$$ the number $$$x_i$$$ is not equivalent to the number $$$x_j$$$.

Print one integer — the maximum value $$$k$$$ such that there exists a set of integers $$$x_1, x_2, \ldots, x_k$$$ ($$$0 \le x_i < 10^{n}$$$) such that for each $$$1 \le i < j \le k$$$ the number $$$x_i$$$ is not equivalent to the number $$$x_j$$$. As the answer can be big enough, print the number $$$k$$$ modulo $$$998\,244\,353$$$.

NoteIn the first example we can construct a set that contains all integers from $$$0$$$ to $$$9$$$. It's easy to see that there are no two equivalent numbers in the set.In the second example there exists a unique pair of equivalent numbers: $$$01$$$ and $$$10$$$. We can construct a set that contains all integers from $$$0$$$ to $$$99$$$ despite number $$$1$$$.

The first line contains an integer $$$n$$$ ($$$1 \le n \le 50\,000$$$) — the number of digits in considered numbers. The second line contains an integer $$$m$$$ ($$$0 \le m \le 45$$$) — the number of pairs of digits in the set. Each of the following $$$m$$$ lines contains two digits $$$u_i$$$ and $$$v_i$$$, separated with a space ($$$0 \le u_i < v_i \le 9$$$). It's guaranteed that all described pairs are pairwise distinct.

Input:
1
0

Output: 10

Output: 10

Output: 10

Output: 10

Input:
2
1
0 1

Output: 99

Output: 99

Output: 99

Output: 99

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

Output: 91

Output: 91

Output: 91

Output: 91

Input:
5
0

Output: 100000

Output: 100000

Output: 100000

Output: 100000

Input:
5
6
0 1
0 9
1 5
2 5
2 8
4 8

Output: 77080

Output: 77080

Output: 77080

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

Output: 19242

Output: 19242

Output: 19242

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

Output: 11270

Output: 11270

Output: 11270

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

Output: 2002

Output: 2002

Output: 2002

Input:
50000
0

Output: 514671008

Output: 514671008

Output: 514671008

Input:
50000
13
0 5
1 3
1 5
1 6
2 4
2 5
2 7
2 8
2 9
3 5
4 5
5 6
6 8

Output: 520502362

Output: 520502362

Output: 520502362

Input:
50000
27
0 1
0 4
0 6
1 2
1 4
1 5
1 6
1 7
1 8
2 3
2 5
2 6
2 8
3 4
3 5
3 6
3 9
4 6
4 7
4 8
4 9
5 6
5 8
6 7
6 9
7 8
8 9

Output: 537166828

Output: 537166828

Output: 537166828

Input:
10
0

Output: 17556470

Output: 17556470

Output: 17556470

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

Output: 470166941

Output: 470166941

Output: 470166941

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

Output: 809913560

Output: 809913560

Output: 809913560

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

Output: 16578203

Output: 16578203

Output: 16578203

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

Output: 92378

Output: 92378

Output: 92378

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

Output: 844569961

Output: 844569961

Output: 844569961

Input:
58
26
0 1
0 2
0 4
0 5
0 6
0 8
0 9
1 4
1 5
1 6
1 7
1 9
2 3
2 4
2 7
2 9
3 4
3 5
3 8
4 5
4 7
4 8
5 8
7 8
7 9
8 9

Output: 746081034

Output: 746081034

Output: 746081034

Input:
888
13
0 5
1 2
1 3
1 8
2 3
2 5
3 4
3 9
4 7
4 9
6 7
6 8
8 9

Output: 997594665

Output: 997594665

Output: 997594665

Input:
851
23
0 3
0 6
1 2
1 4
1 9
2 3
2 5
2 6
2 7
2 8
3 4
3 6
3 7
3 8
4 5
4 6
4 7
5 9
6 7
6 8
7 8
7 9
8 9

Output: 824407841

Output: 824407841

Output: 824407841

Input:
50000
38
0 1
0 2
0 3
0 4
0 5
0 6
0 9
1 2
1 3
1 4
1 5
1 6
1 7
1 9
2 3
2 4
2 6
2 9
3 4
3 5
3 6
3 7
3 8
3 9
4 5
4 6
4 7
4 8
4 9
5 7
5 8
5 9
6 7
6 8
6 9
7 8
7 9
8 9

Output: 723596166

Output: 723596166

Output: 723596166

Input:
50000
45
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
2 3
2 4
2 5
2 6
2 7
2 8
2 9
3 4
3 5
3 6
3 7
3 8
3 9
4 5
4 6
4 7
4 8
4 9
5 6
5 7
5 8
5 9
6 7
6 8
6 9
7 8
7 9
8 9

Output: 112532493

Output: 112532493

Output: 112532493