Today is Mashtali's birthday! He received a Hagh tree from Haj Davood as his birthday present!A directed tree is called a Hagh tree iff:   The length of the longest directed path in it is exactly $$$n$$$.  Every vertex has at most three edges attached to it independent of their orientation.  Let's call vertices $$$u$$$ and $$$v$$$ friends if one of them has a directed path to the other. For every pair of vertices $$$u$$$ and $$$v$$$ that are not friends, there should exist a vertex $$$w$$$ that is friends with both $$$u$$$ and $$$v$$$ (a mutual friend). After opening his gift, Mashtali found out that the labels on the vertices were gone.Immediately, he asked himself: how many different unlabeled Hagh trees are there? That is, how many possible trees could he have received as his birthday present?At the first glance, the number of such trees seemed to be infinite since there was no limit on the number of vertices; but then he solved the problem and proved that there's a finite number of unlabeled Hagh trees!Amazed by this fact, he shared the task with you so that you could enjoy solving it as well. Since the answer can be rather large he asked you to find the number of different unlabeled Hagh trees modulo $$$998244353$$$.Here two trees are considered different, if they are not isomorphic: if there is no way to map nodes of one tree to the second tree, so that edges are mapped to edges preserving the orientation.Some examples for $$$n = 2$$$:   Directed trees $$$D$$$ and $$$E$$$ are Hagh. $$$C$$$ is not Hagh because it has a vertex with $$$4$$$ edges attached to it. $$$A$$$ and $$$B$$$ are not Hagh because their longest directed paths are not equal to $$$n$$$. Also in $$$B$$$ the leftmost and rightmost vertices are not friends neither do they have a mutual friend.

NoteAll the five Hagh trees for $$$n = 1$$$:

The first line of input contains a single integer $$$n$$$ $$$(1 \le n \le 10^6)$$$.

Print a single integer, the answer to Mashtali's task modulo $$$998244353$$$.


To AmShZ, all arrays are equal, but some arrays are more-equal than others. Specifically, the arrays consisting of $$$n$$$ elements from $$$1$$$ to $$$n$$$ that can be turned into permutations of numbers from $$$1$$$ to $$$n$$$ by adding a non-negative integer to each element.Mashtali who wants to appear in every problem statement thinks that an array $$$b$$$ consisting of $$$k$$$ elements is compatible with a more-equal array $$$a$$$ consisting of $$$n$$$ elements if for each $$$1 \le i \le k$$$ we have $$$1 \le b_i \le n$$$ and also $$$a_{b_1} = a_{b_2} = \ldots = a_{b_k}$$$.Find the number of pairs of arrays $$$a$$$ and $$$b$$$ such that $$$a$$$ is a more-equal array consisting of $$$n$$$ elements and $$$b$$$ is an array compatible with $$$a$$$ consisting of $$$k$$$ elements modulo $$$998244353$$$.Note that the elements of $$$b$$$ are not necessarily distinct, same holds for $$$a$$$.

The first line of input contains two integers $$$n$$$ and $$$k$$$ $$$(1 \le n \le 10^9 , 1 \le k \le 10^5)$$$.

Print a single integer — the answer to the problem modulo $$$998244353$$$.

Input: 1 1

Output: 1

Output: 1

Output: 1

Input: 2 2

Output: 8

Output: 8

Output: 8

Input: 5 4

Output: 50400

Output: 50400

Output: 50400

Input: 20 100

Output: 807645526

Output: 807645526

Output: 807645526

Input: 10000000 10000

Output: 883232350

Output: 883232350

Output: 883232350

Input: 1000000000 100000

Output: 301334067

Output: 301334067

Output: 301334067

Input: 1000000000 10000

Output: 504094926

Output: 504094926

Output: 504094926

Input: 100000000 100000

Output: 644008944

Output: 644008944

Output: 644008944

Input: 999999999 100000

Output: 224155646

Output: 224155646

Output: 224155646

Input: 10000 10000

Output: 517692590

Output: 517692590

Output: 517692590

Input: 100000 100000

Output: 392435118

Output: 392435118

Output: 392435118

Input: 1234 1234

Output: 593240635

Output: 593240635

Output: 593240635

Input: 999 100000

Output: 847308969

Output: 847308969

Output: 847308969

Input: 1000000000 12345

Output: 527406753

Output: 527406753

Output: 527406753

Input: 123456789 69696

Output: 693254548

Output: 693254548

Output: 693254548

Input: 987654321 54321

Output: 402869802

Output: 402869802

Output: 402869802

Input: 456321987 100000

Output: 107200603

Output: 107200603

Output: 107200603

Input: 193486257 99999

Output: 911948627

Output: 911948627

Output: 911948627

Input: 724648 77777

Output: 112803328

Output: 112803328

Output: 112803328

Input: 852585258 33333

Output: 265218367

Output: 265218367

Output: 265218367

Input: 998244353 123

Output: 0

Output: 0

Output: 0


This is the easy version of the problem. The only difference between the easy version and the hard version is the constraints on $$$n$$$. You can only make hacks if both versions are solved.A permutation of $$$1, 2, \ldots, n$$$ is a sequence of $$$n$$$ integers, where each integer from $$$1$$$ to $$$n$$$ appears exactly once. For example, $$$[2,3,1,4]$$$ is a permutation of $$$1, 2, 3, 4$$$, but $$$[1,4,2,2]$$$ isn't because $$$2$$$ appears twice in it.Recall that the number of inversions in a permutation $$$a_1, a_2, \ldots, a_n$$$ is the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i > a_j$$$.Let $$$p$$$ and $$$q$$$ be two permutations of $$$1, 2, \ldots, n$$$. Find the number of permutation pairs $$$(p,q)$$$ that satisfy the following conditions:  $$$p$$$ is lexicographically smaller than $$$q$$$.  the number of inversions in $$$p$$$ is greater than the number of inversions in $$$q$$$. Print the number of such pairs modulo $$$mod$$$. Note that $$$mod$$$ may not be a prime.

The only line contains two integers $$$n$$$ and $$$mod$$$ ($$$1\le n\le 50$$$, $$$1\le mod\le 10^9$$$).

Print one integer, which is the answer modulo $$$mod$$$.

Input: 4 403458273

Output: 17

Output: 17

Output: 17

Output: 17

Input: 50 1000000000

Output: 14460084

Output: 14460084

Output: 14460084

Output: 14460084

Input: 50 40

Output: 4

Output: 4

Output: 4

Output: 4

Input: 50 900720143

Output: 9743118

Output: 9743118

Output: 9743118

Output: 9743118

Input: 1 1

Output: 0

Output: 0

Output: 0

Output: 0

Input: 4 1

Output: 0

Output: 0

Output: 0

Output: 0

Input: 1 167959139

Output: 0

Output: 0

Output: 0

Output: 0

Input: 2 641009859

Output: 0

Output: 0

Output: 0

Output: 0

Input: 3 524125987

Output: 0

Output: 0

Output: 0

Output: 0

Input: 4 702209411

Output: 17

Output: 17

Output: 17

Output: 17

Input: 5 585325539

Output: 904

Output: 904

Output: 904

Output: 904

Input: 6 58376259

Output: 45926

Output: 45926

Output: 45926

Output: 45926

Input: 7 941492387

Output: 2725016

Output: 2725016

Output: 2725016

Output: 2725016

Input: 8 824608515

Output: 196884712

Output: 196884712

Output: 196884712

Output: 196884712

Input: 9 2691939

Output: 1124976

Output: 1124976

Output: 1124976

Output: 1124976

Input: 10 802030518

Output: 754910371

Output: 754910371

Output: 754910371

Output: 754910371

Input: 11 685146646

Output: 534097912

Output: 534097912

Output: 534097912

Output: 534097912

Input: 12 863230070

Output: 612906984

Output: 612906984

Output: 612906984

Output: 612906984

Input: 23 691688417

Output: 75940470

Output: 75940470

Output: 75940470

Output: 75940470

Input: 34 665370955

Output: 623184633

Output: 623184633

Output: 623184633

Output: 623184633

Input: 45 639053494

Output: 48328055

Output: 48328055

Output: 48328055

Output: 48328055

Input: 50 134170081

Output: 21416710

Output: 21416710

Output: 21416710

Output: 21416710

Input: 13 41313494

Output: 32605755

Output: 32605755

Output: 32605755

Output: 32605755

Input: 14 219396918

Output: 172486793

Output: 172486793

Output: 172486793

Output: 172486793

Input: 15 102513046

Output: 13918577

Output: 13918577

Output: 13918577

Output: 13918577

Input: 16 985629174

Output: 794805824

Output: 794805824

Output: 794805824

Output: 794805824

Input: 17 458679894

Output: 127170952

Output: 127170952

Output: 127170952

Output: 127170952

Input: 18 341796022

Output: 261190161

Output: 261190161

Output: 261190161

Output: 261190161

Input: 19 519879446

Output: 105365940

Output: 105365940

Output: 105365940

Output: 105365940

Input: 20 452405440

Output: 386692452

Output: 386692452

Output: 386692452

Output: 386692452

Input: 21 335521569

Output: 55974624

Output: 55974624

Output: 55974624

Output: 55974624

Input: 22 808572289

Output: 480987430

Output: 480987430

Output: 480987430

Output: 480987430

Input: 24 869771841

Output: 710482824

Output: 710482824

Output: 710482824

Output: 710482824

Input: 25 752887969

Output: 168521260

Output: 168521260

Output: 168521260

Output: 168521260

Input: 26 930971393

Output: 234097454

Output: 234097454

Output: 234097454

Output: 234097454

Input: 27 109054817

Output: 81151927

Output: 81151927

Output: 81151927

Output: 81151927

Input: 28 992170945

Output: 349037011

Output: 349037011

Output: 349037011

Output: 349037011

Input: 29 170254369

Output: 126180810

Output: 126180810

Output: 126180810

Output: 126180810

Input: 30 248004555

Output: 34381877

Output: 34381877

Output: 34381877

Output: 34381877

Input: 31 131120683

Output: 16838875

Output: 16838875

Output: 16838875

Output: 16838875

Input: 32 604171403

Output: 102319587

Output: 102319587

Output: 102319587

Output: 102319587

Input: 33 487287531

Output: 465870936

Output: 465870936

Output: 465870936

Output: 465870936

Input: 35 843454379

Output: 158308733

Output: 158308733

Output: 158308733

Output: 158308733

Input: 36 21537803

Output: 18571196

Output: 18571196

Output: 18571196

Output: 18571196

Input: 37 904653932

Output: 12647071

Output: 12647071

Output: 12647071

Output: 12647071

Input: 38 787770060

Output: 671272609

Output: 671272609

Output: 671272609

Output: 671272609

Input: 39 260820780

Output: 20214686

Output: 20214686

Output: 20214686

Output: 20214686

Input: 40 43603670

Output: 8542941

Output: 8542941

Output: 8542941

Output: 8542941

Input: 41 221687094

Output: 4087910

Output: 4087910

Output: 4087910

Output: 4087910

Input: 42 399770518

Output: 301108922

Output: 301108922

Output: 301108922

Output: 301108922

Input: 43 282886646

Output: 266942452

Output: 266942452

Output: 266942452

Output: 266942452

Input: 44 460970070

Output: 292569992

Output: 292569992

Output: 292569992

Output: 292569992

Input: 46 817136918

Output: 10443503

Output: 10443503

Output: 10443503

Output: 10443503

Input: 47 700253046

Output: 485612847

Output: 485612847

Output: 485612847

Output: 485612847

Input: 48 583369174

Output: 2781186

Output: 2781186

Output: 2781186

Output: 2781186

Input: 49 56419894

Output: 33022556

Output: 33022556

Output: 33022556

Output: 33022556


It is the easy version of the problem. The difference is that in this version, there are no nodes with already chosen colors.Theofanis is starving, and he wants to eat his favorite food, sheftalia. However, he should first finish his homework. Can you help him with this problem?You have a perfect binary tree of $$$2^k - 1$$$ nodes — a binary tree where all vertices $$$i$$$ from $$$1$$$ to $$$2^{k - 1} - 1$$$ have exactly two children: vertices $$$2i$$$ and $$$2i + 1$$$. Vertices from $$$2^{k - 1}$$$ to $$$2^k - 1$$$ don't have any children. You want to color its vertices with the $$$6$$$ Rubik's cube colors (White, Green, Red, Blue, Orange and Yellow).Let's call a coloring good when all edges connect nodes with colors that are neighboring sides in the Rubik's cube.  A picture of Rubik's cube and its 2D map. More formally:   a white node can not be neighboring with white and yellow nodes;  a yellow node can not be neighboring with white and yellow nodes;  a green node can not be neighboring with green and blue nodes;  a blue node can not be neighboring with green and blue nodes;  a red node can not be neighboring with red and orange nodes;  an orange node can not be neighboring with red and orange nodes; You want to calculate the number of the good colorings of the binary tree. Two colorings are considered different if at least one node is colored with a different color.The answer may be too large, so output the answer modulo $$$10^9+7$$$.

NoteIn the picture below, you can see one of the correct colorings of the first example.

The first and only line contains the integers $$$k$$$ ($$$1 \le k \le 60$$$) — the number of levels in the perfect binary tree you need to color.

Print one integer — the number of the different colorings modulo $$$10^9+7$$$.


Integers from $$$1$$$ to $$$n$$$ (inclusive) were sorted lexicographically (considering integers as strings). As a result, array $$$a_1, a_2, \dots, a_n$$$ was obtained.Calculate value of $$$(\sum_{i = 1}^n ((i - a_i) \mod 998244353)) \mod 10^9 + 7$$$.$$$x \mod y$$$ here means the remainder after division $$$x$$$ by $$$y$$$. This remainder is always non-negative and doesn't exceed $$$y - 1$$$. For example, $$$5 \mod 3 = 2$$$, $$$(-1) \mod 6 = 5$$$.

The first line contains the single integer $$$n$$$ ($$$1 \leq n \leq 10^{12}$$$).


A sequence of integers $$$b_1, b_2, \ldots, b_m$$$ is called good if $$$max(b_1, b_2, \ldots, b_m) \cdot min(b_1, b_2, \ldots, b_m) \ge b_1 + b_2 + \ldots + b_m$$$.A sequence of integers $$$a_1, a_2, \ldots, a_n$$$ is called perfect if every non-empty subsequence of $$$a$$$ is good.YouKn0wWho has two integers $$$n$$$ and $$$M$$$, $$$M$$$ is prime. Help him find the number, modulo $$$M$$$, of perfect sequences $$$a_1, a_2, \ldots, a_n$$$ such that $$$1 \le a_i \le n + 1$$$ for each integer $$$i$$$ from $$$1$$$ to $$$n$$$.A sequence $$$d$$$ is a subsequence of a sequence $$$c$$$ if $$$d$$$ can be obtained from $$$c$$$ by deletion of several (possibly, zero or all) elements.

NoteIn the first test case, the perfect sequences are $$$[2, 2]$$$, $$$[2, 3]$$$, $$$[3, 2]$$$ and $$$[3, 3]$$$.In the second test case, some of the perfect sequences are $$$[3, 4, 3, 5]$$$, $$$[4, 5, 4, 4]$$$, $$$[4, 5, 5, 5]$$$ etc. One example of a sequence which is not perfect is $$$[2, 3, 3, 4]$$$, because, for example, the subsequence $$$[2, 3, 4]$$$ is not an good as $$$2 \cdot 4 < 2 + 3 + 4$$$.

The first and only line of the input contains two space-separated integers $$$n$$$ and $$$M$$$ ($$$1 \le n \le 200$$$; $$$10^8 \le M \le 10^9$$$). It is guaranteed that $$$M$$$ is prime.

Print a single integer  — the number of perfect sequences modulo $$$M$$$.

Input: 2 998244353

Output: 4

Output: 4

Output: 4

Input: 4 100000007

Output: 32

Output: 32

Output: 32

Input: 69 999999937

Output: 456886663

Output: 456886663

Output: 456886663

Input: 200 998244353

Output: 180611733

Output: 180611733

Output: 180611733

Input: 200 550000001

Output: 481731577

Output: 481731577

Output: 481731577

Input: 200 549999959

Output: 178617235

Output: 178617235

Output: 178617235

Input: 1 100000007

Output: 2

Output: 2

Output: 2

Input: 10 267850993

Output: 38324

Output: 38324

Output: 38324

Input: 20 549999959

Output: 461862358

Output: 461862358

Output: 461862358

Input: 50 100757149

Output: 4745300

Output: 4745300

Output: 4745300

Input: 169 100757149

Output: 41487196

Output: 41487196

Output: 41487196

Input: 188 100757149

Output: 15934891

Output: 15934891

Output: 15934891

Input: 100 267850993

Output: 189712610

Output: 189712610

Output: 189712610

Input: 110 999999937

Output: 165234842

Output: 165234842

Output: 165234842

Input: 120 267850993

Output: 91785690

Output: 91785690

Output: 91785690

Input: 130 100757149

Output: 87253785

Output: 87253785

Output: 87253785

Input: 140 550000001

Output: 464259310

Output: 464259310

Output: 464259310

Input: 150 998244353

Output: 563043130

Output: 563043130

Output: 563043130

Input: 160 100757149

Output: 54532638

Output: 54532638

Output: 54532638

Input: 170 100000007

Output: 28293730

Output: 28293730

Output: 28293730

Input: 180 100757149

Output: 40944895

Output: 40944895

Output: 40944895

Input: 190 267850993

Output: 38309988

Output: 38309988

Output: 38309988

Input: 106 100757149

Output: 7881104

Output: 7881104

Output: 7881104

Input: 82 267850993

Output: 181769218

Output: 181769218

Output: 181769218

Input: 162 999999937

Output: 356680016

Output: 356680016

Output: 356680016

Input: 196 100000007

Output: 80552289

Output: 80552289

Output: 80552289

Input: 28 549999959

Output: 265377742

Output: 265377742

Output: 265377742

Input: 192 998244353

Output: 216873641

Output: 216873641

Output: 216873641

Input: 103 267850993

Output: 262873012

Output: 262873012

Output: 262873012

Input: 93 267850993

Output: 34145854

Output: 34145854

Output: 34145854

Input: 22 100757149

Output: 12864320

Output: 12864320

Output: 12864320

Input: 119 999999937

Output: 810859890

Output: 810859890

Output: 810859890

Input: 194 100000007

Output: 24964109

Output: 24964109

Output: 24964109

Input: 195 549999959

Output: 305462979

Output: 305462979

Output: 305462979

Input: 196 100757149

Output: 71649802

Output: 71649802

Output: 71649802

Input: 197 100000007

Output: 59296946

Output: 59296946

Output: 59296946

Input: 198 549999959

Output: 545511297

Output: 545511297

Output: 545511297

Input: 199 550000001

Output: 262511266

Output: 262511266

Output: 262511266

Input: 1 550000001

Output: 2

Output: 2

Output: 2

Input: 2 549999959

Output: 4

Output: 4

Output: 4

Input: 3 549999959

Output: 11

Output: 11

Output: 11

Input: 4 998244353

Output: 32

Output: 32

Output: 32

Input: 5 100757149

Output: 97

Output: 97

Output: 97

Input: 6 998244353

Output: 295

Output: 295

Output: 295

Input: 7 100000007

Output: 940

Output: 940

Output: 940

Input: 8 549999959

Output: 3148

Output: 3148

Output: 3148

Input: 9 999999937

Output: 10901

Output: 10901

Output: 10901

Input: 10 999999937

Output: 38324

Output: 38324

Output: 38324

Input: 190 999999937

Output: 259139303

Output: 259139303

Output: 259139303

Input: 191 100757149

Output: 22329873

Output: 22329873

Output: 22329873

Input: 192 999999937

Output: 960726876

Output: 960726876

Output: 960726876

Input: 193 998244353

Output: 959300190

Output: 959300190

Output: 959300190


There are $$$n$$$ heroes fighting in the arena. Initially, the $$$i$$$-th hero has $$$a_i$$$ health points.The fight in the arena takes place in several rounds. At the beginning of each round, each alive hero deals $$$1$$$ damage to all other heroes. Hits of all heroes occur simultaneously. Heroes whose health is less than $$$1$$$ at the end of the round are considered killed.If exactly $$$1$$$ hero remains alive after a certain round, then he is declared the winner. Otherwise, there is no winner.Your task is to calculate the number of ways to choose the initial health points for each hero $$$a_i$$$, where $$$1 \le a_i \le x$$$, so that there is no winner of the fight. The number of ways can be very large, so print it modulo $$$998244353$$$. Two ways are considered different if at least one hero has a different amount of health. For example, $$$[1, 2, 1]$$$ and $$$[2, 1, 1]$$$ are different.

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

Print one integer — the number of ways to choose the initial health points for each hero $$$a_i$$$, where $$$1 \le a_i \le x$$$, so that there is no winner of the fight, taken modulo $$$998244353$$$.

Input: 2 5

Output: 5

Output: 5

Output: 5

Output: 5

Output: 5

Output: 5

Input: 3 3

Output: 15

Output: 15

Output: 15

Output: 15

Output: 15

Output: 15

Input: 5 4

Output: 1024

Output: 1024

Output: 1024

Output: 1024

Output: 1024

Output: 1024

Input: 13 37

Output: 976890680

Output: 976890680

Output: 976890680

Output: 976890680

Output: 976890680

Output: 976890680

Input: 5 40

Output: 6613840

Output: 6613840

Output: 6613840

Output: 6613840

Output: 6613840

Output: 6613840

Input: 4 33

Output: 74061

Output: 74061

Output: 74061

Output: 74061

Output: 74061

Output: 74061

Input: 6 26

Output: 37929526

Output: 37929526

Output: 37929526

Output: 37929526

Output: 37929526

Output: 37929526

Input: 7 22

Output: 433133716

Output: 433133716

Output: 433133716

Output: 433133716

Output: 433133716

Output: 433133716

Input: 10 15

Output: 801988713

Output: 801988713

Output: 801988713

Output: 801988713

Output: 801988713

Output: 801988713

Input: 2 500

Output: 500

Output: 500

Output: 500

Output: 500

Output: 500

Output: 500

Input: 3 500

Output: 375500

Output: 375500

Output: 375500

Output: 375500

Output: 375500

Output: 375500

Input: 4 500

Output: 250499992

Output: 250499992

Output: 250499992

Output: 250499992

Output: 250499992

Output: 250499992

Input: 5 500

Output: 940552292

Output: 940552292

Output: 940552292

Output: 940552292

Output: 940552292

Output: 940552292

Input: 8 333

Output: 97191222

Output: 97191222

Output: 97191222

Output: 97191222

Output: 97191222

Output: 97191222

Input: 6 478

Output: 28573939

Output: 28573939

Output: 28573939

Output: 28573939

Output: 28573939

Output: 28573939

Input: 11 345

Output: 932713620

Output: 932713620

Output: 932713620

Output: 932713620

Output: 932713620

Output: 932713620

Input: 15 255

Output: 259067064

Output: 259067064

Output: 259067064

Output: 259067064

Output: 259067064

Output: 259067064

Input: 13 337

Output: 434551606

Output: 434551606

Output: 434551606

Output: 434551606

Output: 434551606

Output: 434551606

Input: 10 500

Output: 263020220

Output: 263020220

Output: 263020220

Output: 263020220

Output: 263020220

Output: 263020220

Input: 25 500

Output: 571274201

Output: 571274201

Output: 571274201

Output: 571274201

Output: 571274201

Output: 571274201

Input: 49 499

Output: 816854007

Output: 816854007

Output: 816854007

Output: 816854007

Output: 816854007

Output: 816854007

Input: 50 500

Output: 165073862

Output: 165073862

Output: 165073862

Output: 165073862

Output: 165073862

Output: 165073862

Input: 99 499

Output: 796227309

Output: 796227309

Output: 796227309

Output: 796227309

Output: 796227309

Output: 796227309

Input: 99 500

Output: 424278934

Output: 424278934

Output: 424278934

Output: 424278934

Output: 424278934

Output: 424278934

Input: 111 500

Output: 802132036

Output: 802132036

Output: 802132036

Output: 802132036

Output: 802132036

Output: 802132036

Input: 154 500

Output: 924911664

Output: 924911664

Output: 924911664

Output: 924911664

Output: 924911664

Output: 924911664

Input: 200 500

Output: 458968932

Output: 458968932

Output: 458968932

Output: 458968932

Output: 458968932

Output: 458968932

Input: 222 500

Output: 382157018

Output: 382157018

Output: 382157018

Output: 382157018

Output: 382157018

Output: 382157018

Input: 285 499

Output: 987275082

Output: 987275082

Output: 987275082

Output: 987275082

Output: 987275082

Output: 987275082

Input: 300 500

Output: 567125736

Output: 567125736

Output: 567125736

Output: 567125736

Output: 567125736

Output: 567125736

Input: 365 500

Output: 552203508

Output: 552203508

Output: 552203508

Output: 552203508

Output: 552203508

Output: 552203508

Input: 444 500

Output: 563065086

Output: 563065086

Output: 563065086

Output: 563065086

Output: 563065086

Output: 563065086

Input: 444 499

Output: 835857576

Output: 835857576

Output: 835857576

Output: 835857576

Output: 835857576

Output: 835857576

Input: 500 333

Output: 736893443

Output: 736893443

Output: 736893443

Output: 736893443

Output: 736893443

Output: 736893443

Input: 500 500

Output: 587613361

Output: 587613361

Output: 587613361

Output: 587613361

Output: 587613361

Output: 587613361

Input: 499 499

Output: 772771385

Output: 772771385

Output: 772771385

Output: 772771385

Output: 772771385

Output: 772771385

Input: 111 222

Output: 460833105

Output: 460833105

Output: 460833105

Output: 460833105

Output: 460833105

Output: 460833105

Input: 123 433

Output: 632273638

Output: 632273638

Output: 632273638

Output: 632273638

Output: 632273638

Output: 632273638

Input: 383 477

Output: 158983764

Output: 158983764

Output: 158983764

Output: 158983764

Output: 158983764

Output: 158983764

Input: 99 333

Output: 897436821

Output: 897436821

Output: 897436821

Output: 897436821

Output: 897436821

Output: 897436821

Input: 484 497

Output: 320480021

Output: 320480021

Output: 320480021

Output: 320480021

Output: 320480021

Output: 320480021

Input: 411 77

Output: 525290835

Output: 525290835

Output: 525290835

Output: 525290835

Output: 525290835

Output: 525290835

Input: 124 212

Output: 806210307

Output: 806210307

Output: 806210307

Output: 806210307

Output: 806210307

Output: 806210307

Input: 369 404

Output: 345642117

Output: 345642117

Output: 345642117

Output: 345642117

Output: 345642117

Output: 345642117

Input: 246 389

Output: 778435960

Output: 778435960

Output: 778435960

Output: 778435960

Output: 778435960

Output: 778435960

Input: 92 270

Output: 125864547

Output: 125864547

Output: 125864547

Output: 125864547

Output: 125864547

Output: 125864547

Input: 271 208

Output: 80367024

Output: 80367024

Output: 80367024

Output: 80367024

Output: 80367024

Output: 80367024

Input: 289 466

Output: 807999264

Output: 807999264

Output: 807999264

Output: 807999264

Output: 807999264

Output: 807999264

Input: 249 320

Output: 405917309

Output: 405917309

Output: 405917309

Output: 405917309

Output: 405917309

Output: 405917309

Input: 91 367

Output: 369540872

Output: 369540872

Output: 369540872

Output: 369540872

Output: 369540872

Output: 369540872

Input: 39 78

Output: 146956559

Output: 146956559

Output: 146956559

Output: 146956559

Output: 146956559

Output: 146956559

Input: 465 367

Output: 135201268

Output: 135201268

Output: 135201268

Output: 135201268

Output: 135201268

Output: 135201268

Input: 34 177

Output: 771060153

Output: 771060153

Output: 771060153

Output: 771060153

Output: 771060153

Output: 771060153

Input: 460 235

Output: 27900542

Output: 27900542

Output: 27900542

Output: 27900542

Output: 27900542

Output: 27900542

Input: 421 44

Output: 312830719

Output: 312830719

Output: 312830719

Output: 312830719

Output: 312830719

Output: 312830719

Input: 390 208

Output: 709071139

Output: 709071139

Output: 709071139

Output: 709071139

Output: 709071139

Output: 709071139

Input: 251 203

Output: 921135826

Output: 921135826

Output: 921135826

Output: 921135826

Output: 921135826

Output: 921135826

Input: 191 22

Output: 285057520

Output: 285057520

Output: 285057520

Output: 285057520

Output: 285057520

Output: 285057520

Input: 198 236

Output: 93097976

Output: 93097976

Output: 93097976

Output: 93097976

Output: 93097976

Output: 93097976

Input: 376 314

Output: 795015160

Output: 795015160

Output: 795015160

Output: 795015160

Output: 795015160

Output: 795015160

Input: 26 178

Output: 373528200

Output: 373528200

Output: 373528200

Output: 373528200

Output: 373528200

Output: 373528200

Input: 189 92

Output: 283119998

Output: 283119998

Output: 283119998

Output: 283119998

Output: 283119998

Output: 283119998

Input: 13 93

Output: 962803010

Output: 962803010

Output: 962803010

Output: 962803010

Output: 962803010

Output: 962803010

Input: 71 439

Output: 299896905

Output: 299896905

Output: 299896905

Output: 299896905

Output: 299896905

Output: 299896905

Input: 438 46

Output: 312807374

Output: 312807374

Output: 312807374

Output: 312807374

Output: 312807374

Output: 312807374

Input: 357 328

Output: 186454845

Output: 186454845

Output: 186454845

Output: 186454845

Output: 186454845

Output: 186454845

Input: 384 467

Output: 946997121

Output: 946997121

Output: 946997121

Output: 946997121

Output: 946997121

Output: 946997121

Input: 371 306

Output: 512015273

Output: 512015273

Output: 512015273

Output: 512015273

Output: 512015273

Output: 512015273

Input: 265 181

Output: 178439722

Output: 178439722

Output: 178439722

Output: 178439722

Output: 178439722

Output: 178439722

Input: 311 33

Output: 836810892

Output: 836810892

Output: 836810892

Output: 836810892

Output: 836810892

Output: 836810892

Input: 298 51

Output: 631137022

Output: 631137022

Output: 631137022

Output: 631137022

Output: 631137022

Output: 631137022

Input: 193 402

Output: 490804249

Output: 490804249

Output: 490804249

Output: 490804249

Output: 490804249

Output: 490804249

Input: 119 371

Output: 207908744

Output: 207908744

Output: 207908744

Output: 207908744

Output: 207908744

Output: 207908744

Input: 459 365

Output: 266156666

Output: 266156666

Output: 266156666

Output: 266156666

Output: 266156666

Output: 266156666

Input: 222 422

Output: 858431457

Output: 858431457

Output: 858431457

Output: 858431457

Output: 858431457

Output: 858431457

Input: 195 15

Output: 518355052

Output: 518355052

Output: 518355052

Output: 518355052

Output: 518355052

Output: 518355052

Input: 224 375

Output: 555865043

Output: 555865043

Output: 555865043

Output: 555865043

Output: 555865043

Output: 555865043

Input: 246 348

Output: 875068738

Output: 875068738

Output: 875068738

Output: 875068738

Output: 875068738

Output: 875068738

Input: 291 150

Output: 491847623

Output: 491847623

Output: 491847623

Output: 491847623

Output: 491847623

Output: 491847623

Input: 171 489

Output: 316053655

Output: 316053655

Output: 316053655

Output: 316053655

Output: 316053655

Output: 316053655

Input: 162 427

Output: 10603436

Output: 10603436

Output: 10603436

Output: 10603436

Output: 10603436

Output: 10603436

Input: 350 463

Output: 580010430

Output: 580010430

Output: 580010430

Output: 580010430

Output: 580010430

Output: 580010430

Input: 161 37

Output: 141211019

Output: 141211019

Output: 141211019

Output: 141211019

Output: 141211019

Output: 141211019

Input: 500 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Output: 1

Input: 164 500

Output: 411608690

Output: 411608690

Output: 411608690

Output: 411608690

Output: 411608690

Output: 411608690

Input: 499 500

Output: 724043052

Output: 724043052

Output: 724043052

Output: 724043052

Output: 724043052

Output: 724043052