{"raw_statement":[{"iden":"problem statement","content":"Find the number of sequences of $N$ non-negative integers $A_1, A_2, ..., A_N$ that satisfy the following conditions:\n\n*   $L \\leq A_1 + A_2 + ... + A_N \\leq R$\n*   When the $N$ elements are sorted in non-increasing order, the $M$\\-th and $(M+1)$\\-th elements are equal.\n\nSince the answer can be enormous, print it modulo $10^9+7$."},{"iden":"constraints","content":"*   All values in input are integers.\n*   $1 \\leq M < N \\leq 3 \\times 10^5$\n*   $1 \\leq L \\leq R \\leq 3 \\times 10^5$"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$ $L$ $R$"},{"iden":"sample input 1","content":"4 2 3 7"},{"iden":"sample output 1","content":"105\n\nThe sequences of non-negative integers that satisfy the conditions are:\n$\\begin{aligned} &(1, 1, 1, 0), (1, 1, 1, 1), (2, 1, 1, 0), (2, 1, 1, 1), (2, 2, 2, 0), (2, 2, 2, 1), \\\\ &(3, 0, 0, 0), (3, 1, 1, 0), (3, 1, 1, 1), (3, 2, 2, 0), (4, 0, 0, 0), (4, 1, 1, 0), \\\\ &(4, 1, 1, 1), (5, 0, 0, 0), (5, 1, 1, 0), (6, 0, 0, 0), (7, 0, 0, 0)\\end{aligned}$\nand their permutations, for a total of $105$ sequences."},{"iden":"sample input 2","content":"2 1 4 8"},{"iden":"sample output 2","content":"3\n\nThe three sequences that satisfy the conditions are $(2, 2)$, $(3, 3)$, and $(4, 4)$."},{"iden":"sample input 3","content":"141592 6535 89793 238462"},{"iden":"sample output 3","content":"933832916"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}