This page is still under construction.

Parts of this page are still being built. What you see may change.

KBTU Party

Time limit2sMemory limit128 MB

Summary
Count the ways to choose r disjoint acquainted girl-boy pairs when girl j knows exactly the first 2j-1 boys, modulo 2946859.
Level

Hard8 of 10

Topics
Combinatorics, Dynamic programming, Math, Number theory
Solved
No attempts yet

Problem

At the KBTU graduation party there are nn girls D1,D2,…,DnD_1, D_2, \dots, D_n and 2n−12n-1 boys B1,B2,…,B2n−1B_1, B_2, \dots, B_{2n-1}. Girl DjD_j is acquainted with exactly the boys B1,B2,…,B2j−1B_1, B_2, \dots, B_{2j-1} (the first 2j−12j-1 boys).

We want to pick exactly rr dancing pairs. Each pair consists of one girl and one boy who are acquainted, and no student may belong to more than one pair (every girl and every boy appears in at most one chosen pair). Count the number of ways to choose such a set of rr pairwise-disjoint acquainted pairs. Two choices are considered different if their sets of pairs differ.

Input

Two integers nn and rr (1≤n,r≤1061 \le n, r \le 10^6) separated by a space.

Output

Print the number of ways, taken modulo 29468592946859.

Examples1

  1. Example 1

    Input
    3 2
    
    Expected output
    18