~/algor $ cat problems/kombinatorika-katalan-soni
Number of balanced bracket sequences
Medium
1000 ms
128 MB
66%
Find how many balanced bracket sequences can be made from $n$ pairs of brackets (( and )). A sequence is balanced if it has $n$ characters ( and $n$ characters ) and in every prefix of it the number of ( is not less than the number of ).
Input
One positive integer $n$.
Output
One integer — the number of sequences modulo $10^{9} + 7$.
Note
$1 \le n \le 5 * 10^{5}$
Examples
Input #1
3
Output #1
5
Input #2
1
Output #2
1