Easy Permutation Problem

Define an alternating permutation of the set {1,2,3,...,n} to be an arrangement of those numbers such that the permutation a1 . . . an satisfies (ai−1 < ai AND ai > ai+1) or (ai−1 > ai AND ai < ai+1) for all 1 < i < n. In this problem, compute the number of alternating permutations for a given triple of (n,a1,an). Input Anumberofofinputs(≤1500),eachlinewithn,a1,an (2≤n≤2000,1≤a1,an ≤n). Output For each input, output the total number of permutations modulo 1000000007 on one line. Sample Input 212 423 Sample Output 1 2