Andrey thinks he is truly a successful developer, but in reality he didn't know about the binary search algorithm until recently. After reading some literature Andrey understood that this algorithm allows to quickly find a certain number $x$ in an array. For an array $a$ indexed from zero, and an integer $x$ the pseudocode of the algorithm is as follows:

BinarySearch(a, x)
  left = 0
  right = a.size()
  while left < right
    middle = (left + right) / 2
    if a[middle] <= x then
      left = middle + 1
    else
      right = middle
  
  if left > 0 and a[left - 1] == x then
    return true
  else
    return false

Note that the elements of the array are indexed from zero, and the division is done in integers (rounding down).

Andrey read that the algorithm only works if the array is sorted. However, he found this statement untrue, because there certainly exist unsorted arrays for which the algorithm find $x$!

Andrey wants to write a letter to the book authors, but before doing that he must consider the permutations of size $n$ such that the algorithm finds $x$ in them. A permutation of size $n$ is an array consisting of $n$ distinct integers between $1$ and $n$ in arbitrary order.

Help Andrey and find the number of permutations of size $n$ which contain $x$ at position $pos$ and for which the given implementation of the binary search algorithm finds $x$ (returns true). As the result may be extremely large, print the remainder of its division by $10^9+7$.


-----Input-----

The only line of input contains integers $n$, $x$ and $pos$ ($1 \le x \le n \le 1000$, $0 \le pos \le n - 1$) — the required length of the permutation, the number to search, and the required position of that number, respectively.


-----Output-----

Print a single number — the remainder of the division of the number of valid permutations by $10^9+7$.


-----Examples-----
Input
4 1 2

Output
6

Input
123 42 24

Output
824071958



-----Note-----

All possible permutations in the first test case: $(2, 3, 1, 4)$, $(2, 4, 1, 3)$, $(3, 2, 1, 4)$, $(3, 4, 1, 2)$, $(4, 2, 1, 3)$, $(4, 3, 1, 2)$.

Source: codeforces | Difficulty: MEDIUM
Tags: Sorting

Combinatorics


Solutions:
import bisect
import math

def binsearch(arr, x):
	left = 0
	right = len(arr)
	big = 0
	small = 0
	while left < right:
		middle = int((left + right) / 2)
		if arr[middle] < x:
			left = middle + 1
			small += 1
		elif arr[middle] == x:
			left = middle + 1
		else:
			right = middle
			big += 1
	return (big, small)
	pass

def solve(n, x, pos):
	p = 10 ** 9 + 7
	arr = [int(x) for x in range(n)]
	(big, small) = binsearch(arr, pos)
	k1 = math.factorial(small) * math.comb(x - 1, small)
	k2 = math.factorial(big) * math.comb(n - x, big)
	per = math.factorial(n - (small + big + 1))
	return k1 % p * k2 % p * per % p % p
	pass
t = 1
ans = []
for i in range(t):
	s = [int(x) for x in input().split()]
	n = s[0]
	x = s[1]
	pos = s[2]
	ans.append(solve(n, x, pos))
for a in ans:
	print(a)


mod = 10 ** 9 + 7

class Combi:

	def __init__(self, N, mod):
		self.power = [1 for _ in range(N + 1)]
		self.rev = [1 for _ in range(N + 1)]
		self.mod = mod
		for i in range(2, N + 1):
			self.power[i] = self.power[i - 1] * i % self.mod
		self.rev[N] = pow(self.power[N], self.mod - 2, self.mod)
		for j in range(N, 0, -1):
			self.rev[j - 1] = self.rev[j] * j % self.mod

	def C(self, K, R):
		if K < R:
			return 0
		else:
			return self.power[K] * self.rev[K - R] * self.rev[R] % self.mod

	def P(self, K, R):
		if K < R:
			return 0
		else:
			return self.power[K] * self.rev[K - R] % self.mod

	def Pow(self, X):
		return self.power[X]

def main():
	(n, x, pos) = map(int, input().split())
	c = Combi(1100, mod)
	que = []
	l = 0
	r = n
	(upper, lower) = (0, 0)
	while r > l:
		m = (r + l) // 2
		if m <= pos:
			que.append((m, 'a[middle]<=x'))
			l = m + 1
		elif m > pos:
			que.append((m, 'a[middle]>x'))
			r = m
	for (v, comment) in que:
		if v > pos:
			upper += 1
		elif v < pos:
			lower += 1
	ans = c.P(n - x, upper) * c.P(x - 1, lower) * c.Pow(n - upper - lower - 1) % mod
	print(ans)
	return
main()


(n, x, a) = map(int, input().split())
ans = 1
cnt = 0
cnt1 = 0
left = 0
right = n
mod = 1000000007
while left < right:
	mid = (left + right) // 2
	if mid < a:
		ans *= x - 1 - cnt1
		ans %= mod
		cnt1 += 1
		left = mid + 1
	elif mid > a:
		ans *= n - x - cnt
		ans %= mod
		cnt += 1
		right = mid
	else:
		left = mid + 1
cr = n - cnt - cnt1 - 1
for i in range(1, cr + 1):
	ans *= i
	ans %= mod
print(ans)


(n, x, pos) = map(int, input().split())
a = [i for i in range(n)]
zero = 0
one = 0
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	if a[middle] <= pos:
		zero += 1
		left = middle + 1
	else:
		one += 1
		right = middle
res = 1
mod = 10 ** 9 + 7
for i in range(zero - 1):
	res *= x - 1 - i
	res %= mod
for i in range(one):
	res *= n - x - i
	res %= mod
for j in range(n - zero - one):
	res *= j + 1
	res %= mod
print(res)


import array
(n, x, p) = map(int, input().split())
(s0, s1) = (x - 1, n - x)

def find(l, r, s0, s1):
	if l == r:
		return (s0, s1)
	mid = (l + r) // 2
	if mid > p:
		s1 -= 1
	if mid < p:
		s0 -= 1
	if mid <= p:
		(s0, s1) = find(mid + 1, r, s0, s1)
	else:
		(s0, s1) = find(l, mid, s0, s1)
	return (s0, s1)
(s0, s1) = find(0, n, s0, s1)
if s0 < 0 or s1 < 0:
	print(0)
else:
	ans = 1
	for i in range(1, s0 + s1 + 1):
		ans = ans * i
	for i in range(1, s0 + 1):
		ans = ans // i
	for i in range(1, s1 + 1):
		ans = ans // i
	for i in range(1, x - 1 + 1):
		ans = ans * i
	for i in range(1, n - x + 1):
		ans = ans * i
	print(ans % 1000000007)


import sys, math, itertools, collections, copy
input = sys.stdin.readline
MOD = 10 ** 9 + 7
(n, x, pos) = map(int, input().split())
(lo, hi, smaller, bigger) = (0, n, x - 1, n - x)
low_bigger = bigger
low_smaller = smaller
cnt = 0

def f(n):
	if n <= 1:
		return 1
	ans = 1
	for i in range(2, n + 1):
		ans *= i % MOD
	return ans
while lo < hi:
	mid = lo + hi >> 1
	if pos < mid:
		low_bigger -= 1
		hi = mid
	elif pos == mid:
		lo = mid + 1
	else:
		low_smaller -= 1
		lo = mid + 1
	cnt += 1
if low_smaller < 0 or low_bigger < 0:
	print(0)
else:
	ans1 = f(bigger) // f(low_bigger) % MOD
	ans2 = f(smaller) // f(low_smaller) % MOD
	print(ans1 * ans2 * f(n - cnt) % MOD)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def lcm(a, b):
	return abs(a // gcd(a, b) * b)

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a
N = 100000
mod = 10 ** 9 + 7
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
for i in range(2, N + 1):
	fac.append(fac[-1] * i % mod)
	inv.append(mod - inv[mod % i] * (mod // i) % mod)
	finv.append(finv[-1] * inv[-1] % mod)

def comb(n, r):
	if n < r:
		return 0
	else:
		return fac[n] * (finv[r] * finv[n - r] % mod) % mod

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

def yes():
	print('Yes')

def no():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
from math import *

def binary(n, x):
	l = 0
	r = n
	cl = 0
	cr = 0
	while l < r:
		m = (l + r) // 2
		if m == x:
			l = m + 1
		elif m < x:
			l = m + 1
			cl += 1
		else:
			r = m
			cr += 1
	return (cl, cr)

def solve():
	(n, x, pos) = sep()
	(cl, cr) = binary(n, pos)
	a = x - 1
	b = n - x
	t = comb(a, cl) * comb(b, cr) * fac[n - cl - cr - 1] * fac[cl] * fac[cr]
	print(t % mod)
solve()


mod = 1000000007
big = 0
small = 0
fact = []

def c(n: int, k: int):
	if n < k:
		return 0
	return fact[n] // (fact[k] * fact[n - k]) % mod

def binary(n: int, pos: int):
	l = 0
	r = n
	while l < r:
		mid = (l + r) // 2
		if mid <= pos:
			if mid != pos:
				global small
				small += 1
			l = mid + 1
		else:
			r = mid
			global big
			big += 1
fVal = 1
for i in range(1, 1005):
	fact.append(fVal)
	fVal = fVal * i
(n, x, pos) = map(int, input().split())
binary(n, pos)
ans = c(x - 1, small) * fact[small] * c(n - x, big) * fact[big] * fact[n - small - big - 1]
print(int(ans % mod))


M = 10 ** 9 + 7
(n, c, k) = map(int, input().split())
s = c - 1
b = n - c
l = 0
r = n
m = (l + r) // 2
ans = 1
count = 0
while l < r:
	m = (l + r) // 2
	if m < k:
		l = m + 1
		ans *= s
		s -= 1
	elif m == k:
		l = m + 1
	else:
		r = m
		ans *= b
		b -= 1
k = s + b
while k:
	ans = ans * k % M
	k -= 1
print(ans % M)


import os
import sys
from io import BytesIO, IOBase
import math
from collections import defaultdict, deque
from itertools import combinations
import random
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, a, b) = map(int, input().split(' '))
m = pow(10, 9) + 7
ans = 1
(l, h) = (0, n)
c = 0
(p, q) = (n - a, a - 1)
while l < h:
	z = (l + h) // 2
	if b == z:
		l = z + 1
	elif b > z:
		ans *= q
		q -= 1
		c += 1
		l = z + 1
	else:
		ans *= p
		p -= 1
		c += 1
		h = z
ans %= m
for i in range(2, n - c):
	ans *= i
	ans %= m
print(ans % m)


import math
MOD = int(1000000000.0 + 7)

def permutations(n, k):
	if n >= k:
		return math.factorial(n) // math.factorial(n - k)
	return 0
(n, x, pos) = list(map(int, input().split()))
(mins, maxs) = (0, 0)
(l, r) = (0, n)
while l < r:
	m = (l + r) // 2
	if m <= pos:
		l = m + 1
		if m < pos:
			mins += 1
	elif m > pos:
		maxs += 1
		r = m
if mins < x and maxs <= n - x:
	p1 = permutations(x - 1, mins)
	p2 = permutations(n - x, maxs)
	print(p1 * p2 * math.factorial(n - maxs - mins - 1) % MOD)
else:
	print(0)


mod = 1000000007
(n, x, pos) = map(int, input().split())
(top, bot, lo, hi) = (n, 0, 0, 0)
while top > bot:
	mid = top + bot >> 1
	if mid > pos:
		hi += 1
		top = mid
	else:
		if mid < pos:
			lo += 1
		bot = mid + 1
(F, I) = ([1 for _ in range(n + 1)], [1 for _ in range(n + 1)])
for i in range(1, n + 1):
	F[i] = i * F[i - 1] % mod
for i in range(2, n + 1):
	I[i] = (mod - mod // i) * I[mod % i] % mod
for i in range(1, n + 1):
	I[i] = I[i] * I[i - 1] % mod

def binom(n, k):
	if n < k or k < 0:
		return 0
	else:
		return F[n] * I[k] % mod * I[n - k] % mod
ans = binom(n - x, hi) * F[hi] % mod * binom(x - 1, lo) % mod * F[lo] % mod * F[n - hi - lo - 1] % mod
print(ans)


import math
mod = 10 ** 9 + 7
(n, x, pos) = list(map(int, input().split()))
(l, h) = (0, n)
gv = n - x
lv = x - 1
out = 1
cnt = 0
while l < h:
	m = (l + h) // 2
	cnt += 1
	if m == pos:
		l = m + 1
	elif m < pos:
		l = m + 1
		out *= lv
		lv -= 1
	else:
		h = m
		out *= gv
		gv -= 1
	out %= mod
out *= math.factorial(n - cnt) % mod
out %= mod
print(out)


prime = 10 ** 9 + 7

def process(n, x, pos):
	s = 0
	e = n
	smaller = []
	larger = []
	while s < e:
		m = (s + e) // 2
		if m <= pos:
			if m < pos:
				smaller.append(m)
			s = m + 1
		else:
			larger.append(m)
			e = m
	if x - 1 < len(smaller):
		return 0
	num1 = 1
	num2 = 1
	num3 = 1
	for i in range(len(smaller)):
		num1 = num1 * (x - 1 - i) % prime
	for i in range(len(larger)):
		num2 = num2 * (n - x - i) % prime
	for i in range(1, n - (len(smaller) + len(larger))):
		num3 = num3 * i % prime
	answer = num1 * num2 * num3 % prime
	return answer
(n, x, pos) = [int(x) for x in input().split()]
print(process(n, x, pos))


(n, x, p) = map(int, input().split())
ans = 1
l = x - 1
r = n - x
b = 0
e = n
while b < e:
	m = b + e
	m //= 2
	if p < m:
		e = m
		ans = ans * r % 1000000007
		r -= 1
		n -= 1
	elif p > m:
		b = m + 1
		ans = ans * l % 1000000007
		l -= 1
		n -= 1
	else:
		b = m + 1
for i in range(1, n):
	ans = ans * i % 1000000007
print(ans)


from collections import defaultdict as dd
import sys
mod = 10 ** 9 + 7
input = sys.stdin.readline
(n, x, pos) = map(int, input().split())
l = x - 1
r = n - x
lo = 0
hi = n
res = 1
while hi - lo >= 1:
	cmid = (lo + hi) // 2
	if pos < cmid:
		res = res * r % mod
		r -= 1
		hi = cmid
	elif pos > cmid:
		res = res * l % mod
		l -= 1
		lo = cmid + 1
	else:
		lo = cmid + 1
left = l + r
for i in range(1, left + 1):
	res = res * i % mod
print(res)


def ncr(n, r, p):
	if r > n:
		return 0
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def fac(n, p):
	if n >= p:
		return 0
	result = 1
	for i in range(1, n + 1):
		result = result * i % p
	return result
(n, x, pos) = list(map(int, input().split(' ')))
s = g = 0
a = 0
b = n
while a < b:
	mid = (a + b) // 2
	if mid <= pos:
		s += 1
		a = mid + 1
	else:
		g += 1
		b = mid
p = 1000
p = p * p * p + 7
print(ncr(x - 1, s - 1, p) * fac(s - 1, p) * ncr(n - x, g, p) * fac(g, p) * fac(n - s - g, p) % p)


import math
(n, x, pos) = map(int, input().split())
l = 0
r = n
a = 0
b = 0
p = 1000000007
while l < r:
	m = math.floor((l + r) / 2)
	if m < pos:
		a = a + 1
		l = m + 1
	elif m > pos:
		b = b + 1
		r = m
	elif m == pos:
		l = m + 1
n1 = x - 1
n2 = n - x
if n1 - a < 0 or n2 - b < 0:
	print('0')
else:
	ans = math.factorial(n1) // math.factorial(n1 - a) % p
	ans = ans * math.factorial(n2) // math.factorial(n2 - b) % p
	ans = ans * math.factorial(n - a - b - 1) % p
	print(ans)


MOD = int(1000000000.0 + 7)
from math import factorial
(n, x, p) = input().split()
(n, x, p) = (int(n), int(x), int(p))
s = 0
e = n

def perm(n, k):
	if k <= n:
		return factorial(n) // factorial(n - k)
	else:
		return 0
pos_greater_than = 0
pos_less_than = 0
while s < e:
	mid = (s + e) // 2
	if p < mid:
		pos_greater_than += 1
		e = mid
	elif p >= mid:
		s = mid + 1
		if p > mid:
			pos_less_than += 1
ans1 = perm(n - x, pos_greater_than)
ans2 = perm(x - 1, pos_less_than)
ans3 = factorial(n - pos_greater_than - pos_less_than - 1)
ans = ans1 * ans2 * ans3 % MOD
print(ans)


(n, x, pos) = map(int, input().split())
u = [0] * n
u[pos] = x
for i in range(pos + 1, n):
	u[i] = x + 1
L = 0
R = n
cnt1 = cnt2 = 0
a = []
b = []
while L < R:
	M = (L + R) // 2
	if u[M] <= x:
		if M != pos:
			cnt1 += 1
			a.append(M)
		L = M + 1
	else:
		cnt2 += 1
		b.append(M)
		R = M
ans = 1
q = 10 ** 9 + 7
z = x - 1
for i in range(cnt1):
	ans *= z
	z -= 1
	ans %= q
z = n - x
for i in range(cnt2):
	ans *= z
	z -= 1
	ans %= q
z = n - cnt1 - cnt2 - 1
for i in range(z):
	ans *= z
	z -= 1
	ans %= q
print(ans)


(n, x, pos) = map(int, input().split())
(l, r) = (0, n)
(hasS, hasB) = (x - 1, n - x)
mod = 1000000007
ans = 1
fact = []
fact.append(1)
for i in range(n + 1):
	fact.append(fact[i] * (i + 1))
while l < r:
	mid = (l + r) // 2
	if pos >= mid:
		l = mid + 1
		if mid != pos:
			ans *= hasS
			hasS -= 1
	else:
		r = mid
		ans *= hasB
		hasB -= 1
ans *= fact[hasS + hasB]
print(ans % mod)


(n, x, pos) = map(int, input().split())
a = [i for i in range(n)]
mod = 10 ** 9 + 7
lower = 0
higher = 0
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	if a[middle] <= pos:
		lower += 1
		left = middle + 1
	else:
		higher += 1
		right = middle
res = 1
num_l = x - 1
num_h = n - x
lower -= 1
for i in range(lower):
	res *= num_l
	res %= mod
	num_l -= 1
for i in range(higher):
	res *= num_h
	res %= mod
	num_h -= 1
for i in range(1, n - lower - higher):
	res *= i
	res %= mod
print(res)


import math

def fact(n):
	prod = 1
	for i in range(2, n + 1):
		prod = prod * i % mod
	return prod
(n, x, p) = (int(i) for i in input().split())
mod = 1000000007
prod = 1
g = n - x
l = x - 1
c = 0
left = 0
right = n
while left < right:
	mid = (left + right) // 2
	if mid > p:
		prod = prod * g % mod
		g -= 1
		right = mid
		c += 1
	elif mid < p:
		prod = prod * l % mod
		l -= 1
		left = mid + 1
		c += 1
	else:
		left = mid + 1
		c += 1
print(prod * fact(n - c) % mod % mod)


import math
(n, x, pos) = [int(x) for x in input().split()]
greater = n - x
smaller = x - 1
ans = 1
arr = [int(x) for x in range(1, n + 1)]

def binarysearch1(arr, si, ei, qi, smaller, greater, ans):
	mid = (si + ei) // 2
	if si == ei:
		print(ans * math.factorial(greater + smaller) % (10 ** 9 + 7))
		return True
	if qi == mid:
		binarysearch1(arr, mid + 1, ei, qi, smaller, greater, ans)
	if qi < mid:
		ans = ans * greater
		greater -= 1
		binarysearch1(arr, si, mid, qi, smaller, greater, ans)
	elif qi > mid:
		ans = ans * smaller
		smaller -= 1
		binarysearch1(arr, mid + 1, ei, qi, smaller, greater, ans)
binarysearch1(arr, 0, n, pos, smaller, greater, ans)


MOD = int(1000000000.0 + 7)
(n, x, pos) = map(int, input().split())
under_cnt = x - 1
over_cnt = n - x
under = 0
over = 0
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	if middle < pos:
		left = middle + 1
		under += 1
	elif middle > pos:
		right = middle
		over += 1
	else:
		left = middle + 1
if under > under_cnt or over_cnt < over:
	print(0)
else:
	answer = 1
	for i in range(under):
		answer = answer * (under_cnt - i) % MOD
	for i in range(over):
		answer = answer * (over_cnt - i) % MOD
	for i in range(1, n - under - over):
		answer = answer * i % MOD
	print(answer)


MAXN = 1005
mod = 10 ** 9 + 7

def nCr(n, r):
	global fact
	if r > n:
		return 0
	num = fact[n]
	denom = fact[r] * fact[n - r] % mod
	return num * pow(denom, mod - 2, mod) % mod
(n, x, pos) = map(int, input().split())
bits = len(bin(n)[2:])
if (1 << 30) % n == 0:
	bits -= 1
fact = [1] * MAXN
for i in range(1, MAXN):
	fact[i] = fact[i - 1] * i % mod
binary = ''
arr = [i for i in range(n)]
left = 0
right = n
more = n - x
less = x - 1
while left < right:
	middle = (left + right) // 2
	if arr[middle] <= pos:
		left = middle + 1
		binary += '0'
	else:
		right = middle
		binary += '1'
less = binary.count('0')
more = binary.count('1')
a = nCr(x - 1, less - 1) * fact[less - 1]
b = nCr(n - x, more) * fact[more]
print(a * b * fact[n - (more + less)] % mod)


pr = []

def ok(n, t):
	left = 0
	right = n
	while left < right:
		m = int((left + right) / 2)
		pr.append(m)
		if m <= t:
			left = m + 1
		else:
			right = m
	return
mod = int(1000000000.0) + 7
(n, m, idx) = map(int, input().split())
ok(n, idx)
(big, small, res) = (n - m, m - 1, 1)
for i in pr:
	if i > idx:
		res = res * big % mod
		big -= 1
	elif i < idx:
		res = res * small % mod
		small -= 1
	else:
		res = res % mod
for i in range(1, n - len(pr) + 1):
	res = res * i % mod
print(res)


import sys
MAX = 1000000007

def getSteps(n, pos):
	left = 0
	right = n
	ops = []
	while left < right:
		curPos = (left + right) // 2
		if curPos <= pos:
			if curPos == pos:
				ops.append('X')
			else:
				ops.append('S')
			left = curPos + 1
		else:
			right = curPos
			ops.append('L')
	return ops

def solve(n, x, pos):
	smallerNums = x - 1
	largerNums = n - x
	opsList = getSteps(n, pos)
	total = 1
	for op in opsList:
		if op == 'L':
			total *= largerNums
			largerNums -= 1
		elif op == 'S':
			total *= smallerNums
			smallerNums -= 1
		if total == 0:
			return 0
	remainingNums = smallerNums + largerNums
	while remainingNums > 1:
		total = total * remainingNums % MAX
		remainingNums -= 1
	return total

def readinput():
	(n, x, pos) = map(int, sys.stdin.readline().rstrip().split(' '))
	print(solve(n, x, pos))
readinput()


import sys
import math
input = lambda : sys.stdin.readline().rstrip()
(n, x, pos) = map(int, input().split())
less = x - 1
more = n - x
l = 0
r = n
c = 1
avail = n - 1
mod = 10 ** 9 + 7
while l < r:
	mid = (l + r) // 2
	if mid == pos:
		l = mid + 1
	elif mid < pos:
		c *= less
		less -= 1
		l = mid + 1
		avail -= 1
	else:
		c *= more
		more -= 1
		r = mid
		avail -= 1
less += more
c *= math.factorial(less)
print(c % mod)


mod = 10 ** 9 + 7
(n, x, pos) = map(int, input().split())
ans = 1
(a, b, c) = (list(range(1, n + 1)), 0, 0)
(l, r) = (0, n)
while l < r:
	m = (l + r) // 2
	if a[m] <= pos + 1:
		if a[m] != pos + 1:
			b += 1
		l = m + 1
	else:
		r = m
		c += 1
for i in range(x - 1, max(x - 1 - b, -1), -1):
	ans = ans * i % mod
for i in range(n - x, max(n - x - c, -1), -1):
	ans = ans * i % mod
for i in range(n - c - b - 1, 0, -1):
	ans = ans * i % mod
print(ans % mod)


from functools import reduce

def count_choices(a, x):
	(left_b, right_b) = (0, 0)
	left = 0
	right = a
	while left < right:
		middle = int((left + right) / 2)
		if middle <= x:
			left = middle + 1
			right_b += 1
		else:
			right = middle
			left_b += 1
	return [left_b, right_b - 1]
(n, x, pos) = map(int, input().split(' '))
lower_bound = x - 1
upper_bound = n - x
[gt_x, lt_x] = count_choices(n, pos)
if lower_bound - lt_x < 0 or upper_bound - gt_x < 0:
	print(0)
else:
	print(reduce(lambda a, b: a * b % (10 ** 9 + 7), [*range(lower_bound, lower_bound - lt_x, -1)] + [*range(upper_bound, upper_bound - gt_x, -1)] + [*range(1, n - gt_x - lt_x)], 1))


from sys import stdin, stdout
from math import factorial as f
from random import randint, shuffle
input = stdin.readline
mod = 10 ** 9 + 7

def inv(x):
	return pow(x, mod - 2, mod)

def c(n, k):
	if k < 0 or n < k:
		return 0
	return f[n] * inv(f[n - k]) % mod
(n, x, p) = map(int, input().split())
f = [1]
for i in range(1, n + 1):
	f.append(f[-1] * i % mod)
l = 0
r = n
a = b = 0
while l < r:
	m = l + r >> 1
	if m == p:
		l = m + 1
	elif m > p:
		r = m
		a += 1
	else:
		l = m + 1
		b += 1
print(c(x - 1, b) * c(n - x, a) * f[n - a - b - 1] % mod)


from sys import stdin, stdout

def INI():
	return int(stdin.readline())

def INL():
	return [int(_) for _ in stdin.readline().split()]

def INS():
	return stdin.readline()

def OPS(ans):
	stdout.write(str(ans) + '\n')

def OPL(ans):
	[stdout.write(str(_) + ' ') for _ in ans]
	stdout.write('\n')
from math import factorial as F
(n, x, pos) = INL()
l = 0
r = n
a = 0
b = 0
ans = 1
while l < r:
	m = (l + r) // 2
	if m <= pos:
		l = m + 1
		a += m != pos
	else:
		r = m
		b += 1
for _ in range(a):
	ans *= x - 1 - _
for _ in range(b):
	ans *= n - x - _
ans *= F(n - a - b - 1)
OPS(ans % (pow(10, 9) + 7))


import sys
import re
import random
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
input = sys.stdin.readline
getS = lambda : input().strip()
getN = lambda : int(input())
getList = lambda : list(map(int, input().split()))
getZList = lambda : [int(x) - 1 for x in input().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
divide = lambda x: pow(x, MOD - 2, MOD)

def solve():
	(n, x, pos) = getList()
	dai = n - x
	syo = x - 1
	ans = 1
	l = 0
	r = n
	while l < r:
		mid = (l + r) // 2
		if mid == pos:
			l = mid + 1
		elif mid > pos:
			ans *= dai
			ans %= MOD
			dai -= 1
			r = mid
		else:
			ans *= syo
			ans %= MOD
			syo -= 1
			l = mid + 1
	zan = dai + syo
	for i in range(1, zan + 1):
		ans *= i
		ans %= MOD
	print(ans)

def main():
	n = getN()
	for _ in range(n):
		solve()
	return
solve()


st = input().split()
n = int(st[0])
x = int(st[1])
pos = int(st[2])
mniejsze = 0
wieksze = 0
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	if middle > pos:
		wieksze += 1
		right = middle
	else:
		if middle < pos:
			mniejsze += 1
		left = middle + 1
l_wiekszych = n - x
l_mniejszych = n - 1 - l_wiekszych
result = 1
m = n - 1 - mniejsze - wieksze
while m > 0:
	result = m * result % 1000000007
	m -= 1
m = l_wiekszych
while wieksze > 0:
	result = m * result % 1000000007
	m -= 1
	wieksze -= 1
m = l_mniejszych
while mniejsze > 0:
	result = m * result % 1000000007
	m -= 1
	mniejsze -= 1
print(result)


from math import factorial
(n, x, pos) = map(int, input().split())
l = 0
r = n
(cng, cg) = (x - 1, n - x)
ansg = 1
ansng = 1
while l < r:
	m = (l + r) // 2
	if m > pos:
		ansg *= cg
		cg -= 1
		r = m
	elif m < pos:
		ansng *= cng
		cng -= 1
		l = m + 1
	else:
		l = m + 1
ans = 0
if cg >= 0 and cng >= 0:
	ans = ansg * ansng
	ans *= factorial(cg + cng)
print(ans % (10 ** 9 + 7))


vals = input().split()
n = int(vals[0])
x = int(vals[1])
pos = int(vals[2])
big = 0
small = 0
ans = 1
(l, r) = (0, n)
while l < r:
	mid = (l + r) // 2
	if mid == pos:
		l = mid + 1
	elif mid > pos:
		r = mid
		big += 1
	else:
		l = mid + 1
		small += 1
if small >= x or big > n - x:
	print(0)
else:
	MOD = int(1000000000.0 + 7)
	for i in range(1, small + 1):
		ans = ans * (x - i) % MOD
	for i in range(1, big + 1):
		ans = ans * (n - x + 1 - i) % MOD
	for i in range(1, n - small - big):
		ans = ans * i % MOD
	print(ans)


(n, x, pos) = map(int, input().split())

def factoriel(n):
	if n < 2:
		return 1
	b = n - 1
	while b > 0:
		n *= b
		b -= 1
	return n

def test():
	low = 0
	big = 0
	left = 0
	right = n
	while left < right:
		middle = (left + right) // 2
		if middle > pos:
			right = middle
			big += 1
		else:
			left = middle + 1
			low += 1
	return (low, big)
(low, big) = test()
low -= 1
ans = 1
t = x - 1
for i in range(low):
	ans *= t
	t -= 1
t = n - x
for i in range(big):
	ans *= t
	t -= 1
print(ans * factoriel(n - 1 - (low + big)) % (10 ** 9 + 7))


import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = lambda : sys.stdin.buffer.readline().rstrip()

def pm(m, n, mod):
	k = 1
	for i in range(m + 1, n + 1):
		k = k * i % mod
	return k
mod = 10 ** 9 + 7
(n, x, p) = map(int, input().split())
w = [2] * n
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	if middle <= p:
		left = middle + 1
		w[middle] = -1
	else:
		right = middle
		w[middle] = 1
a = 0
b = 0
c = 0
w[p] = 0
for i in w:
	if i == 2:
		a += 1
	elif i == 1:
		b += 1
	elif i == -1:
		c += 1
z = pm(0, a, mod) * pm(x - 1 - c, x - 1, mod) * pm(n - x - b, n - x, mod)
print(z % mod)


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()

def FACT(n, mod):
	s = 1
	facts = [1]
	for i in range(1, n + 1):
		s *= i
		s %= mod
		facts.append(s)
	return facts[n]

def C(n, k, mod):
	return FACT(n, mod) * pow(FACT(k, mod) * FACT(n - k, mod) % mod, mod - 2, mod) % mod
(n, x, pos) = MI()
left = 0
right = n
less = 0
more = 0
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		if middle < pos:
			less += 1
		left = middle + 1
	else:
		more += 1
		right = middle
hasLess = x - 1
hasBig = n - x
if less > hasLess or more > hasBig:
	print(0)
else:
	mod = 10 ** 9 + 7
	ans = FACT(less, mod) * C(hasBig, more, mod) % mod
	ans = ans * FACT(more, mod) % mod
	ans = ans * C(hasLess, less, mod) % mod
	ans *= FACT(n - less - more - 1, mod)
	ans %= mod
	print(ans)


def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
mod = 10 ** 9 + 7
t = 1
for _ in range(t):
	(n, x, pos) = map(int, input().split())
	left = 0
	right = n
	a = 0
	b = 0
	while left < right:
		mid = (left + right) // 2
		if pos < mid:
			a += 1
			right = mid
		elif pos > mid:
			b += 1
			left = mid + 1
		else:
			left = mid + 1
	if n - x < a or x - 1 < b:
		print(0)
	else:
		val1 = ncr(n - x, a, mod)
		val2 = ncr(x - 1, b, mod)
		ans = val1 * val2 % mod
		for i in range(1, a + 1):
			ans = ans * i % mod
		for i in range(1, b + 1):
			ans = ans * i % mod
		for i in range(1, n - (a + b)):
			ans = ans * i % mod
		print(ans)


(n, a, b) = map(int, input().split())
mod = 1000000000 + 7
ans = 1
(cnt, cnt1) = (0, 0)
(i, j) = (0, n)
while i < j:
	mid = (i + j) // 2
	if mid < b:
		ans *= a - 1 - cnt1
		ans %= mod
		cnt1 += 1
		i = mid + 1
	elif mid > b:
		ans *= n - a - cnt
		ans %= mod
		cnt += 1
		j = mid
	else:
		i = mid + 1
cr = n - cnt - cnt1 - 1
for i in range(1, cr + 1):
	ans *= i
	ans %= mod
print(ans)


(n, x, pos) = map(int, input().split())
mo = int(1000000000.0 + 7)
A = [1]
for i in range(1, 1010):
	A.append(A[-1] * i % mo)

def exgcd(a, b):
	if not b:
		return (1, 0)
	(y, x) = exgcd(b, a % b)
	y -= a // b * x
	return (x, y)

def getinv(a, m):
	(x, y) = exgcd(a, m)
	return --1 if x == 1 else x % m

def comb(n, b):
	res = 1
	b = min(b, n - b)
	for i in range(b):
		res = res * (n - i) * getinv(i + 1, mo) % mo
	return res % mo
lows = []
highs = []
l = 0
r = n
while l < r:
	mid = l + r >> 1
	if mid <= pos:
		lows.append(mid)
		l = mid + 1
	else:
		highs.append(mid)
		r = mid
alllow = x
allhigh = n - x
h = len(highs)
l = len(lows)
if alllow < l or allhigh < h:
	ans = 0
else:
	ans = comb(allhigh, h) * A[h] % mo * comb(alllow - 1, l - 1) * A[l - 1] % mo * A[n - h - l]
print(ans % mo)


from math import factorial as f
(n, x, pos) = list(map(int, input().split()))
cg = n - x
cl = x - 1
pg = 0
pl = 0
l = 0
r = n
while l < r:
	m = (l + r) // 2
	if m <= pos:
		l = m + 1
		pl += 1
	else:
		r = m
		pg += 1
pl -= 1
t1 = 1
for i in range(cg - pg + 1, cg + 1):
	t1 *= i
t2 = 1
for i in range(cl - pl + 1, cl + 1):
	t2 *= i
count = t1 * t2 * f(n - 1 - pl - pg)
count %= 10 ** 9 + 7
print(count)


from __future__ import print_function
from collections import Counter, OrderedDict
from itertools import permutations as perm
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import math
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(n, x, pos) = gil()
(l, r) = (0, n)
(inc, dec) = (0, 0)
while l < r:
	mid = (l + r) // 2
	if mid <= pos:
		if mid != pos:
			dec += 1
		l = mid + 1
	else:
		r = mid
		inc += 1
(INC, DEC, others) = (n - x, x - 1, max(0, n - 1 - inc - dec))
ans = 1
for i in range(dec):
	ans *= DEC
	DEC -= 1
for i in range(inc):
	ans *= INC
	INC -= 1
left = n - (inc + dec) - 1
lt = left
for i in range(lt):
	ans *= left
	left -= 1
print(ans % mod)


(n, x, pos) = input().split()
n = int(n)
x = int(x)
pos = int(pos)
mod = 1000000000.0 + 7
big = n - x
small = x - 1
left = 0
right = n
ans = 1
while left < right:
	middle = (left + right) // 2
	n -= 1
	if middle == pos:
		left = middle + 1
		continue
	elif middle > pos:
		ans = ans * big % mod
		right = middle
		if big == 0:
			print(0)
			exit()
		big -= 1
	elif middle < pos:
		left = middle + 1
		ans = ans * small % mod
		if small == 0:
			print(0)
			exit()
		small -= 1
for i in range(1, n + 1):
	ans = ans * i % mod
print(int(ans))


from functools import reduce
(n, x, p) = list(map(int, input().split()))
a = 0
b = -1
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	if p >= middle:
		left = middle + 1
		b += 1
	else:
		right = middle
		a += 1
f = 1
F1 = 1
F2 = 1
F3 = 1
F4 = 1
F5 = 1
for i in range(1, n + 1):
	f *= i
	if i == x - 1:
		F1 = f
	if i == x - b - 1:
		F2 = f
	if i == n - x:
		F3 = f
	if i == n - x - a:
		F4 = f
	if i == n - a - b - 1:
		F5 = f
ans = F1 * F3 * F5 // (F2 * F4)
if x - 1 - b < 0 or n - x - a < 0 or n - a - b - 1 < 0:
	print(0)
else:
	print(ans % (10 ** 9 + 7))


from functools import reduce
import os
import sys
from collections import *
from math import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
inf = 1e+18
div = 998244353

def ncr(n, r):
	p = 1
	k = 1
	if n - r < r:
		r = n - r
	if r != 0:
		while r:
			p *= n
			k *= r
			m = gcd(p, k)
			p //= m
			k //= m
			n -= 1
			r -= 1
	else:
		p = 1
	return p
(n, x, pos) = value()
l = 0
h = n
small = x - 1
big = n - x
ans = 1
while l < h:
	m = (l + h) // 2
	if m == pos:
		l = m + 1
	elif m < pos:
		ans = ans * small % mo
		small -= 1
		l = m + 1
	else:
		ans = ans * big % mo
		big -= 1
		h = m
val = big + small
res = 1
for i in range(1, val + 1):
	res = res * i % mo
print(ans * res % mo)


mod = 10 ** 9 + 7
fact = [0] * 1001
fact[0] = 1
for i in range(1, 1001):
	fact[i] = fact[i - 1] * i % mod
ncr = [[0] * 16 for i in range(1001)]
ncr[0][0] = 1
ncr[1][0] = 1
ncr[1][1] = 1
for i in range(2, 1001):
	ncr[i][0] = 1
	for j in range(1, min(i + 1, 16)):
		ncr[i][j] = (ncr[i - 1][j - 1] + ncr[i - 1][j]) % mod

def bs(x, n):
	l = 0
	r = n
	left = 0
	right = 0
	while l < r:
		mid = (l + r) // 2
		if mid > x:
			r = mid
			right += 1
		else:
			if mid != x:
				left += 1
			l = mid + 1
	return [left, right]
(n, x, pos) = map(int, input().split())
(l, r) = bs(pos, n)
ans = fact[n - (l + r) - 1]
ans = ans * ncr[n - x][r] * fact[r] % mod
ans = ans * ncr[x - 1][l] * fact[l] % mod
print(ans % mod)


[n, k, pos] = [int(i) for i in input().split()]
l = 0
r = n
c1 = 0
c2 = 0
while l < r:
	m = (l + r) // 2
	if m <= pos:
		c1 += 1
		l = m + 1
	else:
		c2 += 1
		r = m
ans = 1
for i in range(n - (c1 + c2)):
	ans = ans * (i + 1)
	ans = ans % 1000000007
c1 -= 1
p1 = k - 1
p2 = n - k
for i in range(c1):
	ans = ans * p1
	ans = ans % 1000000007
	p1 -= 1
for i in range(c2):
	ans = ans * p2
	ans = ans % 1000000007
	p2 -= 1
print(ans)


import sys
input = sys.stdin.readline
(n, x, pos) = list(map(int, input().split()))
mod = 10 ** 9 + 7
ANS = [0] * n
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	if pos >= middle:
		ANS[middle] = -1
		left = middle + 1
	else:
		ANS[middle] = 1
		right = middle
ANS[pos] = 9
P = ANS.count(1)
M = ANS.count(-1)
MINUS = x - 1
PLUS = n - x
A = 1
for i in range(P):
	A = A * PLUS % mod
	PLUS -= 1
for i in range(M):
	A = A * MINUS % mod
	MINUS -= 1
for i in range(1, n - P - M):
	A = A * i % mod
print(A)


import math
teststring = '123 42 24\n'
online = 'Problem_C' not in __file__
(true, false) = (True, False)
if True:

	def spitout():
		for c in teststring.splitlines():
			yield c
	_ito = spitout()
	if not online:

		def input():
			return next(_ito)

	def build_enum(*a):
		built = dict()
		for (i, c) in enumerate(a):
			built[c] = i
		return lambda x: built[x]

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a):
	(g, x, y) = egcd(a, P)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % P
[n, x, pos] = map(int, input().split(' '))
P = 1000000007
a = b = 0
l = 0
r = n
while l < r:
	m = int((l + r) / 2)
	if m <= pos:
		l = m + 1
		if m < pos:
			a += 1
	else:
		r = m
		b += 1
if a > x - 1 or b > n - x:
	ans = 0
else:
	ans = 1
	fac = [1] * (n + 1)
	for i in range(n):
		fac[i + 1] = fac[i] * (i + 1) % P
	ans = ans * fac[x - 1] % P
	ans = ans * fac[n - x] % P
	ans = ans * fac[n - a - b - 1] % P
	ans = ans * modinv(fac[x - 1 - a]) % P
	ans = ans * modinv(fac[n - x - b]) % P
print(ans)


import sys
input = sys.stdin.buffer.readline

def fact(x):
	y = 1
	for i in range(1, x + 1):
		y *= i
		y %= 10 ** 9 + 7
	return y

def solution():
	(n, x, pos) = map(int, input().split())
	beg = 0
	end = n
	mod = 10 ** 9 + 7
	ans = 1
	big = n - x
	small = x - 1
	mid = (beg + end) // 2
	while beg < end:
		mid = (beg + end) // 2
		if mid == pos:
			beg = mid + 1
		elif mid > pos:
			ans *= big
			ans = ans % mod
			if big > 0:
				big -= 1
			end = mid
		else:
			ans *= small
			ans %= mod
			if small > 0:
				small -= 1
			beg = mid + 1
	if beg <= 0:
		print(0)
		return
	ans *= fact(big + small)
	ans %= mod
	print(ans)
t = 1
for _ in range(t):
	solution()


(a, e, x) = [int(i) for i in input().split()]
(b, s) = (a - e, e - 1)
(l, r, c, res) = (0, a, a - 1, 1)
modulo = 10 ** 9 + 7
while l < r:
	m = (l + r) // 2
	if m < x:
		c -= 1
		l = m + 1
		res *= s % (10 ** 9 + 7)
		s -= 1
	elif m == x:
		res = res
		l = m + 1
	else:
		c -= 1
		res *= b % modulo
		b -= 1
		r = m
f = 1
for i in range(1, c + 1):
	f *= i % modulo
print(res * f % modulo)


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))

class Combination:

	def __init__(self, n_max, mod=10 ** 9 + 7):
		self.mod = mod
		self.modinv = self.make_modinv_list(n_max)
		(self.fac, self.facinv) = self.make_factorial_list(n_max)

	def __call__(self, n, r):
		return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

	def make_factorial_list(self, n):
		fac = [1]
		facinv = [1]
		for i in range(1, n + 1):
			fac.append(fac[i - 1] * i % self.mod)
			facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
		return (fac, facinv)

	def make_modinv_list(self, n):
		modinv = [0] * (n + 1)
		modinv[1] = 1
		for i in range(2, n + 1):
			modinv[i] = self.mod - self.mod // i * modinv[self.mod % i] % self.mod
		return modinv
comb = Combination(1010)
(n, x, pos) = inpl()
l = 0
r = n
lcnt = rcnt = 0
while l < r:
	mid = (l + r) // 2
	if mid == pos:
		l = mid + 1
	elif mid < pos:
		lcnt += 1
		l = mid + 1
	else:
		rcnt += 1
		r = mid
if x - 1 < lcnt or n - x < rcnt:
	print(0)
	quit()
else:
	res = 1
	if not x - 1 == lcnt == 0:
		res *= comb(x - 1, lcnt)
		res %= mod
	if not n - x == rcnt == 0:
		res *= comb(n - x, rcnt)
		res %= mod
	for i in range(1, lcnt + 1):
		res *= i
		res %= mod
	for i in range(1, rcnt + 1):
		res *= i
		res %= mod
	for i in range(1, n - lcnt - rcnt):
		res *= i
		res %= mod
	print(res)


(n, val, pos) = map(int, input().split())
less = val - 1
large = n - val
s = 0
e = n
ans = 1
while s < e:
	mid = (s + e) // 2
	if mid < pos:
		s = mid + 1
		ans *= less
		less -= 1
	elif mid > pos:
		e = mid
		ans *= large
		large -= 1
	else:
		s = mid + 1
less += large
if less > 0:
	for i in range(less, 0, -1):
		ans *= i
print(ans % (10 ** 9 + 7))


import sys
from math import gcd, sqrt, ceil, log2
from collections import defaultdict, Counter, deque
from bisect import bisect_left, bisect_right
import math
import heapq
from itertools import permutations
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def get_sum(bit, i):
	s = 0
	i += 1
	while i > 0:
		s += bit[i]
		i -= i & -i
	return s

def update(bit, n, i, v):
	i += 1
	while i <= n:
		bit[i] += v
		i += i & -i

def modInverse(b, m):
	g = math.gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def primeFactors(n):
	sa = set()
	sa.add(n)
	while n % 2 == 0:
		sa.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			sa.add(i)
			n = n // i
	return sa

def seive(n):
	pri = [True] * (n + 1)
	p = 2
	while p * p <= n:
		if pri[p] == True:
			for i in range(p * p, n + 1, p):
				pri[i] = False
		p += 1
	return pri

def check_prim(n):
	if n < 0:
		return False
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def getZarr(string, z):
	n = len(string)
	(l, r, k) = (0, 0, 0)
	for i in range(1, n):
		if i > r:
			(l, r) = (i, i)
			while r < n and string[r - l] == string[r]:
				r += 1
			z[i] = r - l
			r -= 1
		else:
			k = i - l
			if z[k] < r - i + 1:
				z[i] = z[k]
			else:
				l = i
				while r < n and string[r - l] == string[r]:
					r += 1
				z[i] = r - l
				r -= 1

def search(text, pattern):
	concat = pattern + '$' + text
	l = len(concat)
	z = [0] * l
	getZarr(concat, z)
	ha = []
	for i in range(l):
		if z[i] == len(pattern):
			ha.append(i - len(pattern) - 1)
	return ha

def mergeIntervals(arr):
	arr.sort(key=lambda x: x[0])
	m = []
	s = -10000
	max = -100000
	for i in range(len(arr)):
		a = arr[i]
		if a[0] > max:
			if i != 0:
				m.append([s, max])
			max = a[1]
			s = a[0]
		elif a[1] >= max:
			max = a[1]
	if max != -100000 and [s, max] not in m:
		m.append([s, max])
	return m

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def sea(a, x):
	left = 0
	right = len(a)
	while left < right:
		middle = (left + right) // 2
		if a[middle] <= x:
			left = middle + 1
		else:
			right = middle
	if left > 0 and a[left - 1] == x:
		return True
	else:
		return False
(n, x, p) = map(int, input().split())
la = [i for i in range(1, n + 1)]
l = 0
r = n
pos1 = 0
sm = x - 1
bi = n - x
pos2 = 0
while l < r:
	mid = (l + r) // 2
	if mid < p:
		l = mid + 1
		pos1 += 1
	elif mid == p:
		l = mid + 1
	else:
		r = mid
		pos2 += 1
z = n - pos1 - pos2 - 1
ans = 0
mod = 10 ** 9 + 7
fa = [1]
for i in range(1, n + 10):
	fa.append(i * fa[i - 1] % mod)
ans += fa[z] * ncr(sm, pos1, mod) * ncr(bi, pos2, mod) * fa[pos2] * fa[pos1]
print(ans % mod)


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def main():
	try:
		(n, x, pos) = In()
		low = 0
		high = n
		t = []
		(noH, noS) = (0, 0)
		while low < high:
			mid = (low + high) // 2
			if mid <= pos:
				low = mid + 1
				t.append(['S', low])
				noS += 1
			else:
				high = mid
				t.append(['H', high])
				noH += 1
		noS -= 1
		totalH = n - x
		totalL = x - 1
		if totalH < noH or totalL < noS:
			print(0)
		else:
			ans = ncr(totalH, noH, P) * ncr(totalL, noS, P)
			fact = n - 1 - noH - noS
			for i in range(1, fact + 1):
				ans = i % P * (ans % P) % P
			for i in range(1, noH + 1):
				ans = i % P * (ans % P) % P
			for i in range(1, noS + 1):
				ans = i % P * (ans % P) % P
			print(ans)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


(n, x, pos) = map(int, input().split())

def fact(n):
	if n == 1 or n == 0:
		return 1
	return n * fact(n - 1) % (pow(10, 9) + 7)
arr = []
c = 0
for i in range(n):
	if i < pos:
		arr.append(x - c)
		c = c + 1
	elif i > pos:
		arr.append(x + c)
		c = c + 1
	else:
		arr.append(x)

def bs(arr, x, s):
	while True:
		l = 0
		r = len(arr)
		while l < r:
			mid = (l + r) // 2
			s.add(mid)
			if arr[mid] <= x:
				l = mid + 1
			else:
				r = mid
		if l > 0 and arr[l - 1] == x:
			return True
		else:
			return False
s = set()
bs(arr, x, s)
crr = []
for i in s:
	if i < pos:
		crr.append(-1)
	elif i > pos:
		crr.append(1)
ans = 1
bc = n - x
cc = x - 1
for i in crr:
	if i == 1:
		ans = ans * bc
		bc = bc - 1
	if i == -1:
		ans = ans * cc
		cc = cc - 1
ans = ans * fact(n - len(crr) - 1) % (pow(10, 9) + 7)
print(ans)


def bs(a, x):
	left = 0
	right = len(a)
	(b, s) = (0, 0)
	while left < right:
		middle = (left + right) // 2
		if a[middle] <= x:
			left = middle + 1
			if a[middle] != x:
				s += 1
		else:
			right = middle
			b += 1
	return (b, s)

def fac(n):
	a = 1
	for i in range(1, n + 1):
		a = a * i
		a = a % (10 ** 9 + 7)
	return a

def rfac(n):
	a = 1
	for i in range(1, n + 1):
		a = a * i
	return a

def choice(x, y):
	return rfac(x) // (rfac(y) * rfac(x - y))

def f(n, x, pos):
	a = [x - pos + i for i in range(n)]
	(b, s) = bs(a, x)
	tb = n - x
	ts = n - tb - 1
	if tb < b or ts < s:
		return 0
	ret = 0
	ret = choice(tb, b) * choice(ts, s) * fac(tb - b + ts - s) * fac(b) * fac(s)
	ret = ret % (10 ** 9 + 7)
	return ret
(n, x, pos) = [int(i) for i in input().split(' ')]
print(f(n, x, pos))


import sys
input = sys.stdin.readline
max_n = 1000
(fact, inv_fact) = ([0] * (max_n + 1), [0] * (max_n + 1))
fact[0] = 1
mod = 10 ** 9 + 7

def make_nCr_mod():
	global fact
	global inv_fact
	for i in range(max_n):
		fact[i + 1] = fact[i] * (i + 1) % mod
	inv_fact[-1] = pow(fact[-1], mod - 2, mod)
	for i in reversed(range(max_n)):
		inv_fact[i] = inv_fact[i + 1] * (i + 1) % mod
make_nCr_mod()

def nPr_mod(n, r):
	if r > n:
		return 0
	return fact[n] * inv_fact[n - r] % mod
(n, x, pos) = map(int, input().split())
left = 0
right = n
smaller_required = 0
larger_required = 0
while left < right:
	mid = (left + right) // 2
	if pos >= mid:
		left = mid + 1
		if pos != mid:
			smaller_required += 1
	else:
		larger_required += 1
		right = mid
total_smaller = x - 1
total_larger = n - x
no_restriction = n - smaller_required - larger_required - 1
print(nPr_mod(total_larger, larger_required) * nPr_mod(total_smaller, smaller_required) * fact[no_restriction] % mod)


from math import *
mod = 1000000007

def nCr(n, r):
	if r > n:
		return 0
	num = factorial(n)
	den = factorial(r)
	an = factorial(n - r)
	val = den * an
	return num // val
(n, x, pos) = map(int, input().split())
left = 0
right = n
(cnts, cntb) = (0, 0)
while left < right:
	mid = (left + right) // 2
	if mid > pos:
		cntb += 1
	if mid < pos:
		cnts += 1
	if mid <= pos:
		left = mid + 1
	else:
		right = mid
a = nCr(x - 1, cnts) % mod
b = nCr(n - x, cntb) % mod
c = factorial(n - 1 - cnts - cntb) % mod
d = factorial(cnts) % mod
e = factorial(cntb) % mod
print(a * b * c * d * e % mod)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
fact = [1] * 1001
rev = [1] * 1001
for i in range(2, 1001):
	fact[i] = fact[i - 1] * i % mod
	rev[i] = pow(fact[i], mod - 2, mod)
(n, x, k) = sp()
(low, high) = (0, n)
(g, s) = (0, 0)
while low < high:
	mid = (low + high) // 2
	if mid <= k:
		s += 1
		low = mid + 1
	else:
		g += 1
		high = mid
s -= 1
(greater, smaller) = (n - x, x - 1)
if g > greater or s > smaller:
	out(0)
	exit()
tot = n - 1 - s - g
answer = fact[tot]
answer = answer * fact[greater] % mod
answer = answer * fact[smaller] % mod
answer = answer * rev[greater - g] % mod
answer = answer * rev[smaller - s] % mod
out(answer)


import sys
from os import path
MOD = 1000000000.0 + 7

def open_inputs():
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')

def get_int():
	return int(sys.stdin.readline().strip())

def get_ints():
	return list(map(int, sys.stdin.readline().strip().split()))

def com(_n: int, _x: int, _p: int):
	total_less = 0
	total_great = 0
	L = 0
	R = _n
	while L < R:
		middle = int((L + R) / 2)
		if middle == _p:
			L = middle + 1
		elif middle > _p:
			R = middle
			total_great += 1
		else:
			L = middle + 1
			total_less += 1
	result = 1
	for i in range(total_less):
		val = _x - 1 - i
		result *= val
		result %= MOD
	for i in range(total_great):
		val = _n - _x - i
		result *= val
		result %= MOD
	balance = _n - total_great - total_less - 1
	for i in range(2, balance + 1):
		result *= i
		result %= MOD
	print(int(result))

def main():
	open_inputs()
	[a, b, c] = get_ints()
	com(a, b, c)
main()


def search(a, x):
	left = 0
	right = len(a)
	while left < right:
		middle = (left + right) // 2
		if a[middle] <= x:
			left = middle + 1
		else:
			right = middle
	if left > 0 and a[left - 1] == x:
		return True
	else:
		return False

def perm(n, r):
	if n < r:
		return 0
	ans = 1
	k = n
	while k > n - r:
		ans *= k
		k -= 1
	return ans

def fact(x):
	if x < 0:
		return 0
	ans = 1
	while x:
		ans *= x
		x -= 1
	return ans
(n, x, p) = map(int, input().split())
b = [0] * n
left = 0
right = n
small = -1
large = 0
while left < right:
	middle = (left + right) // 2
	if middle <= p:
		left = middle + 1
		b[middle] = -1
		small += 1
	else:
		right = middle
		b[middle] = 1
		large += 1
ans = perm(x - 1, small) * perm(n - x, large) * fact(n - 1 - small - large)
print(ans % (10 ** 9 + 7))


from sys import stdout
from sys import stdin

def get():
	return stdin.readline().strip()

def getf(sp=' '):
	return [int(i) for i in get().split(sp)]

def put(a, end='\n'):
	stdout.write(str(a) + end)

def putf(a, sep=' ', end='\n'):
	stdout.write(sep.join([str(i) for i in a]) + end)

def fact_mod(n):
	ans = 1
	m = 10 ** 9 + 7
	for i in range(2, n + 1):
		ans = ans * i % m
	return ans

def main():
	(n, x, pos) = getf()
	l = 0
	r = n
	usd = [False] * n
	usd[pos] = True
	can = [1] * n
	can_l = x - 1
	can_r = n - x
	while l < r:
		mid = (l + r) // 2
		if mid <= pos:
			if usd[mid] == False:
				usd[mid] = True
				can[mid] = can_l
				can_l -= 1
			l = mid + 1
		else:
			if usd[mid] == False:
				usd[mid] = True
				can[mid] = can_r
				can_r -= 1
			r = mid
	ans = fact_mod(can_l + can_r)
	m = 10 ** 9 + 7
	for i in range(n):
		ans = ans * can[i] % m
	put(ans)
main()


from math import factorial
(n, x, pos) = map(int, input().split())
MOD = 10 ** 9 + 7
(small, big, ans) = (x - 1, n - x, 1)
(l, r) = (0, n)
while l < r:
	mid = (l + r) // 2
	if mid < pos:
		ans *= small
		small -= 1
		l = mid + 1
	elif mid > pos:
		ans *= big
		big -= 1
		r = mid
	else:
		l = mid + 1
ans *= factorial(small + big)
print(ans % MOD)


from sys import stdin, stdout
mod = 10 ** 9 + 7

def binarySearch(arr, x, pos):
	l = 0
	r = len(arr)
	left = 0
	right = 0
	while l < r:
		mid = (l + r) // 2
		if mid < pos:
			left += 1
		if mid > pos:
			right += 1
		if arr[mid] <= x:
			l = mid + 1
		else:
			r = mid
	return (left, right)
fact = [1, 1]

def fac(n):
	if n < 0:
		return 0
	for i in range(len(fact), n + 1):
		fact.append(fact[len(fact) - 1] * i % mod)
	return fact[n]

def powe(a, b):
	p = 1
	while b > 0:
		if b & 1 == 1:
			p = p * (a % mod) % mod
		a = a * a % mod
		b = b >> 1
	return p

def ncr(n, r):
	if r > n:
		return 0
	ans = fac(n) * powe(fac(n - r), mod - 2) % mod
	return ans
(n, x, pos) = map(int, stdin.readline().split())
arr = [i + 1 for i in range(n)]
(le, re) = binarySearch(arr, arr[pos], pos)
n1 = x - 1
n2 = n - x
ans = ncr(n1, le) * ncr(n2, re) % mod * fac(n - le - re - 1) % mod
print(ans)


import math
(a, b, c) = map(int, input().split())
d1 = 0
d2 = 0
e = 0
f = a
while e < f:
	g = (e + f) // 2
	if g <= c:
		e = g + 1
		if g < c:
			d1 += 1
	else:
		f = g
		d2 += 1
h = 1
for i in range(b - 1, b - 1 - d1, -1):
	h *= i
for i in range(a - b, a - b - d2, -1):
	h *= i
for i in range(1, a - d1 - d2):
	h *= i
print(h % 1000000007)


from bisect import *
import math
from collections import *
from heapq import *
from itertools import *
inf = 10 ** 18
mod = 10 ** 9 + 7
(n, x, pos) = map(int, input().split())
l = 0
r = n
bache = n - 1
bade = n - x
chotte = x - 1
ans = 1
while l < r:
	mid = (l + r) // 2
	if mid == pos:
		l = mid + 1
	elif mid > pos:
		ans = ans * bade % mod
		bade -= 1
		bache -= 1
		r = mid
	else:
		ans = ans * chotte % mod
		chotte -= 1
		bache -= 1
		l = mid + 1
for i in range(1, bache + 1):
	ans = ans * i % mod
print(ans)


from math import factorial
mod = 1000000007
(n, x, pos) = list(map(int, input().split()))
biggerNeeded = 0
lowerNeeded = 0
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	if middle < pos:
		left = middle + 1
		lowerNeeded += 1
	elif middle > pos:
		right = middle
		biggerNeeded += 1
	else:
		left = middle + 1
if x + biggerNeeded > n or x - lowerNeeded <= 0:
	print(0)
	return
ans = factorial(x - 1) // factorial(x - 1 - lowerNeeded)
ans %= mod
ans *= factorial(n - x) // factorial(n - x - biggerNeeded)
ans %= mod
ans *= factorial(n - biggerNeeded - lowerNeeded - 1)
ans %= mod
print(ans)


def fact(n):
	ans = 1
	while n > 1:
		ans *= n % 1000000007
		n -= 1
	return ans

def solve(up, dw):
	mi = up - dw
	ans = 1
	while up > mi:
		ans *= up
		up -= 1
	return ans
arr = [int(x) for x in input().split()]
(n, ele, x) = (arr[0], arr[1], arr[2])
(l, r) = (0, n)
(cb, cs) = (0, 0)
while l < r:
	mid = (l + r) // 2
	if mid > x:
		cb += 1
	if mid < x:
		cs += 1
	if mid <= x:
		l = mid + 1
	else:
		r = mid
up1 = n - ele
up2 = ele - 1
s1 = solve(up1, cb)
s2 = solve(up2, cs)
f = fact(n - cb - cs - 1)
print(s1 * s2 * f % 1000000007)


(n, x, p) = list(map(int, input().split()))
smallc = 0
largec = 0
left = 0
right = n
while left < right:
	mid = (left + right) // 2
	if mid < p:
		smallc += 1
		left = mid + 1
	elif mid > p:
		largec += 1
		right = mid
	else:
		left = mid + 1
largeAv = n - x
smallAv = x - 1
mod = 1000000007

def permutations(n, c):
	v = 1
	for i in range(n - c + 1, n + 1):
		v = v * i % mod
	return v
v = permutations(largeAv, largec) * permutations(smallAv, smallc) % mod
oc = n - (largec + smallc + 1)
v = v * permutations(oc, oc) % mod
print(v)


M = 10 ** 9 + 7
N = 10 ** 3 + 1
fact = [0 for i in range(N)]
fact[0] = 1
for i in range(1, N):
	fact[i] = i % M * fact[i - 1] % M % M
invfact = [0 for i in range(N)]
invfact[N - 1] = pow(fact[N - 1], M - 2, M)
for i in range(N - 2, -1, -1):
	invfact[i] = invfact[i + 1] % M * (i + 1) % M % M

def ncr(n, r):
	if n < 0 or r > n or r < 0:
		return 0
	return fact[n] % M * invfact[r] % M % M * (invfact[n - r] % M) % M % M
for _ in range(1):
	(n, x, pos) = map(int, input().split())
	cntb = 0
	cnts = 0
	(left, right) = (0, n)
	while left < right:
		middle = (left + right) // 2
		if middle < pos:
			cnts = cnts + 1
			left = middle + 1
		elif middle > pos:
			cntb = cntb + 1
			right = middle
		else:
			left = middle + 1
	ans = ncr(n - x, cntb) % M
	ans = ans % M * fact[cntb] % M % M
	ans = ans % M * ncr(x - 1, cnts) % M
	ans = ans % M * fact[cnts] % M % M
	ans = ans % M * fact[n - cnts - cntb - 1] % M % M
	print(ans % M)


def BinarySearch(a, x):
	left = 0
	right = len(a)
	ans = []
	while left < right:
		middle = (left + right) // 2
		ans.append(middle)
		if a[middle] <= x:
			left = middle + 1
		else:
			right = middle
	return ans
mod = int(1000000000.0 + 7)

def fact(n):
	ans = 1
	for i in range(2, n + 1):
		ans = ans * i % mod
	return ans

def binPow(a, b):
	ans = 1
	while b > 0:
		if b % 2:
			ans *= a
		a *= a
		a %= mod
		ans %= mod
		b //= 2
	return ans

def A(n, k):
	return fact(n) * binPow(fact(n - k), mod - 2) % mod
(n, x, pos) = map(int, input().split())
used = BinarySearch([i for i in range(n)], pos)
(cntL, cntU) = (0, 0)
for i in used:
	if i < pos:
		cntL += 1
	elif i > pos:
		cntU += 1
if x - 1 >= cntL and n - x >= cntU:
	print(A(x - 1, cntL) * A(n - x, cntU) % mod * fact(n - cntL - cntU - 1) % mod)
else:
	print(0)


m = 1000000007

def P(a, b):
	res = 1
	i = a - b + 1
	while i <= a:
		res = res * i % m
		i += 1
	return res
(n, x, pos) = input().split()
n = int(n)
x = int(x)
pos = int(pos)
(l, r) = (0, n)
(gc, lec) = (0, 0)
while l < r:
	mid = int((l + r) / 2)
	if pos == mid:
		l = mid + 1
	elif pos + 1 <= mid:
		r = mid
		gc += 1
	elif pos + 1 > mid:
		l = mid + 1
		lec += 1
ans = P(n - x, gc) * P(x - 1, lec) % m * P(n - lec - gc - 1, n - lec - gc - 1) % m
print(ans)


def solve(n, val, pos):
	l = 0
	r = n
	small = val - 1
	big = n - val
	(pos1, pos2) = (0, 0)
	while l < r:
		mid = (l + r) // 2
		if mid <= pos:
			pos1 += 1
			l = mid + 1
		elif mid > pos:
			pos2 += 1
			r = mid
	(ans, mod) = (1, 10 ** 9 + 7)
	for i in range(n - (pos1 + pos2)):
		ans = ans * (i + 1)
		ans = ans % mod
	pos1 -= 1
	for _ in range(pos1):
		ans = ans * small
		ans = ans % mod
		small -= 1
	for _ in range(pos2):
		ans = ans * big
		ans = ans % mod
		big -= 1
	print(ans)
(n, x, pos) = map(int, input().split())
solve(n, x, pos)


import sys, math
from math import factorial as fact
from collections import defaultdict as dd
input = lambda : sys.stdin.readline().strip()
inp = lambda : list(map(int, input().split()))
mod = 10 ** 9 + 7

def C(n, r):
	if r > n:
		return 0
	return fact(n) // (fact(n - r) * fact(r))

def P(n, r):
	if r > n:
		return 0
	return fact(n) // fact(n - r)
(n, x, pos) = inp()
a = [i for i in range(n)]
g = 0
l = 0

def bins(a, x, n):
	global g, l
	left = 0
	right = n
	while left < right:
		mid = (left + right) // 2
		if a[mid] == x:
			left = mid + 1
		elif a[mid] < x:
			left = mid + 1
			l += 1
		else:
			right = mid
			g += 1
	if left > 0 and a[left - 1] == x:
		return
	else:
		return
bins(a, pos, n)
dc = n - g - l - 1
actg = n - x
actl = x - 1
ans = P(actg, g) * P(actl, l) * P(n - g - l - 1, dc)
print(ans % mod)


mod = 1000000007

def power(n, x):
	val = 1
	while x != 0:
		if x & 1:
			val = val * n % mod
		n = n * n % mod
		x //= 2
	return val

def fact(n):
	val = 1
	for i in range(1, n + 1):
		val = val * i % mod
	return val

def comb(n, x):
	y1 = power(fact(x), mod - 2) % mod
	y2 = power(fact(n - x), mod - 2) % mod
	y = fact(n) % mod
	return y * y1 % mod * y2 % mod % mod
(n, x, pos) = map(int, input().split())
(less, more) = (0, 0)
(l, h) = (0, n)
while l < h:
	mid = (l + h) // 2
	if mid <= pos:
		less += 1
		l = mid + 1
	else:
		more += 1
		h = mid
less -= 1
if less <= x - 1 and more <= n - x:
	ans = comb(x - 1, less) * fact(less) % mod * (comb(n - x, more) * fact(more)) % mod % mod * fact(n - 1 - (less + more)) % mod % mod
	print(ans)
else:
	print(0)


(n, x, p) = map(int, input().split())
l = 0
r = n
MOD = 1000000000.0 + 7
(gt, ls) = (0, 0)
while l < r:
	m = (l + r) // 2
	if p < m:
		gt += 1
		r = m
	if p >= m:
		if p > m:
			ls += 1
		l = m + 1
if n - x < gt or x - 1 < ls:
	ans = 0
	print(0)
	exit()
ans = 1
c = n - x + 1
for i in range(1, gt + 1):
	ans = ans * (c - i) % MOD
c = x
for i in range(1, ls + 1):
	ans = ans * (x - i) % MOD
for i in range(1, n - gt - ls):
	ans = ans * i % MOD
print(int(ans))


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c for j in range(b)] for i in range(a)]

def list3d(a, b, c, d):
	return [[[d for k in range(c)] for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** (-10)

class CombTools:

	def __init__(self, MAX, MOD):
		MAX += 1
		self.MAX = MAX
		self.MOD = MOD
		factorial = [1] * MAX
		factorial[0] = factorial[1] = 1
		for i in range(2, MAX):
			factorial[i] = factorial[i - 1] * i % MOD
		inverse = [1] * MAX
		inverse[MAX - 1] = pow(factorial[MAX - 1], MOD - 2, MOD)
		for i in range(MAX - 2, -1, -1):
			inverse[i] = inverse[i + 1] * (i + 1) % MOD
		self.fact = factorial
		self.inv = inverse

	def nCr(self, n, r):
		if n < r:
			return 0
		r = min(r, n - r)
		numerator = self.fact[n]
		denominator = self.inv[r] * self.inv[n - r] % self.MOD
		return numerator * denominator % self.MOD

	def nPr(self, n, r):
		if n < r:
			return 0
		return self.fact[n] * self.inv[n - r] % self.MOD

def calc(N, pos):
	l = 0
	r = N
	lcnt = rcnt = 0
	while l < r:
		m = (l + r) // 2
		if m <= pos:
			if m != pos:
				lcnt += 1
			l = m + 1
		else:
			if m != pos:
				rcnt += 1
			r = m
	return (lcnt, rcnt)
(N, x, pos) = MAP()
(lneed, rneed) = calc(N, pos)
ltotal = x - 1
rtotal = N - x
lrest = ltotal - lneed
rrest = rtotal - rneed
if lrest < 0 or rrest < 0:
	print(0)
	exit()
ct = CombTools(N, MOD)
others = lrest + rrest
ans = ct.nPr(ltotal, lneed) * ct.nPr(rtotal, rneed) * ct.fact[others] % MOD
print(ans)


import os
import sys
from collections import *
from heapq import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 1000000007
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]

def nCr(n, r, p=M):
	num = 1
	den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
fact = [1]
f = 1
for i in range(1, 1001):
	f = f * i % M
	fact.append(f)
(n, x, pos) = value()
a = [x - 1] * pos + [x] + [x + 1] * (n - pos - 1)
small = -1
large = 0
low = 0
high = n
while low < high:
	mid = (low + high) // 2
	if a[mid] <= x:
		small += 1
		low = mid + 1
	else:
		large += 1
		high = mid
rem = n - small - large - 1
smalls = x - 1
larges = n - smalls - 1
a1 = nCr(smalls, small) * fact[small] % M
a2 = nCr(larges, large) * fact[large] % M
a3 = fact[rem] * a1 % M
ans = a3 * a2 % M
print(ans)


import os
from io import BytesIO, IOBase
import sys
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 1000000007
factorials = [1] * (2 * 10 ** 3 + 1)
for i in range(1, len(factorials)):
	factorials[i] = factorials[i - 1] * i % mod
inv_factorials = [1] * (2 * 10 ** 3 + 1)
for i in range(2, len(inv_factorials)):
	inv_factorials[i] = pow(factorials[i], mod - 2, mod)

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a):
	(g, x, y) = egcd(a, mod)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % mod
(n, x, pos) = map(int, input().split())
assigned_left = 0
assigned_right = 0
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		left = middle + 1
		assigned_left += 1
	else:
		assigned_right += 1
		right = middle
if left > 0 and left - 1 == pos:
	assigned_left -= 1
else:
	print(0)
	exit(0)
if n - x < assigned_right or x - 1 < assigned_left:
	print(0)
else:
	initial = 1
	initial *= factorials[n - x] * (inv_factorials[n - x - assigned_right] % mod)
	initial %= mod
	initial *= factorials[x - 1] * (inv_factorials[x - 1 - assigned_left] % mod)
	initial %= mod
	initial *= factorials[n - assigned_left - assigned_right - 1]
	initial %= mod
	print(initial)


(n, x, pos) = [int(k) for k in input().split()]
ans = 1
greater = n - x
smaller = x - 1
left = 0
right = n
mid = n
while left < right:
	mid = (left + right) // 2
	if mid < pos:
		ans *= smaller
		ans = ans % 1000000007
		smaller -= 1
		left = mid + 1
	elif mid > pos:
		ans *= greater
		ans = ans % 1000000007
		greater -= 1
		right = mid
	else:
		left = mid + 1
for i in range(1, smaller + greater + 1):
	ans *= i
	ans = ans % 1000000007
print(ans)


lm = 1010
f = {0: 1}
mod = 10 ** 9 + 7
for i in range(1, lm):
	f[i] = i * f[i - 1] % mod

def BnS(pos, n):
	(l, r) = (0, n)
	(sm, bg) = (0, 0)
	while l < r:
		m = (l + r) // 2
		if m <= pos:
			sm += 1
			l = m + 1
		else:
			bg += 1
			r = m
	return (sm, bg)
(N, x, pos) = map(int, input().split())
(small, big) = BnS(pos, N)

def p(n, r):
	if r > n:
		return 0
	ans = f[n] * pow(f[n - r], mod - 2, mod)
	ans %= mod
	return ans
ans = p(x - 1, small - 1) * p(N - x, big) % mod
ans = ans * f[N - (small + big)]
ans %= mod
print(ans)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
(n, x, pos) = Ri()
nob = n - x
nos = x - 1
ans = 1
(l, r) = (0, n)
cnt = 0
while l < r:
	mid = (l + r) // 2
	if mid > pos:
		ans = ans * nob
		ans = ans % MOD
		nob -= 1
		r = mid
	elif mid < pos:
		ans = ans * nos
		ans = ans % MOD
		nos -= 1
		l = mid + 1
	else:
		flag = True
		l = mid + 1
for i in range(1, nos + nob + 1):
	ans = ans * i % MOD
print(ans)


import math
from collections import deque
from sys import stdin, stdout, setrecursionlimit
from string import ascii_letters
letters = ascii_letters[:26]
from collections import defaultdict
input = stdin.readline
(n, x, pos) = map(int, input().split())
l = 0
r = n
res = 1
higher = 0
lower = 0
while l < r:
	m = l + (r - l) // 2
	if m == pos:
		l = m + 1
		continue
	if pos < m + 1:
		r = m
		higher += 1
	else:
		l = m + 1
		lower += 1
res = 1
hh = n - x
hl = x - 1
for i in range(higher):
	res = res * hh % 1000000007
	hh -= 1
for i in range(lower):
	res = res * hl % 1000000007
	hl -= 1
ost = n - 1 - lower - higher
for i in range(1, ost + 1):
	res = res * i % 1000000007
print(res)


bigmod = 10 ** 9 + 7

def Bserach(n, pos, x):
	left = 0
	right = n
	l = 0
	r = -1
	while left < right:
		middle = (left + right) // 2
		if middle <= pos:
			r += 1
			left = middle + 1
		else:
			l += 1
			right = middle
	answer = 1
	for i in range(l):
		answer *= n - x - i
		answer %= bigmod
	for i in range(r):
		answer *= x - 1 - i
		answer %= bigmod
	for i in range(1, n - l - r):
		answer *= i
		answer %= bigmod
	return answer
[n, x, pos] = list(map(int, input().split()))
print(Bserach(n, pos, x))


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from typing import List
from itertools import *
from operator import add, mul, sub, xor, truediv, floordiv
from functools import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

@lru_cache(None)
def fact(x):
	if x < 2:
		return 1
	return fact(x - 1) * x % mod

@lru_cache(None)
def per(i, j):
	return fact(i) // fact(i - j)

@lru_cache(None)
def com(i, j):
	return per(i, j) // fact(j)

def linc(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t > f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rinc(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t < f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def ldec(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t < f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rdec(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t > f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def binfun(x):
	c = 0
	for w in arr:
		c += ceil(w / x)
	return c

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class smt:

	def __init__(self, l, r, arr):
		self.l = l
		self.r = r
		self.value = (1 << 31) - 1 if l < r else arr[l]
		mid = (l + r) // 2
		if l < r:
			self.left = smt(l, mid, arr)
			self.right = smt(mid + 1, r, arr)
			self.value &= self.left.value & self.right.value

	def setvalue(self, x, val):
		if self.l == self.r:
			self.value = val
			return
		mid = (self.l + self.r) // 2
		if x <= mid:
			self.left.setvalue(x, val)
		else:
			self.right.setvalue(x, val)
		self.value = self.left.value & self.right.value

	def ask(self, l, r):
		if l <= self.l and r >= self.r:
			return self.value
		val = (1 << 31) - 1
		mid = (self.l + self.r) // 2
		if l <= mid:
			val &= self.left.ask(l, r)
		if r > mid:
			val &= self.right.ask(l, r)
		return val

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] < self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return prime

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		for v in graph[u]:
			if v not in d or d[v] > d[u] + graph[u][v]:
				d[v] = d[u] + graph[u][v]
				heappush(heap, (d[v], v))
	return d

def perm(m, n):
	if m < n:
		return 0
	ans = 1
	for i in range(m - n + 1, m + 1):
		ans = ans * i % mod
	return ans
(n, x, p) = RL()
l = 0
r = n
s = b = 0
while l < r:
	mid = (l + r) // 2
	if mid < p:
		l = mid + 1
		s += 1
	elif mid > p:
		r = mid
		b += 1
	else:
		l = mid + 1
mod = 10 ** 9 + 7
ans = perm(n - x, b) * perm(x - 1, s) * fact(n - s - b - 1) % mod
print(ans)


import sys
from array import array

def input():
	return sys.stdin.buffer.readline().decode('utf-8')
(n, x, pos) = map(int, input().split())
mod = 10 ** 9 + 7
(low, high) = (x - 1, n - x)
ans = 1
(l, r) = (0, n)
while l < r:
	mid = l + r >> 1
	if mid <= pos:
		if mid < pos:
			ans = ans * low % mod
			low -= 1
		l = mid + 1
	else:
		ans = ans * high % mod
		high -= 1
		r = mid
assert l > 0 and l - 1 == pos
for i in range(low + high, 0, -1):
	ans = ans * i % mod
print(ans)


(n, x, pos) = map(int, input().split())
mod = 10 ** 9 + 7
factorials = [1]
for i in range(1, n + 1):
	factorials.append(factorials[-1] * i % mod)
inverses = [pow(v, mod - 2, mod) for v in factorials]

def cnk(n, k):
	return factorials[n] * inverses[n - k] * inverses[k]

def split(pos, n):
	left = 0
	right = n
	lefts = []
	rights = []
	while left < right:
		mid = (left + right) // 2
		if mid <= pos:
			if mid != pos:
				rights.append(mid)
			left = mid + 1
		else:
			lefts.append(mid)
			right = mid
	return (lefts, rights)
(lefts, rights) = split(pos, n)
smaller = x - 1
bigger = n - x
if len(rights) > smaller or len(lefts) > bigger:
	print(0)
else:
	res = cnk(smaller, len(rights)) * cnk(bigger, len(lefts))
	res *= factorials[len(rights)]
	res *= factorials[len(lefts)]
	res %= mod
	for i in range(n - 1 - len(rights) - len(lefts)):
		res *= i + 1
		res %= mod
	print(res)


import math

def nPr(n, r):
	return math.factorial(n) // math.factorial(n - r)
(n, x, p) = map(int, input().split())
sm = x - 1
big = n - x
left = 0
right = n
l = r = 0
mod = 10 ** 9 + 7
while left < right:
	mid = (left + right) // 2
	if mid <= p:
		if mid != p:
			l += 1
		left = mid + 1
	else:
		r += 1
		right = mid
ans = 0
if l > sm or r > big or left - 1 != p:
	print(0)
else:
	ans = nPr(sm, l) % mod
	ans %= mod
	ans *= nPr(big, r) % mod
	ans %= mod
	ans *= math.factorial(n - (l + r + 1)) % mod
	print(ans % mod)


import math
(size, x, pos) = list(map(int, input().split()))
left = 0
right = size
middle = (left + right) // 2
res = 1
val_gt_x = size - x
val_lt_x = size - val_gt_x - 1
mod_val = 1000000007
while left < right:
	if pos < middle:
		right = middle
		if val_gt_x == 0:
			print(0)
			exit()
		res *= val_gt_x
		val_gt_x -= 1
	elif pos == middle:
		left = middle + 1
	else:
		left = middle + 1
		if val_lt_x == 0:
			print(0)
			exit()
		res *= val_lt_x
		val_lt_x -= 1
	middle = (left + right) // 2
	res = res % mod_val
res *= math.factorial(val_gt_x + val_lt_x)
res = res % mod_val
print(res)


import bisect
import collections
import copy
import functools
import heapq
import itertools
import math
import random
import re
import sys
import time
import string
from typing import List
sys.setrecursionlimit(99999)
(n, x, p) = map(int, input().split())
lx = x - 1
rx = n - x
mod = 10 ** 9 + 7
l = 0
r = n
ans = 1
while l < r:
	mid = (l + r) // 2
	if mid > p:
		r = mid
		ans *= rx
		rx -= 1
	else:
		if mid < p:
			ans *= lx
			lx -= 1
		l = mid + 1
	ans %= mod
f = [1] * 1001
for i in range(2, 1001):
	f[i] = f[i - 1] * i % mod
print(ans * f[lx + rx] % (10 ** 9 + 7))


import sys, math
input = sys.stdin.readline

def perm(a, b):
	if a < b:
		return 0
	num = fact[a]
	denom = pow(fact[a - b], mod - 2, mod)
	return num * denom % mod

def bs(arr, pos):
	left = 0
	right = len(arr)
	l = 0
	r = 0
	while left < right:
		mid = (left + right) // 2
		if arr[mid] < arr[pos]:
			left = mid + 1
			l += 1
		elif arr[mid] == arr[pos]:
			left = mid + 1
		else:
			right = mid
			r += 1
	return (l, r)
(n, x, pos) = map(int, input().split())
mod = int(1000000000.0 + 7)
arr = [i for i in range(1, n + 1)]
fact = [1]
for i in range(1, 1005):
	fact.append(fact[i - 1] * i % mod)
(l, r) = bs(arr, pos)
ans = perm(n - x, r) * perm(x - 1, l) % mod
ans = ans * fact[n - r - l - 1] % mod
print(ans)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')

	def factorialMod(n, modulus):
		ans = 1
		for i in range(1, n + 1):
			ans = ans * i % modulus
		return ans % modulus
	for _ in range(1):
		(n, x, pos) = ria()
		left = 0
		right = n
		smaller = x - 1
		greater = n - x
		sum = 1
		rest = n - 1
		while left < right:
			middle = (left + right) // 2
			if middle == pos:
				left = middle + 1
			elif middle > pos:
				sum = sum * greater % mod
				greater -= 1
				rest -= 1
				right = middle
			else:
				sum = sum * smaller % mod
				smaller -= 1
				rest -= 1
				left = middle + 1
		if left > 0 and left - 1 == pos:
			sum = sum * factorialMod(rest, mod) % mod
		else:
			sum = 0
		print(sum)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


import sys
input = sys.stdin.readline

def bs(r, x):
	left = 0
	right = r
	while left < right:
		m = (left + right) // 2
		if m <= x:
			left = m + 1
			arr[m] = 'S'
		else:
			right = m
			arr[m] = 'G'
mod = 10 ** 9 + 7
fact = [1] * 1001
for i in range(1, len(fact)):
	fact[i] = fact[i - 1] * i % mod

def c(n, r):
	num = fact[n]
	deno = fact[n - r] % mod
	deno = pow(deno, mod - 2, mod)
	return num * deno % mod
(n, x, pos) = list(map(int, input().split(' ')))
arr = [0] * n
bs(n, pos)
l = -1
g = 0
for i in range(n):
	if arr[i] == 'S':
		l += 1
	elif arr[i] == 'G':
		g += 1
if l < x and n - x >= g:
	temp = 1
	temp *= c(x - 1, l)
	temp = temp % mod
	temp *= c(n - x, g)
	temp = temp % mod
	temp *= fact[n - l - g - 1]
	temp = temp % mod
	print(temp)
else:
	print(0)


def algo(arr, y):
	ans = []
	left = 0
	right = len(arr)
	while left < right:
		middle = (left + right) // 2
		ans.append(arr[middle])
		if arr[middle] <= y:
			left = middle + 1
		else:
			right = middle
	if left > 0 and arr[left - 1] == y:
		return (True, ans)
	return (False, ans)
mod = 1000000000 + 7

def C(n, k):
	if 0 <= k <= n:
		nn = 1
		kk = 1
		for t in range(1, min(k, n - k) + 1):
			nn *= n
			kk *= t
			n -= 1
		return nn // kk % mod
	else:
		return 0

def fact(n):
	ans = 1
	for i in range(1, n + 1):
		ans *= i
		ans %= mod
	return ans
(n, x, pos) = list(map(int, input().split()))
a = []
for i in range(n):
	if i < pos:
		a.append(x - 1)
	elif i == pos:
		a.append(x)
	else:
		a.append(x + 1)
(res, seq) = algo(a, x)
assert res
sum1 = 0
sum2 = 0
for elem in seq:
	if elem < x:
		sum1 += 1
	elif elem > x:
		sum2 += 1
answer = fact(n - 1 - sum1 - sum2) * C(x - 1, sum1)
answer %= mod
answer *= fact(sum1)
answer %= mod
answer *= C(n - x, sum2)
answer %= mod
answer *= fact(sum2)
answer %= mod
print(answer)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]

def givecount(low, high, ind):
	up = set()
	less = set()
	while low < high:
		mid = low + high >> 1
		if mid <= ind:
			if mid != ind:
				less.add(mid)
		else:
			up.add(mid)
		if mid <= ind:
			low = mid + 1
		else:
			high = mid
	if low > 0:
		return [len(less), len(up)]
	return [1000, 1000]

def ncr(n, r, p=mod):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
facts = [1]
for i in range(1, 1005):
	facts.append(facts[-1] * i % mod)
(n, x, pos) = li()
ans = 0
req = givecount(0, n, pos)
(a, b) = req
ans = ncr(x - 1, a) * ncr(n - x, b) * facts[n - a - b - 1] * facts[a] * facts[b] % mod
print(ans)


mod = 1000000007
(n, x, pos) = map(int, input().split())
ans = 1
left = 0
right = n
toLeft = n - x
toRight = x - 1
failed = False
c = 0
while left < right:
	middle = (left + right) // 2
	if middle == pos:
		left = middle + 1
		c += 1
	elif middle > pos:
		if toLeft == 0:
			failed = True
			break
		else:
			ans *= toLeft
			ans %= mod
			toLeft -= 1
			right = middle
			c += 1
	elif toRight == 0:
		failed = True
		break
	else:
		ans *= toRight
		ans %= mod
		toRight -= 1
		left = middle + 1
		c += 1
if failed:
	print(0)
else:
	for i in range(n - c):
		ans *= i + 1
		ans %= mod
	print(ans)


(n, x, p) = [int(x) for x in input().split(' ')]
a = [-1 for x in range(n)]
M = int(1000000000.0) + 7
(l, r) = (0, n)
sm = x - 1
gr = n - x
while l < r:
	mid = (l + r) // 2
	if mid <= p:
		if mid == p:
			a[mid] = 1
		else:
			a[mid] = sm
			sm -= 1
			sm = max([0, sm])
		l = mid + 1
	elif mid > p:
		a[mid] = gr
		gr -= 1
		gr = max([0, gr])
		r = mid
answer = 1
rem = sm + gr
for i in range(n):
	if a[i] == -1:
		answer *= rem
		answer %= M
		rem -= 1
	else:
		answer *= a[i]
		answer %= M
print(answer)


import math
yes = 'YES'
no = 'NO'
lower = 'L'
higher = 'H'
same = 'O'

def bin_search(a, x):
	left = 0
	right = len(a)
	res = []
	while left < right:
		mid = (left + right) // 2
		if a[mid] < x:
			left = mid + 1
			res.append(higher)
		elif a[mid] == x:
			left = mid + 1
			res.append(same)
		else:
			right = mid
			res.append(lower)
	return res

def solve():
	numbers = list(map(int, input().split(' ')))
	options = bin_search([i for i in range(numbers[0])], numbers[2])
	res = 1
	(higher_numbers, lower_numbers) = (numbers[0] - numbers[1], numbers[1] - 1)
	for o in options:
		if o == higher:
			res *= lower_numbers
			lower_numbers -= 1
		elif o == lower:
			res *= higher_numbers
			higher_numbers -= 1
	res *= math.factorial(numbers[0] - len(options))
	print(res % (10 ** 9 + 7))
	return None
solve()


mod = 10 ** 9 + 7
(n, x, pos) = list(map(int, input().split()))
m = n - x
l = x - 1
ans = 1
i = 0
j = n
while i < j:
	mid = (i + j) // 2
	if mid > pos:
		ans = ans * m % mod
		m = m - 1
		j = mid
	elif mid <= pos:
		if mid == pos:
			ans = ans * 1
		else:
			ans = ans * l % mod
			l = l - 1
		i = mid + 1
for i in range(1, l + m + 1):
	ans = ans * i % mod
print(ans % mod)


import math
import sys, bisect
from heapq import *
from itertools import *
from collections import *
sys.setrecursionlimit(10 ** 6)
I = lambda : int(sys.stdin.readline())
neo = lambda : map(int, sys.stdin.readline().split())
Neo = lambda : list(map(int, sys.stdin.readline().split()))
(n, val, pos) = neo()
less = val - 1
large = n - val
s = 0
e = n
Ans = 1
while s < e:
	mid = (s + e) // 2
	if mid < pos:
		s = mid + 1
		Ans *= less
		less -= 1
	elif mid > pos:
		e = mid
		Ans *= large
		large -= 1
	else:
		s = mid + 1
less += large
for i in range(less, 0, -1):
	Ans *= i
print(Ans % (10 ** 9 + 7))


def fact(n):
	ans = 1
	for i in range(2, n + 1):
		ans *= i
	return ans
(n, m, k) = [int(x) for x in input().split()]
l = m - 1
g = n - l - 1
ans = 1
start = 0
end = n
while start < end:
	mid = (start + end) // 2
	if mid == k:
		start = mid + 1
	elif mid < k:
		ans *= l
		l -= 1
		start = mid + 1
	else:
		ans *= g
		g -= 1
		end = mid
ans *= fact(l + g)
print(ans % (10 ** 9 + 7))


M = 10 ** 9 + 7

def inv(n):
	return power(n, M - 2)

def power(x, y):
	ans = 1
	while y > 0:
		if y % 2 == 1:
			ans = ans * x % M
		y = y // 2
		x = x * x % M
	return ans % M

def com(n, r):
	if r == 0:
		return 1
	else:
		return f[n] * inv(f[n - r]) % M % M
f = [1]
x = 1
for i in range(1, 10 ** 5 + 3):
	x = x * i % M
	f.append(x)
(n, x, pos) = map(int, input().split())
l = []
for i in range(1, n + 1):
	l.append(i)
cnthigh = 0
cntlow = 0
low = 0
high = n
ele = l[pos]
while low < high:
	mid = (low + high) // 2
	if l[mid] <= ele:
		cntlow += 1
		low = mid + 1
	else:
		cnthigh += 1
		high = mid
r = 0
if low > 0 and l[low - 1] == ele:
	r = 1
else:
	print(0)
	exit()
tlow = 0
thigh = 0
cntlow -= 1
for i in range(1, n + 1):
	if i > x:
		thigh += 1
	if i < x:
		tlow += 1
if tlow < cntlow or thigh < cnthigh:
	print(0)
	exit()
rlow = tlow - cntlow
rhigh = thigh - cnthigh
rtotal = rlow + rhigh
ans = f[rtotal]
ans1 = com(tlow, cntlow) % M
ans2 = com(thigh, cnthigh) % M
anst = ans1 * ans2 % M
anst = anst * ans % M
print(anst)


import math
g = lambda : map(int, input().split())
mod = 10 ** 9 + 7
(n, x, pos) = g()
ans = 1
r = n
l = 0
ans = 1
up = n - x
sm = x - 1
count = 0
while l < r:
	m = (l + r) // 2
	if m <= pos:
		if m != pos:
			ans = ans * sm
			sm -= 1
		l = m + 1
	else:
		if m != pos:
			ans = ans * up
			up -= 1
		r = m
	count += 1
	ans = ans % mod
ans *= math.factorial(n - count) % mod
ans %= mod
print(ans)


from collections import *
from functools import *
import math
import sys
inp = sys.stdin.readline
out = sys.stdout.write

def mi():
	return map(int, inp().split())

def li():
	return list(mi())

def ii():
	return int(inp())

def main():
	mod = 10 ** 9 + 7

	def bi(n, x, p):
		ans = 1
		left = 0
		right = n
		x1 = x - 1
		n1 = n - x
		co = 0
		while left < right:
			m = (left + right) // 2
			if m < p:
				ans *= x1 % mod
				x1 -= 1
				left = m + 1
			elif m > p:
				ans *= n1 % mod
				n1 -= 1
				right = m
			else:
				left = m + 1
			co += 1
		return (ans, co)
	(n, x, p) = mi()
	(ans, co) = bi(n, x, p)
	im = math.factorial(n - co)
	print(im % mod * (ans % mod) % mod)
main()


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from bisect import *
from math import sqrt, pi, ceil, log
import math
from itertools import permutations
from copy import deepcopy
from sys import setrecursionlimit

def main():
	(n, x, pos) = map(int, input().split())
	mod = 10 ** 9 + 7
	f = [1]
	for i in range(1, 1001):
		f.append(f[-1] * i % mod)
	lo = 0
	hi = n
	b = x - 1
	c = n - x
	ans = 1
	while lo < hi:
		mid = (lo + hi) // 2
		if mid < pos:
			ans = ans * b % mod
			b -= 1
			lo = mid + 1
		elif mid > pos:
			ans = ans * c % mod
			c -= 1
			hi = mid
		else:
			lo = mid + 1
	print(ans * f[b + c] % mod)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin, stdout
input = stdin.readline
print = lambda x: stdout.write(str(x) + '\n')

def bs(n, pos):
	a = list(range(n))
	(l, r) = (0, n)
	(low, high) = (0, 0)
	taken = set()
	while l < r:
		m = (l + r) // 2
		if a[m] < pos:
			l = m + 1
			if m not in taken:
				low += 1
		elif a[m] > pos:
			r = m
			if m not in taken:
				high += 1
		else:
			l = m + 1
		taken.add(m)
	return (low, high)
(n, x, pos) = map(int, input().split())
(low, high) = bs(n, pos)
(xl, xh) = (x - 1, n - x)
rem = xl + xh - low - high
if xl < low or xh < high:
	print(0)
	exit()
M = 1000000007

def nCr(n, r, M):
	return fact[n] * inv[n - r] % M * inv[r] % M
fact = [1] * (n + 1)
for i in range(1, n + 1):
	fact[i] = fact[i - 1] * i % M
inv = [1] * (xl + 1)
inv[xl] = pow(fact[xl], M - 2, M)
for i in range(xl - 1, -1, -1):
	inv[i] = inv[i + 1] * (i + 1) % M
res1 = nCr(xl, low, M) * fact[low] % M
inv = [1] * (xh + 1)
inv[xh] = pow(fact[xh], M - 2, M)
for i in range(xh - 1, -1, -1):
	inv[i] = inv[i + 1] * (i + 1) % M
res2 = nCr(xh, high, M) * fact[high] % M
res3 = fact[rem]
ans = res1 * res2 * res3 % M
print(ans)


import sys
input = sys.stdin.readline
MOD = 10 ** 9 + 7
N = 2000
fact = [0 for _ in range(N)]
invfact = [0 for _ in range(N)]
fact[0] = 1
for i in range(1, N):
	fact[i] = fact[i - 1] * i % MOD
invfact[N - 1] = pow(fact[N - 1], MOD - 2, MOD)
for i in range(N - 2, -1, -1):
	invfact[i] = invfact[i + 1] * (i + 1) % MOD

def nCk(n, k):
	if k < 0 or n < k:
		return 0
	else:
		return fact[n] * invfact[k] * invfact[n - k] % MOD

def main():
	(n, x, pos) = map(int, input().split())
	b = 0
	s = 0
	l = 0
	r = n
	while l < r:
		m = (l + r) // 2
		if m <= pos:
			l = m + 1
			if m != pos:
				s += 1
		else:
			r = m
			if m != pos:
				b += 1
	b_cnt = n - x
	s_cnt = x - 1
	c = n - 1 - b - s
	ans = fact[c] * nCk(b_cnt, b) * nCk(s_cnt, s) * fact[b] * fact[s]
	print(ans % MOD)
for _ in range(1):
	main()


import bisect
import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solution():
	(n, x, pos) = inlt()
	solve(n, x, pos)

def solve(n, x, pos):
	a = 0
	b = 0
	left = 0
	right = n
	while left < right:
		middle = (left + right) // 2
		if middle <= pos:
			left = middle + 1
			a += 1
		else:
			right = middle
			b += 1
	a -= 1
	l = math.factorial(x - 1) // math.factorial(x - 1 - a) if x - 1 >= a else 0
	r = math.factorial(n - x) // math.factorial(n - x - b) if n - x >= b else 0
	mod = 10 ** 9 + 7
	l %= mod
	r %= mod
	print(l * r * math.factorial(n - 1 - a - b) % mod)
solution()


PRIME = int(1000000000.0 + 7)

def perm(k, n, mod):
	res = 1
	for i in range(n, n - k, -1):
		res = res * i % mod
	return res

def BinarySearch(a, x):
	branches = []
	left = 0
	right = len(a)
	while left < right:
		middle = int((left + right) // 2)
		if a[middle] <= x:
			branches.append(1)
			left = middle + 1
		else:
			branches.append(0)
			right = middle
	return branches
(n, x, pos) = tuple(map(int, input().split()))
path = BinarySearch(list(range(1, n + 1)), pos + 1)
n_ones = sum(path)
n_zeros = len(path) - n_ones
a1 = perm(n_ones - 1, x - 1, PRIME)
a0 = perm(n_zeros, n - x, PRIME)
n_other = n - (n_ones + n_zeros)
a_other = perm(n_other, n_other, PRIME)
res = a1 * a0 % PRIME
res = res * a_other % PRIME
print(res)


import sys, string
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi, log2

def input():
	return sys.stdin.buffer.readline().decode('utf-8')
from bisect import bisect_left, bisect_right
from operator import add
MOD = int(1000000000.0) + 7
INF = float('inf')

def prod(a, b):
	ans = 1
	for x in range(a, b + 1):
		ans *= x
		ans %= MOD
	return ans

def fact(x):
	ans = 1
	while x:
		ans *= x
		ans %= MOD
		x -= 1
	return ans

def coef(n, k):
	if k > n:
		return 0
	return prod(n - k + 1, n) * pow(fact(k) % MOD, MOD - 2, MOD) % MOD

def solve():
	(n, x, pos) = [int(x) for x in input().split()]
	l = 0
	r = n
	less = x - 1
	greater = n - x
	ans = 1
	cnt = 0
	while l < r:
		m = (l + r) // 2
		if m < pos:
			l = m + 1
			ans *= less
			less -= 1
		elif m > pos:
			r = m
			ans *= greater
			greater -= 1
		else:
			l = m + 1
		cnt += 1
	print(ans * fact(n - cnt) % MOD)
T = 1
for case in range(1, T + 1):
	ans = solve()


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res) % MOD

def comb(n, x):
	(a, b) = (1, 1)
	for i in range(1, x + 1):
		a *= n + 1 - i
		b *= i
	return a // b % MOD

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	if y == 0:
		return 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(moves, n):
	val = (moves + 1) // 2
	rem = moves - val
	sol = (val + 1) * (rem + 1)
	return sol < n

def sortSecond(val):
	return val[1]
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
small = 'abcdefghijklmnopqrstuvwxyz'
large = small.upper()
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect
import functools as fnt
from decimal import Decimal

def solve():
	(n, x, pos) = read()
	(low, high) = (0, n)
	less = 0
	more = 0
	while low < high:
		mid = (low + high) // 2
		if mid <= pos:
			low = mid + 1
			less += 1
		else:
			high = mid
			more += 1
	less -= 1
	if less <= x - 1 and more <= n - x:
		ans = comb(x - 1, less) * factorial(less, MOD) % MOD * (comb(n - x, more) * factorial(more, MOD) % MOD) * factorial(n - 1 - (less + more), MOD) % MOD
		print(ans)
	else:
		print(0)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = 1
for i in range(t):
	solve()


MOD = 10 ** 9 + 7
(n, x, pos) = map(int, input().split())
lt = 0
gt = 0
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	if pos >= middle:
		if pos > middle:
			lt += 1
		left = middle + 1
	else:
		gt += 1
		right = middle
if x - 1 >= lt and n - x >= gt:
	c = 1
	for i in range(x - 1, x - 1 - lt, -1):
		c *= i
	c %= MOD
	ans = c
	c = 1
	for i in range(n - x, n - x - gt, -1):
		c *= i
	c %= MOD
	ans = ans * c % MOD
	c = 1
	for i in range(1, n - lt - gt):
		c = c * i % MOD
	ans = ans * c % MOD
else:
	ans = 0
print(ans)


def aranjamente(n, k) -> int:
	modulo = 10 ** 9 + 7
	output = 1
	if k > n:
		return 0
	for x in range(n - k + 1, n + 1):
		output = output * x % modulo
	return output

def reorder():
	(n, k, pos) = [int(x) for x in input().split(' ')]
	left = 0
	right = n
	modulo = 10 ** 9 + 7
	ans = 1
	left_val = 0
	right_val = 0
	while left < right:
		middle = (left + right) // 2
		if middle <= pos:
			left = middle + 1
			left_val += 1
		else:
			right = middle
			right_val += 1
	al = aranjamente(k - 1, left_val - 1)
	ar = aranjamente(n - k, right_val)
	for x in range(1, n - left_val - right_val + 1):
		ans = ans * x % modulo
	ans = ans * al % modulo
	ans = ans * ar % modulo
	print(ans)
reorder()


(n, x, pos) = [int(a) for a in input().split()]
factorials = [1]
for i in range(1, 1033):
	factorials.append(factorials[-1] * i)

def fac(n):
	return factorials[n]
mod = int(1000000000.0 + 7)
count_left = 0
count_right = 0

def binary_search(a, x):
	global count_left, count_right
	left = 0
	right = len(a)
	while left < right:
		middle = (left + right) // 2
		if a[middle] <= x:
			left = middle + 1
			if a[middle] != x:
				count_left += 1
		else:
			right = middle
			count_right += 1
nums = list(range(n))
binary_search(nums, pos)
if x <= count_left or x > n - count_right:
	print(0)
	import sys
	sys.exit()

def binomial(n, k):
	return 1 if n <= 0 else fac(n) // fac(n - k)
left = max(1, binomial(x - 1, count_left) % mod)
right = max(1, binomial(n - x, count_right) % mod)
print(fac(n - count_left - count_right - 1) * left * right % mod)


from math import factorial

def combo(n, x, pos):
	mod = 10 ** 9 + 7
	left = 0
	right = n
	more = n - x
	less = x - 1
	answer = 1
	while left < right:
		mid = (left + right) // 2
		if mid < pos:
			answer *= less
			less -= 1
			left = mid + 1
		elif mid > pos:
			answer *= more
			more -= 1
			right = mid
		else:
			left = mid + 1
	answer *= factorial(more + less)
	return answer % mod
(a, b, c) = map(int, input().strip().split())
print(combo(a, b, c))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

def solve(case):
	(n, x, pos) = sep()
	lo = 0
	hi = n
	mid = (lo + hi) // 2
	less = 0
	more = 0
	while mid != pos:
		if mid > pos:
			more += 1
			hi = mid
		else:
			less += 1
			lo = mid + 1
		mid = (lo + hi) // 2
	lo = (lo + hi) // 2 + 1
	while hi > lo:
		hi = (lo + hi) // 2
		if hi != pos:
			more += 1
	if less > x - 1 or more > n - x:
		print(0)
	else:
		temp = 1
		temp *= ncr(n - x, more) % mod
		temp *= ncr(x - 1, less) % mod
		temp *= factorial(less) % mod
		temp *= factorial(more) % mod
		temp *= factorial(n - (more + less + 1)) % mod
		print(temp % mod)
testcase(1)


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)

def tup():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return input().strip()

def grid(r, c):
	return [lint() for i in range(r)]

def debug(*args, c=6):
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=stderr)
fact = [0] * 1001
fact[0] = 1
fact[1] = 1
for i in range(1, 1001):
	fact[i] = i * fact[i - 1] % mod
(n, x, p) = tup()
sm = x - 1
gr = n - x
l = 0
h = n
ans = 1
while l < h:
	m = (l + h) // 2
	if m == p:
		l = m + 1
	elif m > p:
		h = m
		ans = ans * gr % mod
		gr -= 1
	else:
		ans = ans * sm % mod
		l = m + 1
		sm -= 1
	n -= 1
if ans > 0:
	ans = ans * fact[n] % mod
	print(ans)
else:
	print(0)


import sys
from collections import deque
from copy import *
from itertools import permutations as prm, product

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def string(s):
	return ''.join(s)

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def bo(i):
	return ord(i) - ord('A')

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j, n, m):
	return 0 <= i < n and 0 <= j < m

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = 1
mod = 10 ** 9 + 7
f = [1 for i in range(1001)]
inf = [1 for i in range(1001)]
for i in range(0, 1001):
	f[i] = f[i - 1] * max(i, 1) % mod
	inf[i] = pow(f[i], mod - 2, mod)

def ncr(n, r):
	if n < r:
		return 0
	return f[n] * inf[r] * inf[n - r] % mod
while t > 0:
	t -= 1
	(n, x, pos) = mi()
	u = d = 0
	l = 0
	r = n
	while l < r:
		mid = (l + r) // 2
		if mid > pos:
			u += 1
		if mid < pos:
			d += 1
		if mid <= pos:
			l = mid + 1
		else:
			r = mid
	ans = ncr(x - 1, d) * f[d] * ncr(n - x, u) * f[u] * f[n - u - d - 1] % mod
	print(ans)


def C(n, k):
	ans = 1
	for i in range(n, n - k, -1):
		ans *= i
		ans %= 10 ** 9 + 7
	ans = max(1, ans)
	return ans
(n, m, k) = map(int, input().split())
l = 0
r = int(n)
x1 = 0
x2 = 0
while l < r:
	mid = (l + r) // 2
	if mid < k:
		l = mid + 1
		x1 += 1
	elif mid == k:
		l = mid + 1
	else:
		r = mid
		x2 += 1
if x1 > m - 1 or x2 > n - m:
	print(0)
else:
	Ans = 1
	Ans *= C(m - 1, x1)
	Ans *= C(n - m, x2)
	Ans %= 10 ** 9 + 7
	for i in range(1, n - x1 - x2):
		Ans *= i
		Ans %= 10 ** 9 + 7
	print(Ans)


(n, x, p) = map(int, input().split())
(l, r) = (0, n)
big = small = 0
while l < r:
	m = (l + r) // 2
	if p < m:
		r = m
		big += 1
	else:
		l = m + 1
		if m != p:
			small += 1
ans = 1
mod = 1000000007
for i in range(big):
	ans = ans * (n - x - i) % mod
for i in range(1, small + 1):
	ans = ans * (x - i) % mod
for i in range(1, n - small - big):
	ans = ans * i % mod
print(ans)


from sys import stdin, stdout
input = stdin.readline
from collections import defaultdict as dd
import math

def geti():
	return map(int, input().strip().split())

def getl():
	return list(map(int, input().strip().split()))

def gets():
	return input()

def geta():
	return int(input())

def print_s(s):
	stdout.write(s + '\n')

def solve():
	(n, x, pos) = geti()
	mod = int(1000000000.0 + 7)
	start = 0
	end = n
	ans = 1
	left = x - 1
	right = n - x
	rem = n - 1
	while start < end:
		mid = start + (end - start) // 2
		if mid == pos:
			start = mid + 1
		elif mid < pos:
			rem -= 1
			ans *= left
			left -= 1
			ans %= mod
			start = mid + 1
		else:
			rem -= 1
			ans *= right
			right -= 1
			ans %= mod
			end = mid
	for i in range(rem, 0, -1):
		ans *= i
		ans %= mod
	print(ans)
solve()


import math
import sys
sys.setrecursionlimit(1000000)
(n, x, pos) = map(int, input().split())
left = 0
right = n
ans = 1
tx = x - 1
ty = n - x
while left < right:
	mid = (left + right) // 2
	if mid > pos:
		ans = ans * ty % (10 ** 9 + 7)
		ty -= 1
		right = mid
	elif mid < pos:
		ans = ans * tx % (10 ** 9 + 7)
		tx -= 1
		left = mid + 1
	else:
		left = mid + 1
for i in range(1, tx + ty + 1):
	ans = ans * i % (10 ** 9 + 7)
print(ans)


mod = 10 ** 9 + 7
(n, x, pos) = map(int, input().split())
(left, right) = (0, n)
(lower, higher, ans) = (x - 1, n - x, 1)
while left < right:
	mid = (left + right) // 2
	if mid == pos:
		left = mid + 1
	elif mid > pos:
		ans = ans * higher % mod
		right = mid
		higher -= 1
	else:
		ans = ans * lower % mod
		lower -= 1
		left = mid + 1
lower += higher
while lower > 0:
	ans = ans * lower % mod
	lower -= 1
print(ans % mod)


from math import perm as A, factorial as P
MOD = 1000 * 1000 * 1000 + 7

def solve():
	(n, x, pos) = map(int, input().split())
	left_count = 0
	right_count = 0
	left = 0
	right = n
	while left < right:
		middle = (left + right) // 2
		if middle <= pos:
			left = middle + 1
			left_count += 1
		else:
			right = middle
			right_count += 1
	left_count -= 1
	ans = A(x - 1, left_count) % MOD
	ans *= A(n - x, right_count) % MOD
	ans *= P(n - 1 - left_count - right_count) % MOD
	print(ans % MOD, end='')
solve()


import math
(n, x, p) = map(int, input().split())
(low, high, less_count, more_count) = (0, n, 0, 0)
while low < high:
	mid = (low + high) // 2
	if mid > p:
		more_count += 1
		high = mid
	else:
		less_count += int(p != mid)
		low = mid + 1
(left, avail_less, avail_more) = (n - less_count - more_count - 1, x - 1, n - x)
(less_choices, more_choices) = (math.comb(avail_less, less_count) * math.factorial(less_count) % (10 ** 9 + 7), math.comb(avail_more, more_count) * math.factorial(more_count) % (10 ** 9 + 7))
print(less_choices * more_choices * math.factorial(left) % (10 ** 9 + 7))


import math
import sys
sys.setrecursionlimit(1000)
_MODER = 10 ** 9 + 7

def solve(n: int, x: int, p: int) -> int:

	def per(lo, hi, small_count, large_count):
		if lo >= hi:
			return math.factorial(small_count + large_count)
		mid = (lo + hi) // 2
		if p == mid:
			return per(mid + 1, hi, small_count, large_count)
		elif p < mid:
			if large_count == 0:
				return 0
			return large_count * per(lo, mid, small_count, large_count - 1) % _MODER
		else:
			if small_count == 0:
				return 0
			return small_count * per(mid + 1, hi, small_count - 1, large_count) % _MODER
	res = per(0, n, x - 1, n - x)
	return res
(n, x, p) = map(int, input().split())
r = solve(n, x, p)
print(r)


mod = int(1000000000.0 + 7)
fac = [1]
for i in range(1, 1001):
	fac.append(fac[-1] * i % mod)
inverse_fac = [pow(fac[-1], mod - 2, mod)]
for i in range(1000, 0, -1):
	inverse_fac.append(inverse_fac[-1] * i % mod)
inverse_fac.reverse()

def ncr(n, r):
	if n < r:
		return 0
	return fac[n] * inverse_fac[n - r] % mod
(n, x, pos) = map(int, input().split())
req_b = 0
req_s = 0
have_b = n - x
have_s = x - 1
l = 0
h = n
while l < h:
	mid = (l + h) // 2
	if mid > pos:
		h = mid
		req_b += 1
	elif mid < pos:
		l = mid + 1
		req_s += 1
	else:
		l = mid + 1
bi = ncr(have_b, req_b)
sm = ncr(have_s, req_s)
remain = fac[n - req_b - req_s - 1]
ans = bi * sm % mod
ans = ans * remain % mod
print(ans)


(n, x, pos) = map(int, input().split())
gt = []
(l, r) = (0, n)
while l < r:
	mid = (l + r) // 2
	if mid <= pos:
		gt.append(False)
		l = mid + 1
	else:
		gt.append(True)
		r = mid
(a, b) = (gt.count(True), gt.count(False))
(aa, bb) = (n - x, x)
bb -= 1
b -= 1
sol = 1
for i in range(a):
	sol *= aa - i
	sol %= 10 ** 9 + 7
for i in range(b):
	sol *= bb - i
	sol %= 10 ** 9 + 7
for i in range(n - len(gt)):
	sol *= i + 1
	sol %= 10 ** 9 + 7
print(sol)


def c(n, k):
	if k > n:
		return 0
	s = 1
	for i in range(max(n - k, k) + 1, n + 1):
		s *= i
	for i in range(2, min(k, n - k) + 1):
		s //= i
	return s % mod

def fa(k):
	s = 1
	for i in range(2, k + 1):
		s *= i
		s %= mod
	return s
(n, x, pos) = map(int, input().split())
mod = 10 ** 9 + 7
bol = 0
men = 0
l = 0
r = n
while l < r:
	m = (l + r) // 2
	if pos > m:
		men += 1
		l = m + 1
	elif m == pos:
		l = m + 1
	else:
		bol += 1
		r = m
print(c(x - 1, men) * c(n - x, bol) * fa(n - bol - men - 1) * fa(bol) * fa(men) % mod)


def read_ints():
	return map(int, input().split(' '))

def comb(n, k):
	ans = 1
	for i in range(k):
		ans *= n - i
	for i in range(k):
		ans //= i + 1
	return ans

def perm(n, k):
	ans = 1
	for i in range(k):
		ans *= n - i
	return ans
mod = 1000000007
(n, x, pos) = read_ints()
left = 0
right = n
smaller = x - 1
larger = n - x
schosen = 0
lchosen = 0
while left < right:
	mid = (left + right) // 2
	if mid == pos:
		left = mid + 1
	elif mid < pos:
		schosen += 1
		if schosen > smaller:
			print(0)
			exit(0)
		left = mid + 1
	else:
		lchosen += 1
		if lchosen > larger:
			print(0)
			exit(0)
		right = mid
rem = n - schosen - lchosen - 1
ans = perm(smaller, schosen) * perm(larger, lchosen) * perm(rem, rem) % mod
print(ans)


import math

def binary_search(a, x):
	left = 0
	right = len(a)
	n_less = 0
	n_greater = 0
	while left < right:
		middle = (left + right) // 2
		if a[middle] <= x:
			left = middle + 1
			if x != middle:
				n_less += 1
		else:
			right = middle
			n_greater += 1
	if left > 0 and a[left - 1] == x:
		return (True, n_less, n_greater)
	else:
		return (False, n_less, n_greater)

def combination(n, k):
	if k > n:
		return 0
	else:
		return math.factorial(n) // (math.factorial(k) * math.factorial(n - k))
nxpos = input().split(' ')
n = int(nxpos[0])
x = int(nxpos[1])
pos = int(nxpos[2])
n_smaller_numbers = x - 1
n_bigger_numbers = n - x
a = [i for i in range(n)]
(_, n_less, n_greater) = binary_search(a, pos)
c1 = combination(n_smaller_numbers, n_less) * math.factorial(n_less)
c2 = combination(n_bigger_numbers, n_greater) * math.factorial(n_greater)
res = c1 * c2 * math.factorial(n - n_less - n_greater - 1)
print(res % (1000000000 + 7))


(f, t) = (-1, 0)
INT = 10 ** 9 + 7

def mult(a, b):
	ans = 1
	for i in range(b):
		ans *= a - i
		ans %= INT
	return ans

def fact(a):
	ans = 1
	for i in range(a):
		ans *= i + 1
		ans %= INT
	return ans
L = []

def BinarySearch(num, pos):
	global f, t
	a = [i for i in range(num)]
	left = 0
	right = num
	while left < right:
		middle = (left + right) // 2
		if a[middle] <= pos:
			left = middle + 1
			f += 1
			L.append(False)
		else:
			right = middle
			t += 1
			L.append(True)
(n, x, pos) = map(int, input().split())
BinarySearch(n, pos)
X = x - 1
Y = n - X - 1
if X < f or Y < t:
	print(0)
	exit()
print(mult(X, f) * mult(Y, t) * fact(X + Y - t - f) % INT)


import math
for _ in range(1):
	(n, x, pos) = map(int, input().split())
	fact = []
	mod = 1000000007
	fact.append(1)
	for i in range(n + 1):
		fact.append(fact[i] % mod * (i + 1) % mod % mod)
	l = 0
	r = n
	(small, big) = (x - 1, n - x)
	ans = 1
	while l < r:
		mid = (l + r) // 2
		if mid > pos:
			r = mid
			ans *= big
			ans %= mod
			big -= 1
		elif mid <= pos:
			l = mid + 1
			if mid != pos:
				ans *= small
				ans %= mod
				small -= 1
	ans *= fact[small + big]
	ans %= mod
	print(ans % mod)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
(n, x, a) = map(int, input().split())
ans = 1
cnt = 0
cnt1 = 0
i = 0
j = n
mod = 1000000007
while i < j:
	mid = (i + j) // 2
	if mid < a:
		ans *= x - 1 - cnt1
		ans %= mod
		cnt1 += 1
		i = mid + 1
	elif mid > a:
		ans *= n - x - cnt
		ans %= mod
		cnt += 1
		j = mid
	else:
		i = mid + 1
cr = n - cnt - cnt1 - 1
for i in range(1, cr + 1):
	ans *= i
	ans %= mod
print(ans)


(n, x, pos) = map(int, input().split())
(x1, x2) = (0, n)
ans = []
f = 2000000 * [0]
p = int(1000000000.0 + 7)

def call(a, b):
	if a == 0 or b == 0 or a == b:
		return 1
	if b == 1:
		return a
	if f[a * 1001 + b]:
		return f[a * 1001 + b]
	f[a * 1001 + b] = (call(a - 1, b) % p + call(a - 1, b - 1) % p) % p
	return f[a * 1001 + b]
while x1 < x2:
	m = int((x1 + x2) / 2)
	ans.append(m)
	if m <= pos:
		x1 = m + 1
	else:
		x2 = m
(big, small, v) = (0, 0, 1)
for i in range(len(ans)):
	if ans[i] > pos:
		big += 1
	elif ans[i] < pos:
		small += 1

def fac(x):
	v = 1
	for i in range(2, x + 1):
		v *= i
		v %= p
	return v
if big > n - x or small > x - 1:
	print(0)
	exit(0)
l = fac(big) * (fac(small) * fac(n - small - big - 1)) % p % p
print(call(n - x, big) * call(x - 1, small) % p * l % p)


(n, x, pos) = map(int, input().split())

def binarysearch(n, pos, x):
	left = 0
	right = n
	ans = 1
	l = 0
	r = 0
	while left < right:
		middle = (left + right) // 2
		if middle < pos:
			r += 1
			left = middle + 1
		elif middle == pos:
			left = middle + 1
		else:
			right = middle
			l += 1
	for i in range(l):
		ans *= n - x - i
	for i in range(r):
		ans *= x - i - 1
	for i in range(1, n - l - r):
		ans *= i
	return ans % (10 ** 9 + 7)
	print(a, x, k, ans, i, j)
	return factorial(a - i - j) * ans % 1000000007
print(binarysearch(n, pos, x))


MOD = 10 ** 9 + 7

def fact(n):
	pdt = 1
	for i in range(1, n + 1):
		pdt *= i
		pdt %= MOD
	return pdt

def nPr(n, r):
	pdt = 1
	for i in range(r):
		pdt *= n
		pdt %= MOD
		n -= 1
	return pdt
(n, x, pos) = [int(x) for x in input().split()]
smallerCnts = x - 1
largerCnts = n - x
requiredSmallerCnts = 0
requiredLargerCnts = 0
l = 0
r = n
while True:
	if l - 1 == pos:
		while l < r:
			m = (l + r) // 2
			r = m
			requiredLargerCnts += 1
		break
	m = (l + r) // 2
	if m == pos:
		l = m + 1
	elif m < pos:
		requiredSmallerCnts += 1
		l = m + 1
	else:
		requiredLargerCnts += 1
		r = m
if requiredLargerCnts > largerCnts or requiredSmallerCnts > smallerCnts:
	ans = 0
else:
	remainder = n - 1 - requiredLargerCnts - requiredSmallerCnts
	ans = nPr(smallerCnts, requiredSmallerCnts) * nPr(largerCnts, requiredLargerCnts)
	ans %= MOD
	ans *= fact(remainder)
	ans %= MOD
print(ans)


from collections import Counter

def get_search_sequence(n, pos):

	def binary_search(arr, x):
		left = 0
		right = len(arr)
		expected_conditions = []
		while left < right:
			middle = (left + right) // 2
			if arr[middle] <= x:
				left = middle + 1
				if arr[middle] != x:
					expected_conditions.append('LTE')
			else:
				right = middle
				expected_conditions.append('GT')
		if left > 0 and arr[left - 1] == x:
			return expected_conditions
		else:
			return expected_conditions
	arr = [i for i in range(n)]
	return binary_search(arr, pos)
(n, x, pos) = map(int, input().split())
comparisons = Counter(get_search_sequence(n, pos))
lte_comp = comparisons.get('LTE', 0)
gt_comp = comparisons.get('GT', 0)
bigger_than_x = n - x
smaller_than_x = x - 1
from math import factorial
if smaller_than_x < lte_comp or bigger_than_x < gt_comp:
	print(0)
	exit(0)
smaller = factorial(smaller_than_x) // factorial(smaller_than_x - lte_comp) % int(1000000000.0 + 7)
bigger = factorial(bigger_than_x) // factorial(bigger_than_x - gt_comp) % int(1000000000.0 + 7)
the_rest = factorial(bigger_than_x + smaller_than_x - lte_comp - gt_comp) % int(1000000000.0 + 7)
print(smaller * bigger * the_rest % int(1000000000.0 + 7))


from operator import le
import os, sys
from io import IOBase, BytesIO
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def get_input(a=str):
	return a(input())

def get_int_input():
	return get_input(int)

def get_input_arr(a):
	return list(map(a, input().split()))

def get_int_input_arr():
	return get_input_arr(int)
import operator as op
from functools import reduce
import math

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a, m):
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m

def factorialMod(n, modulus):
	ans = 1
	if n <= modulus // 2:
		for i in range(1, n + 1):
			ans = ans * i % modulus
	else:
		for i in range(n + 1, modulus):
			ans = ans * i % modulus
		ans = modinv(ans, modulus)
		ans = -1 * ans + modulus
	return ans % modulus

def solve():
	(n, x_val, pos) = get_int_input_arr()
	MOD = 10 ** 9 + 7

	def bs(a, x):
		lower_pos = set()
		higher_pos = set()
		left = 0
		right = len(a)
		while left < right:
			middle = (left + right) // 2
			if a[middle] <= x:
				lower_pos.add(middle)
				left = middle + 1
			else:
				higher_pos.add(middle)
				right = middle
		return (lower_pos, higher_pos)
	arr = [x for x in range(1, n + 1)]
	(lower_pos, higher_pos) = bs(arr, arr[pos])
	l_len = len(lower_pos)
	h_len = len(higher_pos)
	fac_1 = 1
	if x_val - 1 >= l_len - 1:
		fac_1 = ncr(x_val - 1, l_len - 1) * factorialMod(l_len - 1, MOD)
	else:
		fac_1 = 0
	fac_2 = 1
	if n - x_val >= h_len:
		fac_2 = ncr(n - x_val, h_len) * factorialMod(h_len, MOD)
	else:
		fac_2 = 0
	fac_3 = 1
	if n - l_len - h_len > 0:
		fac_3 = factorialMod(n - l_len - h_len, MOD)
	res = fac_1 * fac_2 % MOD * fac_3 % MOD
	cout << res << endl

def main():
	solve()
main()


def inv(x):
	return pow(x, 1000000005, 1000000007)

def ncr(n, r):
	if r > n:
		return 0
	z = fact[n] * inv(fact[r])
	z %= 1000000007
	z = z * inv(fact[n - r])
	z %= 1000000007
	return z
fact = [0 for i in range(1005)]
fact[0] = 1
fact[1] = 1
for i in range(2, 1005):
	fact[i] = fact[i - 1] * i
	fact[i] %= 1000000007
l = input().split()
n = int(l[0])
x = int(l[1])
pos = int(l[2])
greater = 0
lesser = 0
left = 0
right = n
while left < right:
	m = (left + right) // 2
	if m <= pos:
		lesser += 1
		left = m + 1
	else:
		greater += 1
		right = m
z = fact[lesser - 1] * fact[greater]
z %= 1000000007
z = z * fact[n - greater - lesser]
z %= 1000000007
z = z * ncr(n - x, greater)
z %= 1000000007
z = z * ncr(x - 1, lesser - 1)
z %= 1000000007
print(z)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))
M = 10 ** 9 + 7
F = [0 for i in range(1000)]
F[0] = 1
for i in range(1, 1000):
	F[i] = i % M * F[i - 1] % M
C = [[0 for i in range(1000)] for j in range(1000)]
for i in range(0, 1000):
	C[i][0] = 1
	C[i][1] = i
	C[i][i] = 1
	for j in range(2, i):
		C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % M
(n, x, pos) = inlt()
(smaller, bigger) = (x - 1, n - x)
(cntBig, cntSmall) = (0, 0)
(left, right) = (0, n)
while left < right:
	middle = (left + right) // 2
	if middle == pos:
		left = middle + 1
	elif middle < pos:
		cntSmall += 1
		left = middle + 1
	else:
		cntBig += 1
		right = middle
others = n - 1 - cntBig - cntSmall
multiply = C[smaller][cntSmall] * F[cntSmall] % M * (C[bigger][cntBig] * F[cntBig] % M) % M
ans = multiply * F[others] % M
print(ans)


import math
import sys
MOD_BASE = 10 ** 9 + 7
(n, x, pos) = map(int, input().split())
left = 0
right = n
compared_from_left = set()
compared_from_right = set()
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		if middle < pos:
			compared_from_left.add(middle)
		left = middle + 1
	else:
		compared_from_right.add(middle)
		right = middle
num_left = len(compared_from_left)
num_right = len(compared_from_right)
num_greater = n - x
num_lesser = x - 1
if num_left > num_lesser or num_right > num_greater:
	print(0)
	sys.exit(0)
permutations_left = math.factorial(num_lesser) // math.factorial(num_lesser - num_left)
permutations_right = math.factorial(num_greater) // math.factorial(num_greater - num_right)
permutations_leftover = math.factorial(n - num_left - num_right - 1)
print(permutations_left * permutations_right * permutations_leftover % MOD_BASE)


mod = 1000000007

def facto(f, q):
	facto = 1
	for i in range(f, q + 1):
		facto = facto * i % mod
	return facto
(n, x, p) = map(int, input().split())
left = 0
right = n
r = 0
l = 0
while left < right:
	middle = (left + right) // 2
	if middle == p:
		left = middle + 1
	elif middle > p:
		right = middle
		r += 1
	else:
		left = middle + 1
		l += 1
if l <= x - 1 and r <= n - x:
	ans = facto(1, n - 1 - r - l) * facto(n - x - r + 1, n - x) * facto(x - 1 - l + 1, x - 1)
	ans = ans % mod
	print(ans)
else:
	print('0')


(n, x, pos) = map(int, input().split())
(l, h) = (0, n)
r = 1
z = 0
(p, q) = (x - 1, n - x)
while l < h:
	m = (l + h) // 2
	if m == pos:
		z += 1
		l = m + 1
	elif m > pos:
		z += 1
		r *= q
		q -= 1
		h = m
	else:
		z += 1
		r *= p
		p -= 1
		l = m + 1
for i in range(2, n - z + 1):
	r = r * i % 1000000007
print(r)


from math import factorial
(a, b, c) = map(int, input().split())
ans = 1
left = 0
right = a
gr = sm = 0
while left < right:
	mid = (left + right) // 2
	if mid == c:
		left = mid + 1
	elif mid < c:
		sm += 1
		left = mid + 1
	else:
		gr += 1
		right = mid
ans = 1
t = a - b
for i in range(gr):
	ans *= t - i
	ans %= 10 ** 9 + 7
for j in range(1, sm + 1):
	ans *= b - j
	ans %= 10 ** 9 + 7
q = a - (sm + gr + 1)
for i in range(1, q + 1):
	ans *= i
	ans %= 10 ** 9 + 7
print(ans)


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=300006, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater

class TrieNode:

	def __init__(self):
		self.children = [None] * 26
		self.isEndOfWord = False

class Trie:

	def __init__(self):
		self.root = self.getNode()

	def getNode(self):
		return TrieNode()

	def _charToIndex(self, ch):
		return ord(ch) - ord('a')

	def insert(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				pCrawl.children[index] = self.getNode()
			pCrawl = pCrawl.children[index]
		pCrawl.isEndOfWord = True

	def search(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				return False
			pCrawl = pCrawl.children[index]
		return pCrawl != None and pCrawl.isEndOfWord

class Node:

	def __init__(self, data):
		self.data = data
		self.count = 0
		self.left = None
		self.right = None

class BinaryTrie:

	def __init__(self):
		self.root = Node(0)

	def insert(self, pre_xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = pre_xor & 1 << i
			if val:
				if not self.temp.right:
					self.temp.right = Node(0)
				self.temp = self.temp.right
				self.temp.count += 1
			if not val:
				if not self.temp.left:
					self.temp.left = Node(0)
				self.temp = self.temp.left
				self.temp.count += 1
		self.temp.data = pre_xor

	def query(self, xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = xor & 1 << i
			if not val:
				if self.temp.left and self.temp.left.count > 0:
					self.temp = self.temp.left
				elif self.temp.right:
					self.temp = self.temp.right
			elif self.temp.right and self.temp.right.count > 0:
				self.temp = self.temp.right
			elif self.temp.left:
				self.temp = self.temp.left
			self.temp.count -= 1
		return xor ^ self.temp.data

def npr(n, r):
	if r > n:
		return 0
	fact = 1
	fact1 = 1
	for i in range(n):
		fact *= i + 1
		fact %= mod
	for i in range(n - r):
		fact1 *= i + 1
		fact1 %= mod
	fact *= pow(fact1, mod - 2, mod)
	return fact % mod
(n, x, pos) = map(int, input().split())
left = 0
right = n
a = [-2000 + i for i in range(pos)]
a.append(x)
b = [x + i + 1 for i in range(n - pos - 1)]
a += b
e = []
s = Combination(mod)
while left < right:
	middle = (left + right) // 2
	e.append(middle)
	if a[middle] <= x:
		left = middle + 1
	else:
		right = middle
e.sort()
le = []
le1 = []
for i in range(len(e)):
	if e[i] < pos:
		le.append(e[i])
	if e[i] > pos:
		le1.append(e[i])
ans = npr(x - 1, len(le))
ans1 = npr(n - x, len(le1))
ans2 = npr(n - len(le) - len(le1) - 1, n - len(le) - len(le1) - 1)
print(ans * ans1 * ans2 % mod)


(n, x, pos) = map(int, input().split())
a = [0] * n
(low, high) = (x - 1, n - x)
(l, r) = (0, n)
found = False
ans = 0
while l < r:
	m = (l + r) // 2
	if pos < m:
		if high == 0:
			ans = -1
			break
		a[m] = high
		high -= 1
		r = m
	else:
		if m != pos:
			if low == 0:
				ans = -1
				break
			a[m] = low
			low -= 1
		l = m + 1
mod = 10 ** 9 + 7
if ans == -1:
	print(0)
else:
	fans = 1
	for i in range(n):
		if a[i]:
			fans = fans * a[i] % mod
	left = low + high
	while left:
		fans = fans * left % mod
		left -= 1
	print(fans)


import typing
import sys
import math
import collections
import bisect
import itertools
import heapq
import decimal
INF = 10 ** 20
MOD = 10 ** 9 + 7

def ni():
	return int(sys.stdin.buffer.readline())

def ns():
	return map(int, sys.stdin.buffer.readline().split())

def na():
	return list(map(int, sys.stdin.buffer.readline().split()))

class ModCombination:

	def __init__(self, maxN, MOD):
		self._maxN = maxN
		self._MOD = MOD
		self.facts = [1]
		self.invs = [1] * (self._maxN + 1)
		fact = 1
		for i in range(1, self._maxN + 1):
			fact *= i
			fact %= self._MOD
			self.facts.append(fact)
		inv = pow(fact, self._MOD - 2, self._MOD)
		self.invs[self._maxN] = inv
		for i in range(self._maxN, 1, -1):
			inv *= i
			inv %= self._MOD
			self.invs[i - 1] = inv

	def nCr(self, n, r):
		return self.facts[n] * self.invs[r] * self.invs[n - r] % self._MOD

def main():
	(n, x, pos) = ns()
	mc = ModCombination(n, MOD)
	lcnt = 0
	rcnt = 0
	l = 0
	r = n
	while l < r:
		middle = int((l + r) / 2)
		if middle <= pos:
			l = middle + 1
			if middle != pos:
				lcnt += 1
		else:
			r = middle
			rcnt += 1
	if lcnt > x - 1 or rcnt > n - x:
		print(0)
		exit(0)
	ans = 1
	if lcnt > 0:
		ans *= mc.nCr(x - 1, lcnt) * math.factorial(lcnt)
		ans %= MOD
	if rcnt > 0:
		ans *= mc.nCr(n - x, rcnt) * math.factorial(rcnt)
		ans %= MOD
	ans *= math.factorial(n - 1 - lcnt - rcnt)
	ans %= MOD
	print(ans)
main()


import sys

def mul(val, times, M):
	ans = 1
	for i in range(0, times):
		ans *= val
		ans %= M
		val -= 1
	return ans

def input():
	return sys.stdin.readline().rstrip()
[n, x, pos] = list(map(int, input().split()))
gt = 0
lt = 0
M = 10 ** 9 + 7
l = 0
r = n
while l < r:
	mid = int((l + r) // 2)
	if pos >= mid:
		if pos != mid:
			lt += 1
		l = mid + 1
	else:
		gt += 1
		r = mid
ans = 1
ans = ans * mul(n - x, gt, M)
ans %= M
ans = ans * mul(x - 1, lt, M)
ans %= M
ans = ans * mul(n - gt - lt - 1, n - gt - lt - 1, M)
ans %= M
print(ans)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, x, pos) = map(int, input().split())
ans = []
mod = 10 ** 9 + 7
left = 0
right = n
while left < right:
	mid = (left + right) // 2
	if mid == pos:
		left = mid + 1
	elif mid < pos:
		ans.append('r')
		left = mid + 1
	else:
		ans.append('l')
		right = mid
fact = [1]
for s in range(1, n + 1):
	fact.append(fact[-1] * s % mod)
if len(ans) == 0:
	print(fact[n - 1])
else:
	outy = 1
	less = x - 1
	more = n - x
	for s in range(len(ans)):
		if ans[s] == 'r':
			outy *= less
			less -= 1
		else:
			outy *= more
			more -= 1
		outy = outy % mod
	outy *= fact[less + more]
	outy = outy % mod
	print(outy)


(n, x, pos) = list(map(int, input().split()))
middle = n // 2
left = 0
right = n
larger = []
smaller = []

def fact(p, y=1):
	if p <= 1:
		return y
	else:
		return fact(p - 1, y * p)
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		if middle < pos:
			smaller.append(middle)
		left = middle + 1
	else:
		larger.append(middle)
		right = middle
l = len(larger)
s = len(smaller)
if n - x - l < 0 or x - 1 - s < 0:
	print(0)
else:
	res = 1
	lg = n - x
	for _ in range(l):
		res *= lg
		res %= 10 ** 9 + 7
		lg -= 1
	sm = x - 1
	for _ in range(s):
		res *= sm
		res %= 10 ** 9 + 7
		sm -= 1
	res *= fact(n - l - s - 1)
	res %= 10 ** 9 + 7
	print(int(res))


import math as m
(n, x, pos) = map(int, input().split())
ans = 1
small = x - 1
l = 0
r = n
mod = pow(10, 9) + 7
great = n - x
space = n - 1
while l < r:
	mid = (l + r) // 2
	if mid == pos:
		l = mid + 1
	elif mid > pos:
		ans *= great
		great -= 1
		space -= 1
		r = mid
	else:
		ans *= small
		small -= 1
		space -= 1
		l = mid + 1
if l > 0 and l - 1 == pos:
	ans = ans % mod * m.factorial(space) % mod % mod
else:
	ans = 0
print(ans)


mod = int(1000000000.0 + 7)
(n, x, pos) = map(int, input().split())

def bs(pos):
	l = 0
	r = n
	small = set()
	large = set()
	eq = 0
	while l < r:
		mid = l + r >> 1
		if mid <= pos:
			if mid != pos:
				small.add(mid)
			else:
				eq += 1
			l = mid + 1
		else:
			r = mid
			if mid < n:
				large.add(mid)
	if l != pos and l < n:
		large.add(l)
	return (eq, len(small), len(large))
(eq, small, large) = bs(pos)
lr = n - x
sm = n - lr - 1
fact = [1] * (n + 1)
for i in range(2, n + 1):
	fact[i] = fact[i - 1] * i % mod

def inv(x):
	return pow(x, mod - 2, mod)

def ncr(n, r):
	if n < r:
		return 0
	if n <= r or r == 0 or r == n:
		return 1
	return fact[n] % mod * inv(fact[r]) % mod * inv(fact[n - r]) % mod
print(fact[n - large - small - 1] % mod * ncr(n - lr - 1, small) % mod * fact[small] % mod * ncr(lr, large) % mod * fact[large] % mod)


(n, x, pos) = map(int, input().split())
(fact, inv, invf) = ([0] * (n + 5), [0] * (n + 5), [0] * (n + 5))
MOD = 10 ** 9 + 7

def mod(x):
	return (x % MOD + x) % MOD

def init(n):
	fact[0] = fact[1] = 1
	inv[0] = inv[1] = 1
	invf[0] = invf[1] = 1
	for i in range(2, n + 1):
		fact[i] = fact[i - 1] * i
		inv[i] = inv[MOD % i] * (MOD - MOD // i) % MOD
		invf[i] = inv[i] * invf[i - 1] % MOD

def P(n, r):
	return fact[n] * invf[n - r] % MOD

def bin_search(n, x, pos):
	less = 0
	more = 0
	left = 0
	right = n
	while right > left:
		middle = (left + right) // 2
		if middle <= pos:
			if middle < pos:
				less += 1
			left = middle + 1
		else:
			if middle > pos:
				more += 1
			right = middle
	return P(x - 1, less) * P(n - x, more) * fact[n - less - more - 1] % MOD
init(n)
print(bin_search(n, x, pos))


def binarysearch(pos, smaller, bigger):
	ans = 1
	left = 0
	right = smaller + bigger + 1
	while left < right:
		mid = (left + right) // 2
		if pos < mid:
			right = mid
			if mid != pos:
				ans *= bigger
				bigger -= 1
		else:
			left = mid + 1
			if left - 1 != pos:
				ans *= smaller
				smaller -= 1
	return (ans, bigger, smaller)
(n, x, pos) = [int(x) for x in input().split()]
(ans, bigger, smaller) = binarysearch(pos, x - 1, n - x)
n = bigger + smaller
for i in range(1, n + 1):
	ans *= i
	ans %= 10 ** 9 + 7
print(ans)


from sys import stdin, exit

def BS(A, x):
	left = 0
	right = len(A)
	mids = []
	smal = []
	while left < right:
		middle = (left + right) // 2
		mids.append(middle)
		if A[middle] <= x:
			left = middle + 1
			smal.append(1)
		else:
			right = middle
			smal.append(0)
	return (mids, smal)
MOD = 1000000000.0
MOD += 7
MOD = int(MOD)
(n, x, pos1) = map(int, stdin.readline().split())
A = [i for i in range(n)]
(idxs, smal) = BS(A, pos1)
pos = 1
less = x - 1
great = n - x
for (j, ix) in enumerate(idxs):
	if less < 0 or great < 0:
		break
	if ix != pos1:
		if smal[j]:
			pos = pos * less % MOD
			less -= 1
		else:
			pos = pos * great % MOD
			great -= 1
if less < 0 or great < 0:
	print(0)
	exit()
rest = less + great
while rest > 0:
	pos = pos * rest % MOD
	rest -= 1
print(pos)


def main():
	(n, x, pos) = map(int, input().split())
	(zero, one) = (0, 0)
	(l, r) = (0, n)
	while l < r:
		middle = (l + r) // 2
		if middle <= pos:
			zero += 1
			l = middle + 1
		else:
			one += 1
			r = middle
	res = 1
	mod = 10 ** 9 + 7
	for i in range(zero - 1):
		res *= x - 1 - i
		res %= mod
	for i in range(one):
		res *= n - x - i
		res %= mod
	for j in range(n - zero - one):
		res *= j + 1
		res %= mod
	print(res)
main()


import sys
import math

def fact(n, k):
	a = math.factorial(n) // math.factorial(n - k)
	return a

def fn(n, x, p):
	left = 0
	right = n
	mid = (left + right) / 2
	y = mid
	greaterx = 0
	lesserx = -1
	while left < right:
		mid = (left + right) // 2
		if mid <= p:
			left = mid + 1
			lesserx = lesserx + 1
		else:
			right = mid
			greaterx = greaterx + 1
	try:
		ans = fact(n - x, greaterx) * fact(x - 1, lesserx) * math.factorial(n - 1 - greaterx - lesserx)
		return ans % (10 ** 9 + 7)
	except:
		return 0
input = sys.stdin.read()
data = list(map(int, input.split()))
n = data[0]
x = data[1]
p = data[2]
print(fn(n, x, p))


import math
[n, x, pos] = list(map(int, input().split()))

def binarySearch(a, x):
	left = 0
	right = len(a)
	count = 0
	lcount = 0
	while left < right:
		middle = (left + right) // 2
		if a[middle] <= x:
			left = middle + 1
			if a[middle] < x:
				lcount += 1
		else:
			right = middle
			count += 1
	if left > 0 and a[left - 1] == x:
		return [True, count, lcount]
	else:
		return [False, count, lcount]

def binomial(n, k):
	return 1 if n <= 0 else int(math.factorial(n)) // int(math.factorial(n - k))
mod = 10 ** 9 + 7

def permutationCount(n, x, pos):
	[good, count, lcount] = binarySearch(range(1, n + 1), pos + 1)
	if n - x - count < 0 or x - 1 - lcount < 0:
		return 0
	return binomial(n - x, count) % mod * (binomial(x - 1, lcount) % mod) * int(math.factorial(n - count - lcount - 1) % mod)
print(permutationCount(n, x, pos) % mod)


from sys import stdin
from math import factorial as f
MOD = 1000000007

def bs(a, x):
	left = 0
	right = len(a)
	inds = []
	while left < right:
		mid = (left + right) // 2
		if a[mid] <= x:
			inds.append((mid, 'lower'))
			left = mid + 1
		else:
			inds.append((mid, 'higher'))
			right = mid
	return inds
(n, x, pos) = map(int, stdin.readline().split())
fake = [i for i in range(n)]
inds = bs(fake, pos)
higherNums = n - x
lowerNums = x - 1
final = 1
for (tmp, name) in inds:
	if tmp == pos:
		continue
	elif name == 'lower':
		final *= lowerNums
		lowerNums -= 1
	else:
		final *= higherNums
		higherNums -= 1
	final %= MOD
remain = higherNums + lowerNums
final *= f(remain) % MOD
print(final % MOD)


(n, x, p) = map(int, input().split())
mod = 1000000007
small = x - 1
large = n - x
arr = [-1 for x in range(n)]
(l, r) = (0, n)
while l < r:
	mid = (l + r) // 2
	if mid <= p:
		if mid == p:
			arr[mid] = 1
		else:
			arr[mid] = small
			small -= 1
			small = max([0, small])
		l = mid + 1
	elif mid > p:
		arr[mid] = large
		large -= 1
		large = max(0, large)
		r = mid
rem = small + large
ans = 1
for i in range(n):
	if arr[i] == -1:
		ans *= rem
		ans %= mod
		rem -= 1
	else:
		ans *= arr[i]
		ans %= mod
print(ans)


(N, x, pos) = map(int, input().split())
mod = 10 ** 9 + 7

def nPr(n, r):
	if n < r:
		return 0
	if n == 0 or r == 0:
		return 1
	fact = 1
	for i in range(n, n - r, -1):
		fact = fact * i % mod
	return fact
gt = 0
lt = 0
left = 0
right = N
s = set()
while left < right:
	mid = (right + left) // 2
	if mid < pos:
		if mid not in s:
			lt += 1
			s.add(mid)
		left = mid + 1
	elif mid == pos:
		left = mid + 1
	else:
		if mid not in s:
			gt += 1
			s.add(mid)
		right = mid
l = x - 1
g = N - x
m = N - 1 - lt - gt
ans = nPr(l, lt) * nPr(g, gt) % mod * nPr(m, m) % mod
print(ans)


from sys import stdin, stdout
from collections import *
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')
ma = 10 ** 3 + 1
fact = [0 for i in range(ma)]
invfact = [0 for i in range(ma)]
fact[0] = 1
for i in range(1, ma):
	fact[i] = i % mod * fact[i - 1] % mod % mod
invfact[ma - 1] = pow(fact[ma - 1], mod - 2, mod)
for i in range(ma - 2, -1, -1):
	invfact[i] = invfact[i + 1] % mod * (i + 1) % mod % mod

def ncr(n, r):
	if r > n or n < 0 or r < 0:
		return 0
	return fact[n] % mod * invfact[r] % mod % mod * (invfact[n - r] % mod) % mod % mod

def solve():
	(n, x, p) = mp()
	(l, r) = (0, n)
	(s, b) = (0, 0)
	while l < r:
		m = (l + r) // 2
		if m < p:
			s += 1
			l = m + 1
		elif m > p:
			b += 1
			r = m
		else:
			l = m + 1
	ans = 1
	ans = ans % mod * ncr(x - 1, s) % mod % mod
	ans = ans % mod * ncr(n - x, b) % mod % mod
	ans = ans % mod * fact[s] % mod % mod
	ans = ans % mod * fact[b] % mod % mod
	ans = ans % mod * fact[n - s - b - 1] % mod % mod
	pr(ans)
for _ in range(1):
	solve()


mod = 1000 * 1000 * 1000 + 7
fac = [1] * 10001
for i in range(2, 1001):
	fac[i] = fac[i - 1] * i

def comb(a, b):
	if a < b:
		return 0
	return fac[a] // fac[a - b]

def solve(n, x, pos):
	smaller = 0
	greater = 0
	l = 0
	r = n
	while l < r:
		mid = (l + r) // 2
		if mid < pos:
			smaller += 1
			l = mid + 1
		elif mid > pos:
			greater += 1
			r = mid
		else:
			l = mid + 1
	nsmaller = x - 1
	nbigger = n - x
	ans = 1
	ans = ans * comb(nsmaller, smaller) % mod * comb(nbigger, greater) % mod
	ans = ans * fac[n - smaller - greater - 1] % mod
	return ans
(n, x, pos) = map(int, input().split())
print(solve(n, x, pos))


import math
(n, x, pos) = map(int, input().split())
l = 0
r = n
gt = 0
lt = 0
while l < r:
	m = (l + r) // 2
	if m > pos:
		r = m
		gt += 1
	elif m < pos:
		l = m + 1
		lt += 1
	else:
		l = m + 1

def perm(nn, kk=None):
	rr = math.factorial(nn)
	if kk is not None:
		rr //= math.factorial(nn - kk)
	return rr
if lt > x - 1 or gt > n - x:
	res = 0
else:
	res = perm(x - 1, lt) * perm(n - x, gt) * perm(n - lt - gt - 1) % 1000000007
print(res)


def bi(a, x, p):
	u = x - 1
	v = len(a) - x
	l = 0
	r = len(a)
	while l < r:
		m = (l + r) // 2
		if m <= p:
			l = m + 1
		else:
			r = m
		if m < p:
			a[m] = u
			u -= 1
		if m > p:
			a[m] = v
			v -= 1
	if u < 0 or v < 0:
		return False
	return True
(n, x, p) = map(int, input().split())
a = [0] * n
a[p] = 1
s = bi(a, x, p)
if s:
	c = a.count(0)
	for i in range(n):
		if a[i] == 0:
			a[i] = c
			c -= 1
	z = 1
	for i in range(n):
		z = z * a[i] % 1000000007
	print(z)
else:
	print(0)


from sys import stdin
from math import perm
mod = 10 ** 9 + 7

def fact(num):
	f = 1
	for i in range(2, num + 1):
		f = f * i % mod
	return f
(n, x, pos) = map(int, input().split())
(high, low) = (n - x, x - 1)
(h, l, mid) = (n, 0, n)
while l < h:
	mid = (h + l) // 2
	if mid > pos:
		high -= 1
		h = mid
	elif mid < pos:
		low -= 1
		l = mid + 1
	else:
		l = mid + 1
ans = perm(n - x, n - x - high) * perm(x - 1, x - 1 - low) * fact(high + low)
print(ans % mod)


def bin_search(a, x):
	left = 0
	right = len(a)
	j = 0
	l = 0
	while left < right:
		j += 1
		middle = (left + right) // 2
		if a[middle] <= x:
			l += 1
			left = middle + 1
		else:
			right = middle
	if left > 0 and a[left - 1] == x:
		return (j, l)
(n, x, pos) = map(int, input().split())
mod = int(1000000000.0 + 7)
fact = [1]
k = 1
for i in range(1, n + 1):
	k *= i
	k = k % mod
	fact.append(k)
arr = []
for i in range(n):
	arr.append(i)
(j, l) = bin_search(arr, pos)
u = j - l
ans_u = 1
up = n - x
ans_l = 1
low = x - 1
l -= 1
while u > 0:
	ans_u *= up
	ans_u = ans_u % mod
	up -= 1
	u -= 1
while l > 0:
	ans_l *= low
	ans_l = ans_l % mod
	low -= 1
	l -= 1
ans = ans_u * ans_l * fact[n - j] % mod
print(ans)


import os
import sys
from io import BytesIO, IOBase
mod = int(1000000000.0 + 7)

def main():
	(n, k, p) = map(int, input().split(' '))
	low = 0
	high = n
	ans = [0 for x in range(n)]
	ans[p] = 100
	while low < high:
		mid = (low + high) // 2
		if p < mid:
			ans[mid] = 1
			high = mid
		else:
			ans[mid] = -1
			low = mid + 1
	ans[p] = 100
	chote = 0
	bade = 0
	for x in range(1, n + 1):
		if x > k:
			bade += 1
		if x < k:
			chote += 1
	realans = 1
	for x in range(n):
		if ans[x] == 1:
			realans = realans * bade % mod
			bade -= 1
		elif ans[x] == -1:
			realans = realans * chote % mod
			chote -= 1
	left = bade + chote
	for x in ans:
		if x == 0:
			realans = realans * left % mod
			left -= 1
	print(realans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


mod = 10 ** 9 + 7
from math import *
import threading
import sys

def npr(n, r):
	return factorial(n) // factorial(n - r) if n >= r else 0

def fact(x):
	prod = 1
	for i in range(1, x + 1):
		prod *= i
	return prod

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = -1
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = mid
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def graph(n, m):
	adj = dict()
	for i in range(1, n + 1):
		adj.setdefault(i, 0)
	for i in range(m):
		(a, b) = map(int, input().split())
		adj[a] += 1
		adj[b] += 1
	return adj

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	li = []
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, len(prime)):
		if prime[p]:
			li.append(p)
	return li
sys.setrecursionlimit(300000)
primes = SieveOfEratosthenes(1300000)

def fn(n):
	i = 2
	res = n - 1
	val = 0
	for i in range(int(sqrt(n)) + 1, 1, -1):
		val = i - 1 + int(ceil((n - i) / i))
		if val <= res:
			res = val
		else:
			break
	return res

def solve(a, b, c):
	dis = b ** 2 - 4 * a * c
	ans1 = (-b - sqrt(dis)) / (2 * a)
	print(int(ans1))
	return
for _ in range(1):
	(n, x, pos) = map(int, input().split())
	a = [i for i in range(1, n + 1)]
	(l, r) = (0, n)
	ans = 0
	(less, more) = (0, 0)
	while l < r:
		mid = (l + r) // 2
		if mid == pos:
			l = mid + 1
		elif mid < pos:
			less += 1
			l = mid + 1
		else:
			more += 1
			r = mid
	ans += npr(n - x, more) * npr(x - 1, less)
	ans *= factorial(n - less - more - 1)
	print(ans % mod)


from collections import Counter
import string
import math
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))

def printDivisors(n):
	divisors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				divisors.append(i)
			else:
				divisors.extend((i, n // i))
		i = i + 1
	return divisors

def countTotalBits(num):
	binary = bin(num)[2:]
	return len(binary)

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
fact = [1] * 1001
c = 1
mod = 10 ** 9 + 7
for i in range(1, 1001):
	fact[i] = fact[i - 1] * i % mod

def ncr(n, r):
	if n < r:
		return 0
	numer = fact[n]
	denm = fact[n - r] * fact[r]
	return numer * pow(denm, mod - 2, mod)
if 1:
	(n, x, pos) = vary(3)
	left = 0
	right = n
	sc = bc = 0
	while left < right:
		middle = (right + left) // 2
		if middle == pos:
			left = middle + 1
		elif middle < pos:
			sc += 1
			left = middle + 1
		else:
			right = middle
			bc += 1
	ans = 1
	ans = ans * ncr(n - x, bc) % mod
	ans = ans * ncr(x - 1, sc) % mod
	ans = ans * fact[n - (sc + bc + 1)] % mod
	ans = ans * fact[sc] % mod
	ans = ans * fact[bc] % mod
	print(ans)


import sys
from math import *
m = 10 ** 9 + 7

def f(n):
	ans = 1
	for i in range(1, n + 1):
		ans = ans * i % m
	return ans
(n, x, pos) = map(int, input().split())
left = 0
right = n
l = x - 1
g = n - x
ans = 1
while left < right:
	mid = (left + right) // 2
	if mid < pos:
		ans *= l
		l -= 1
		left = mid + 1
	elif mid > pos:
		ans *= g
		g -= 1
		right = mid
	else:
		left = mid + 1
if l < 0 or g < 0:
	print(0)
else:
	print(ans * f(l + g) % m)


MOD = int(1000000000.0 + 7)
from math import factorial

def comb(n, k):
	if k <= n:
		return factorial(n) // (factorial(k) * factorial(n - k))
	else:
		return 0

def perm(n, k):
	if k <= n:
		return factorial(n) // factorial(n - k)
	else:
		return 0
for case in range(1):
	(n, x, pos) = map(int, input().split())
	lo = 0
	hi = n
	lt_count = 0
	gt_count = 0
	while lo < hi:
		mid = (lo + hi) // 2
		if mid <= pos:
			if mid < pos:
				lt_count += 1
			lo = mid + 1
		else:
			gt_count += 1
			hi = mid
	gt_size = n - x
	lt_size = x - 1
	ans = 1
	ans *= perm(gt_size, gt_count)
	ans %= MOD
	ans *= perm(lt_size, lt_count)
	ans %= MOD
	ans *= factorial(gt_size - gt_count + lt_size - lt_count)
	ans %= MOD
	print(ans)


(n, x, pos) = [int(x) for x in input().split()]

def fact(n):
	if n == 0:
		return 1
	br = 1
	for i in range(1, n + 1):
		br *= i
	return br
res = 0
left = 0
right = n
countbigger = 0
countsmaller = 0
while left < right:
	middle = (left + right) // 2
	if middle == pos:
		left = middle + 1
	elif middle < pos:
		left = middle + 1
		countsmaller += 1
	elif middle > pos:
		right = middle
		countbigger += 1
biggerkol = n - x
smallerkol = x - 1
if smallerkol < countsmaller or biggerkol < countbigger:
	print(0)
	exit()
smes = 0
smes = fact(biggerkol) // fact(biggerkol - countbigger)
smes2 = fact(smallerkol) // fact(smallerkol - countsmaller)
smes2 = round(smes2)
smes *= smes2
kolkol = n - countsmaller - countbigger - 1
kol = fact(kolkol)
res = smes * kol % (10 ** 9 + 7)
print()
print(res)
print()


import itertools
import math
import sys
import os
from collections import defaultdict

def is_debug():
	return 'PYPY3_HOME' not in os.environ

def stdin_wrapper():
	data = '123 42 24\n\n'
	for line in data.split('\n'):
		yield line
if not is_debug():

	def stdin_wrapper():
		while True:
			yield sys.stdin.readline()
inputs = stdin_wrapper()

def input_wrapper():
	return next(inputs)

def get_str():
	if is_debug():
		return input_wrapper()
	return input()

def get(_type):
	if _type == str:
		return get_str()
	return _type(input_wrapper())

def get_arr(_type):
	return [_type(x) for x in input_wrapper().split()]

def tuplerize(method):

	def wrap(*args, **kwargs):
		res = method(*args, **kwargs)
		if not isinstance(res, (tuple, list)):
			res = (res,)
		return res
	return wrap

@tuplerize
def solve(n, x, pos):

	def binary_analyzer(n, pos):
		rights = 0
		lefts = 0
		a = list(range(n))
		x = a[pos]
		l = 0
		r = len(a)
		while l < r:
			m = (l + r) // 2
			if a[m] <= x:
				l = m + 1
				if a[m] != x:
					lefts += 1
			else:
				if a[m] != x:
					rights += 1
				r = m
		return (rights, lefts)
	(rights, lefts) = binary_analyzer(n, pos)
	(actual_rights, actual_lefts) = (0, 0)
	for d in range(n):
		t = d + 1
		if t == x:
			continue
		if t > x:
			actual_rights += 1
		else:
			actual_lefts += 1
	if actual_rights < rights or actual_lefts < lefts:
		return 0
	MOD = 10 ** 9 + 7

	def replacements(n, k):
		return math.factorial(n) // math.factorial(n - k)
	return replacements(actual_rights, rights) * replacements(actual_lefts, lefts) * math.factorial(n - rights - lefts - 1) % MOD
print(*solve(*get_arr(int)))


import sys
input = sys.stdin.readline
mod = 1000000007

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)

def binsimul(x, n):
	give = {}
	a = [i for i in range(n)]
	left = 0
	right = n
	while left < right:
		middle = (left + right) // 2
		if a[middle] <= x:
			give[middle] = 'LE'
			left = middle + 1
		else:
			give[middle] = 'G'
			right = middle
	return give

def main():
	(n, x, pos) = map(int, input().split())
	d = {}
	d = binsimul(pos, n)
	great = n - x
	less = x - 1
	ans = 1
	for i in d:
		if d[i] == 'G':
			ans *= great % mod
			great -= 1
		elif i != pos:
			ans *= less % mod
			less -= 1
		n -= 1
	for i in range(1, n + 1):
		ans *= i % mod
	ans %= mod
	print(ans)
	return
main()


def fast_factorial(mod=None):
	res = [1, 1]
	size = 2

	def ff(k):
		nonlocal size
		while k >= size:
			res.append(res[-1] * size)
			size += 1
		return res[k]

	def ff_mod(k):
		nonlocal size
		while k >= size:
			res.append(res[-1] * (size % mod) % mod)
			size += 1
		return res[k]
	if mod == None:
		return ff
	else:
		return ff_mod
MOD = 10 ** 9 + 7
ff = fast_factorial(mod=MOD)
(n, x, pos) = map(int, input().split())
lower = x - 1
higher = n - x

def solve(n, lower, higher, pos):
	res = 1
	(left, right) = (0, n)
	while left < right:
		mid = (left + right) // 2
		if mid == pos:
			left = mid + 1
		elif mid < pos:
			left = mid + 1
			res *= lower
			res %= MOD
			lower -= 1
		else:
			right = mid
			res *= higher
			res %= MOD
			higher -= 1
	if left > 0 and left - 1 == pos and (res >= 1) and (higher >= 0) and (lower >= 0):
		return res * ff(lower + higher) % MOD
	else:
		return 0
print(solve(n, lower, higher, pos))


import sys
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right
import math

def fun(a):
	s = 1
	i = 1
	while i <= a:
		s = s * i % m
		i += 1
	return s
(n, x, d) = map(int, input().split())
(p, q) = (n - x, x - 1)
(l, r) = (0, n)
c = 1
m = pow(10, 9) + 7
f = 0
while l < r:
	t = (l + r) // 2
	if t == d:
		l = t + 1
		f = 1
	if t > d:
		c = p * c % m
		p -= 1
		r = t
	elif t < d:
		c = c * q % m
		q -= 1
		l = t + 1
if f:
	c = c * fun(p + q) % m
	print(c)
else:
	print(0)


import io
import os
import sys
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def printd(*args, **kwargs):
	pass

def get_str():
	return input().decode().strip()

def rint():
	return map(int, input().split())

def oint():
	return int(input())
div = 10 ** 9 + 7

def get_p(n, r):
	ret = 1
	for i in range(r):
		ret *= n - i
		ret %= div
	printd('n r ret', n, r, ret)
	return ret
(n, x, pos) = rint()
left = 0
right = n
bc = 0
lc = 0
while left < right:
	mid = (left + right) // 2
	printd('mid', mid)
	if mid == pos:
		left = mid + 1
	elif mid < pos:
		lc += 1
		left = mid + 1
	else:
		bc += 1
		right = mid
	printd('l r', left, right)
big = n - x
lit = x - 1
rem = n - bc - lc - 1
printd(big, lit, rem)
printd(bc, lc)
ans = get_p(big, bc) * get_p(lit, lc) * get_p(rem, rem)
print(ans % div)


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

def MI():
	return map(int, sys.stdin.buffer.readline().split())

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()

def nCr(com_n, com_r):
	if com_n < com_r:
		return 0
	return fac[com_n] * ifac[com_r] % md * ifac[com_n - com_r] % md

def nPr(com_n, com_r):
	if com_n < com_r:
		return 0
	return fac[com_n] * ifac[com_n - com_r] % md
md = 10 ** 9 + 7
n_max = 1005
fac = [1]
for i in range(1, n_max + 1):
	fac.append(fac[-1] * i % md)
ifac = [1] * (n_max + 1)
ifac[n_max] = pow(fac[n_max], md - 2, md)
for i in range(n_max - 1, 1, -1):
	ifac[i] = ifac[i + 1] * (i + 1) % md
(n, x, p) = MI()
cl = cr = 0
(l, r) = (0, n)
while l < r:
	m = (l + r) // 2
	if m > p:
		r = m
		cr += 1
	else:
		l = m + 1
		if m != p:
			cl += 1
(s, b) = (x - 1, n - x)
ans = nPr(s, cl) * nPr(b, cr) % md * nPr(n - cl - cr - 1, n - cl - cr - 1) % md
print(ans)


MOD = 10 ** 9 + 7

def mul_range_mod(x_range):
	if MOD in x_range:
		return 0
	result = 1 % MOD
	for x in x_range:
		result *= x
		result %= MOD
	return result

def read_ints():
	return map(int, input().split())
(n, x, pos) = read_ints()
lower_x_n = x - 1
higher_x_n = n - x
conditions = [-1] * n
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	left_if_update = middle + 1
	if left_if_update - 1 <= pos:
		conditions[middle] = 0
		left = left_if_update
	else:
		conditions[middle] = 1
		right = middle
free_n = conditions.count(-1)
le_need = conditions.count(0)
higher_need = conditions.count(1)
lower_need = le_need - 1
if lower_x_n < lower_need or higher_x_n < higher_need:
	result = 0
else:
	result = mul_range_mod(range(lower_x_n + 1 - lower_need, lower_x_n + 1)) * mul_range_mod(range(higher_x_n + 1 - higher_need, higher_x_n + 1)) * mul_range_mod(range(1, free_n + 1)) % MOD
print(result)


(a, e, x) = map(int, input().split())
big = a - e
small = e - 1
l = 0
r = a
c = a - 1
ans = 1
while l < r:
	m = (l + r) // 2
	if m < x:
		c -= 1
		l = m + 1
		ans *= small % (10 ** 9 + 7)
		small -= 1
	elif m == x:
		ans = ans
		l = m + 1
	else:
		c -= 1
		ans *= big % (10 ** 9 + 7)
		big -= 1
		r = m
f = 1
for i in range(1, c + 1):
	f *= i % (10 ** 9 + 7)
print(ans * f % (10 ** 9 + 7))


import os
import sys
from io import BytesIO, IOBase
_str = str
BUFSIZE = 8192

def str(x=b''):
	return x if type(x) is bytes else _str(x).encode()

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def inp():
	return sys.stdin.readline().rstrip()

def mpint():
	return map(int, sys.stdin.readline().split(' '))

def itg():
	return int(sys.stdin.readline())
MOD = 10 ** 9 + 7
MAX_N = 2 * 10 ** 5
MAX_N = min(MAX_N, MOD - 1)
(fac, i_fac) = ([0] * (MAX_N + 1), [0] * (MAX_N + 1))
fac[0] = 1
for i in range(MAX_N):
	fac[i + 1] = fac[i] * (i + 1) % MOD
i_fac[-1] = pow(fac[-1], MOD - 2, MOD)
for i in reversed(range(MAX_N)):
	i_fac[i] = i_fac[i + 1] * (i + 1) % MOD
A000142 = fac.__getitem__

def ncr(n, r):
	return 0 if n < r else fac[n] * i_fac[r] % MOD * i_fac[n - r] % MOD

def npr(n, r):
	return 0 if n < r else fac[n] * i_fac[n - r] % MOD

def main():
	(n, x, pos) = mpint()
	(lo, hi) = (0, n)
	lower = higher = 0
	while lo < hi:
		mid = (lo + hi) // 2
		if mid > pos:
			hi = mid
			higher += 1
		else:
			lo = mid + 1
			if mid != pos:
				lower += 1
	lower_than_pos = x - 1
	higher_than_pos = n - x
	other = n - 1 - lower - higher
	p1 = npr(lower_than_pos, lower)
	p2 = npr(higher_than_pos, higher)
	p3 = A000142(other)
	return p1 * p2 * p3 % MOD
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
print(main())


import sys
import math
from bisect import bisect_right as br
from statistics import mode
from itertools import combinations as cb

def int_arr():
	return list(map(int, sys.stdin.readline().strip().split()))

def str_arr():
	return list(map(str, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
(n, x, pos) = int_arr()
i = 0
j = n
ans = 1
l = x - 1
r = n - x
mod = 10 ** 9 + 7
while i < j:
	mid = (i + j) // 2
	if mid < pos:
		i = mid + 1
		ans = ans * l % mod
		l -= 1
	elif mid > pos:
		j = mid
		ans = ans * r % mod
		r -= 1
	else:
		i = mid + 1
rem = l + r
for i in range(1, rem + 1):
	ans = ans * i % mod
print(ans)


M = 10 ** 9 + 7

def mpow(x, y):
	r = 1
	while y > 0:
		if y & 1:
			r = r * x % M
		x = x * x % M
		y = y // 2
	return r

def nCr(a, b):
	if b > a or a < 0 or b < 0:
		return 0
	return fact[a] * mpow(fact[b], M - 2) % M * mpow(fact[a - b], M - 2) % M
(n, x, pos) = list(map(int, input().split()))
fact = [1 for i in range(n + 1)]
for i in range(1, n + 1):
	fact[i] = fact[i - 1] * i % M
lo = 0
hi = n
less = 0
high = 0
while lo < hi:
	mi = (lo + hi) // 2
	if mi <= pos:
		less = less + 1
		lo = mi + 1
	else:
		high = high + 1
		hi = mi
ans = nCr(x - 1, less - 1) * fact[less - 1] % M
ans = ans * nCr(n - x, high) % M
ans = ans * fact[high] % M
ans = ans * fact[n - less - high] % M
print(ans)


(n, x, pos) = map(int, input().split())
low = 0
high = n
big = n - x
small = x - 1
cntbig = 0
cntsmall = 0
ans = 1
mod = 10 ** 9 + 7
while low < high:
	mid = (low + high) // 2
	if mid < pos:
		ans *= small - cntsmall
		ans %= mod
		cntsmall += 1
		low = mid + 1
	elif mid > pos:
		ans *= big - cntbig
		ans %= mod
		cntbig += 1
		high = mid
	else:
		low = mid + 1
leftnum = n - cntsmall - cntbig - 1
for i in range(1, leftnum + 1):
	ans *= i
	ans %= mod
print(ans)


(n, x, pos) = map(int, input().split())
Max_m = x - 1
Max_b = n - x
kol_m = 0
kol_b = 0
l = 0
r = n
while l < r:
	m = (l + r) // 2
	if m <= pos:
		l = m + 1
		if pos == m:
			continue
		if m < pos:
			kol_m += 1
		if m > pos:
			kol_b += 1
	else:
		r = m
		if m < pos:
			kol_m += 1
		if m > pos:
			kol_b += 1
if kol_m > Max_m or kol_b > Max_b:
	print(0)
else:
	answer = 1
	kol = n - 1
	for i in range(Max_b, Max_b - kol_b, -1):
		answer *= i
	kol -= kol_b
	for i in range(Max_m, Max_m - kol_m, -1):
		answer *= i
	kol -= kol_m
	for i in range(kol, 1, -1):
		answer *= i
	print(answer % 1000000007)


import sys
import math
from collections import defaultdict, Counter
mod = pow(10, 9) + 7
(n, x, pos) = map(int, input().split())
low = 0
high = n
l = 0
h = 0
while low < high:
	mid = (low + high) // 2
	if mid == pos:
		low = mid + 1
		while low < high:
			mid = (low + high) // 2
			h += 1
			high = mid
		break
	if mid < pos:
		l += 1
		low = mid + 1
	else:
		h += 1
		high = mid
if l > x - 1 or h > n - x:
	print(0)
else:
	ans = 1
	for i in range(x - 1, x - 1 - l, -1):
		ans = ans * i % mod
	for i in range(n - x, n - x - h, -1):
		ans = ans * i % mod
	for i in range(n - (l + h) - 1, 0, -1):
		ans = ans * i % mod
	print(ans)


import sys, math
mod = 10 ** 9 + 7

def binomialCoeff(n, k):
	C = [0 for i in range(k + 1)]
	C[0] = 1
	for i in range(1, n + 1):
		j = min(i, k)
		while j > 0:
			C[j] = (C[j] + C[j - 1]) % mod
			j -= 1
	return C[k]

def fact(n):
	if n == 1 or n == 0:
		return 1
	else:
		return n * fact(n - 1) % mod
(n, x, pos) = list(map(int, sys.stdin.readline().strip().split()))
(l_cnt, r_cnt) = (0, 0)
(l, r) = (0, n)
while l < r:
	m = (l + r) // 2
	if m <= pos:
		l_cnt += 1
		l = m + 1
	else:
		r_cnt += 1
		r = m
l_cnt -= 1
l_cmb = binomialCoeff(x - 1, l_cnt) * fact(l_cnt)
r_cmb = binomialCoeff(n - x, r_cnt) * fact(r_cnt)
cmb = fact(n - l_cnt - r_cnt - 1) * l_cmb % mod * r_cmb % mod
print(cmb)


import sys
input = sys.stdin.buffer.readline
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rs = lambda : input().decode().rstrip('\n\r')
wrt = sys.stdout.write
pr = lambda *args, end='\n': wrt(' '.join([str(x) for x in args]) + end)
enum = enumerate
inf = float('inf')
cdiv = lambda x, y: -(-x // y)
mod = 10 ** 9 + 7
f = [1]
for i in range(1, 10005):
	f.append(f[-1] * i % mod)
Cases = 1
for Case in range(Cases):
	(n, x, pos) = rl()
	a = [0 for i in range(n)]
	a[pos] = x
	cp = x + 1
	for i in range(pos + 1, n):
		a[i] = cp
		cp += 1
	cp = x - 1
	for i in reversed(range(0, pos)):
		a[i] = cp
		cp -= 1
	(l, r) = (0, n)
	depth = 0
	mids = []
	poss = True
	while l < r:
		depth += 1
		m = (l + r) // 2
		mids.append(m)
		if a[m] <= x:
			l = m + 1
		else:
			r = m
	if l > 0 and a[l - 1] == x:
		poss = True
	else:
		poss = False
	ans = 1
	(a, b) = (1, 1)
	big = n - x
	small = x - 1
	for i in mids:
		if i == pos:
			continue
		elif i > pos:
			ans *= big
			big -= 1
			ans %= mod
		else:
			ans *= small
			small -= 1
			ans %= mod
	if poss:
		pr(ans * f[n - len(mids)] % mod)
	else:
		pr(0)


import sys
from math import factorial, comb
input = sys.stdin.readline
mod = 10 ** 9 + 7
(n, x, pos) = map(int, input().split())
left = 0
right = n
a = 0
b = 0
while left < right:
	middle = left + (right - left) // 2
	if pos == middle:
		left = middle + 1
	elif pos < middle:
		b += 1
		right = middle
	else:
		a += 1
		left = middle + 1
rem = factorial(n - 1 - a - b) % mod
a = comb(x - 1, a) % mod * factorial(a)
b = comb(n - x, b) % mod * factorial(b)
print(a * b % mod * rem % mod)


(n, x, pos) = list(map(int, input().split()))
lo = 0
hi = n
greater = n - x
smaller = x - 1
ans = 1
mod = 10 ** 9 + 7
while lo < hi:
	mid = (lo + hi) // 2
	if mid < pos:
		ans = ans * smaller % mod
		smaller -= 1
		lo = mid + 1
	elif mid == pos:
		lo = mid + 1
	else:
		ans = ans * greater % mod
		greater -= 1
		hi = mid
left = smaller + greater
for i in range(1, left + 1):
	ans = ans * i % mod
print(ans)


import math

def bins(a, x, pos):
	posl = []
	(left, right) = (0, len(a))
	while left < right:
		middle = math.floor((left + right) / 2)
		if a[middle] <= x:
			left = middle + 1
			if middle != pos:
				posl.append('l')
		else:
			right = middle
			if middle != pos:
				posl.append('r')
	return posl
(n, x, pos) = list(map(int, input().split()))
a = [0] * pos
a.append(x)
a.extend([x + 1] * (n - pos - 1))
b = bins(a, x, pos)
(r, l) = (b.count('r'), b.count('l'))
rcount = n - x
lcount = x - 1
count = n - 1
res = 1
for i in range(r):
	res *= rcount
	rcount -= 1
	count -= 1
for i in range(l):
	res *= lcount
	lcount -= 1
	count -= 1
for i in range(1, count + 1):
	res *= i % 1000000007
print(res % 1000000007)


(n, x, pos) = map(int, input().split())
mod = 10 ** 9 + 7
left = 0
right = n
moves = []
middles = []
middle = (left + right) // 2
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		left = middle + 1
		moves.append(1)
	else:
		right = middle
		moves.append(-1)
	middles.append(middle)
negcount = 0
poscount = 0
for i in range(len(moves)):
	if moves[i] == -1:
		negcount += 1
	else:
		poscount += 1
morethan = n - x
lessthan = x - 1
ans = 1
for i in range(negcount):
	ans *= morethan
	ans %= mod
	morethan -= 1
for i in range(poscount - 1):
	ans *= lessthan
	ans %= mod
	lessthan -= 1
for i in range(1, n - len(moves) + 1):
	ans *= i
	ans %= mod
print(ans)


from collections import *
from itertools import *
from bisect import *
from math import comb, perm, factorial

def inp():
	return int(input())

def arrinp():
	return [int(x) for x in input().split()]
M = int(10 ** 9 + 7)

def checks(n, pos):
	x = pos + 1
	A = [i + 1 for i in range(n)]
	(left, right) = (0, len(A))
	(sm_c, bi_c) = (0, 0)
	while left < right:
		middle = (left + right) // 2
		if A[middle] < x:
			left = middle + 1
			sm_c += 1
		elif A[middle] == x:
			left = middle + 1
		else:
			right = middle
			bi_c += 1
	return (sm_c, bi_c)

def main():
	(n, x, pos) = arrinp()
	(sm_c, bi_c) = checks(n, pos)
	lower = x - 1
	upper = n - x
	x = perm(lower, sm_c)
	x *= perm(upper, bi_c)
	x *= factorial(n - (sm_c + bi_c + 1))
	print(x % (10 ** 9 + 7))
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def prod(a, mod=10 ** 9 + 7):
	ans = 1
	for each in a:
		ans = ans * each % mod
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if not True else 1):
	(n, x, pos) = map(int, input().split())
	left = 0
	right = n
	(low, high) = (0, 0)
	possible = False
	while left < right:
		middle = (left + right) // 2
		if middle < pos:
			low += 1
			left = middle + 1
		elif middle > pos:
			high += 1
			right = middle
		else:
			left = middle + 1
	if left - 1 == pos:
		possible = True
	if not possible:
		print(0)
		quit()
	from math import factorial

	def nPr(n, r):
		return factorial(n) // factorial(n - r) if n >= r else 0
	print(nPr(n - x, high) * nPr(x - 1, low) * factorial(n - 1 - high - low) % (10 ** 9 + 7))


from math import factorial

def P(n, k):
	if k <= n:
		return factorial(n) // factorial(n - k)
	else:
		return 0
(n, x, pos) = map(int, input().split())
MOD = 10 ** 9 + 7
l = 0
u = n
cnt_less = 0
cnt_big = 0
while l < u:
	mid = (l + u) // 2
	if mid <= pos:
		if mid < pos:
			cnt_less += 1
		l = mid + 1
	else:
		cnt_big += 1
		u = mid
hasBig = n - x
hasLess = x - 1
ans = 1
ans *= P(hasBig, cnt_big)
ans %= MOD
ans *= P(hasLess, cnt_less)
ans %= MOD
ans *= factorial(hasBig - cnt_big + hasLess - cnt_less)
print(ans % MOD)


def binary_search(start, number, find):
	while start < number:
		mid = (start + number) // 2
		if mid <= find:
			start = mid + 1
		else:
			number = mid
		check.append(mid)
m = 1000000007

def factorial(number):
	ans = 1
	for i in range(2, number + 1):
		ans = ans % m * (i % m) % m
	return ans % m
check = []
(n, num, pos) = map(int, input().split())
binary_search(0, n, pos)
tot = 1
high = n - num
low = num - 1
if check[-1] == pos:
	for i in check:
		if i == pos:
			tot = tot % m * factorial(n - 1) % m
		elif i > pos:
			tot = tot % m * (high % m) % m
			high -= 1
			n -= 1
		else:
			tot = tot % m * (low % m) % m
			low -= 1
			n -= 1
		if tot == 0:
			break
	print(tot)
elif n == 1:
	print(1)
else:
	if len(check) > 2:
		for i in check:
			if i > pos and i != pos + 1:
				tot = tot % m * (high % m) % m
				high -= 1
				n -= 1
			elif i < pos:
				tot = tot % m * (low % m) % m
				low -= 1
				n -= 1
		tot = tot % m * (high % m) * factorial(n - 2) % m
	else:
		tot = tot % m * (high % m) * factorial(n - 2) % m
	print(tot)


import io
import os
from collections import Counter, defaultdict, deque
MAX_N = 2000
MOD = 10 ** 9 + 7

def modInverse(a, p):
	return pow(a, p - 2, p)
fact = [1]
for i in range(1, MAX_N + 1):
	fact.append(fact[-1] * i % MOD)
invFact = [0] * (MAX_N + 1)
invFact[MAX_N] = modInverse(fact[MAX_N], MOD)
for i in range(MAX_N - 1, -1, -1):
	invFact[i] = invFact[i + 1] * (i + 1) % MOD
inv = [0] * (MAX_N + 1)
for i in range(1, MAX_N + 1):
	inv[i] = fact[i - 1] * invFact[i] % MOD

def nCr(n, r):
	if n < r:
		return 0
	return fact[n] * invFact[r] * invFact[n - r] % MOD

def check(a, x):
	left = 0
	right = N
	while left < right:
		middle = (left + right) // 2
		if a[middle] <= x:
			left = middle + 1
		else:
			right = middle
	if left > 0 and a[left - 1] == x:
		return True
	return False

def solve(N, X, P):
	indices = []
	left = 0
	right = N
	while left < right:
		middle = (left + right) // 2
		if middle <= P:
			indices.append((middle, 1))
			left = middle + 1
		else:
			indices.append((middle, -1))
			right = middle
	pos = 0
	neg = 0
	for (i, sign) in indices:
		if i == P:
			continue
		if sign < 0:
			pos += 1
		else:
			neg += 1
	assert left > 0 and left - 1 == P
	posCand = N - X
	negCand = X - 1
	return nCr(posCand, pos) * fact[pos] * nCr(negCand, neg) * fact[neg] * fact[N - pos - neg - 1] % MOD
DEBUG = False
if DEBUG:
	from itertools import permutations
	import random
	random.seed(0)
	for _ in range(300):
		N = random.randint(1, 5)
		X = random.randint(1, N)
		P = random.randint(0, N - 1)
		ans = solve(N, X, P)
		expected = 0
		for perm in permutations(list(range(1, N + 1))):
			if perm[P] == X and check(perm, X):
				expected += 1
		if expected != ans:
			print('bad', expected, ans)
			print(N, X, P)
			exit()
		else:
			print('good')
	exit()
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(N, X, P) = [int(x) for x in input().split()]
ans = solve(N, X, P)
print(ans)


import sys
sys.setrecursionlimit(10 ** 5 + 5)
from collections import defaultdict as dft

def ml():
	return list(map(int, input().split()))

def mp():
	return map(int, input().split())
mxn = 10 ** 9 + 7

def solve():
	(n, x, pos) = mp()
	pos = pos + 1
	left = 0
	right = n
	pro = 1
	chote = x - 1
	bde = n - x
	count = 0
	while left < right:
		count += 1
		m = (left + right) // 2
		if m + 1 <= pos:
			left = m + 1
			if left == pos:
				pro = pro * 1 % mxn
			else:
				pro = pro * chote % mxn
				chote -= 1
		else:
			pro = pro * bde % mxn
			bde -= 1
			right = m
	temp = 1
	while count < n:
		pro = pro * temp % mxn
		temp += 1
		count += 1
	print(pro)
t = 1
for _ in range(t):
	solve()


def factorial(n, p):
	if n >= p:
		return 0
	result = 1
	for i in range(1, n + 1):
		result = result * i % p
	return result
p = 10 ** 9 + 7
(n, m, pos) = map(int, input().split())
lesser = m - 1
greater = n - m
l = 0
h = n
ans = 1
while l < h:
	m = (l + h) // 2
	if pos < m:
		ans = ans * greater
		ans = ans % p
		greater += -1
		h = m
	elif pos > m:
		ans = ans * lesser
		ans = ans % p
		lesser += -1
		l = m + 1
	else:
		l = m + 1
ans = ans * factorial(lesser + greater, p)
ans = ans % p
print(ans % p)


import math
(n, x, p) = map(int, input().split())
left = 0
right = n
more = n - x
less = n - more - 1
answer = 1
while left < right:
	mid = (left + right) // 2
	if mid < p:
		answer *= less
		less -= 1
		left = mid + 1
	elif mid > p:
		answer *= more
		more -= 1
		right = mid
	else:
		left = mid + 1
answer *= math.factorial(more + less)
print(answer % 1000000007)


from math import factorial

def fun(pos, x, n):
	gs = 0
	ls = 0
	left = 0
	right = n
	while left < right:
		middle = (left + right) // 2
		if middle <= pos:
			left = middle + 1
			ls += 1 if middle != pos else 0
		else:
			right = middle
			gs += 1
	total = n - 1
	greater = n - x
	lesser = total - greater
	ans = 1
	for _ in range(gs):
		ans *= greater
		greater -= 1
		total -= 1
	for _ in range(ls):
		ans *= lesser
		lesser -= 1
		total -= 1
	ans *= factorial(total)
	print(ans % 1000000007)
inp = input().split()
n = int(inp[0])
x = int(inp[1])
pos = int(inp[2])
fun(pos, x, n)


factorial = [1, 1, 2]
for i in range(3, 1001):
	factorial.append(i * factorial[-1])

def comb(n, r):
	c = factorial[n] // factorial[n - r]
	return int(c)
(n, x, pos) = map(int, input().split())
left = 0
right = n
smaller = 0
equal = 0
larger = 0
while left != right:
	mid = (left + right) // 2
	if pos < mid:
		larger += 1
		right = mid
	elif pos > mid:
		smaller += 1
		left = mid + 1
	elif pos == mid:
		equal += 1
		left = mid + 1
if larger > n - x:
	print(0)
elif smaller > x - 1:
	print(0)
else:
	s = comb(x - 1, smaller)
	l = comb(n - x, larger) % 1000000007
	fact = factorial[n - smaller - larger - 1] % 1000000007
	num = s * l * fact
	num %= 1000000007
	print(int(num))


mod = 10 ** 9 + 7
(n, x, pos) = map(int, input().split())
l = 0
r = n
lcheck = 0
ucheck = 0
while l < r:
	mid = (l + r) // 2
	if mid <= pos:
		l = mid + 1
		if mid != pos:
			lcheck += 1
	else:
		r = mid
		ucheck += 1
ll = x - 1
rr = n - x
ans = 1
for i in range(lcheck):
	ans *= ll
	ll -= 1
for i in range(ucheck):
	ans *= rr
	rr -= 1
left = n - (lcheck + ucheck) - 1
lt = left
for i in range(lt):
	ans *= left
	left -= 1
print(ans % mod)


def modFact(n, p):
	if n >= p:
		return 0
	result = 1
	for i in range(1, n + 1):
		result = result * i % p
	return result

def nCrModp(n, r, p):
	if r > n - r:
		r = n - r
	C = [0 for i in range(r + 1)]
	C[0] = 1
	for i in range(1, n + 1):
		for j in range(min(i, r), 0, -1):
			C[j] = (C[j] + C[j - 1]) % p
	return C[r]
(n, x, pos) = map(int, input().split())
visited = [-1] * n
l = 0
r = n
while l < r:
	m = (l + r) // 2
	if m > pos:
		visited[m] = 1
		r = m
	else:
		visited[m] = 0
		l = m + 1
visited[pos] = 555
greater = visited.count(1)
smaller = visited.count(0)
random = visited.count(-1)
modulo = 10 ** 9 + 7
if greater > n - x or x - 1 < smaller or n - 1 - (greater + smaller) < 0:
	print(0)
else:
	print(nCrModp(n - x, greater, modulo) * nCrModp(x - 1, smaller, modulo) * modFact(greater, modulo) * modFact(smaller, modulo) * modFact(n - 1 - (greater + smaller), modulo) % modulo)


(n, x, pos) = map(int, input().split())
permutations = [0] * n
modulo = 10 ** 9 + 7

def binary_search(copy_of_the_x):
	left_numbers = x - 1
	right_numbers = n - x
	left = 0
	right = n
	while left < right:
		middle = (left + right) // 2
		if middle < pos:
			permutations[middle] = left_numbers
			left_numbers -= 1
			left = middle + 1
		elif middle == pos:
			permutations[middle] = 1
			left = middle + 1
		else:
			permutations[middle] = right_numbers
			right_numbers -= 1
			right = middle
	return left_numbers + right_numbers
remainder = binary_search(x)
num_of_valid_permutations = 1
for ind in range(n):
	if permutations[ind] == 0:
		num_of_valid_permutations = num_of_valid_permutations * remainder % modulo
		remainder -= 1
	else:
		num_of_valid_permutations = num_of_valid_permutations * permutations[ind] % modulo
print(num_of_valid_permutations)


import math
from collections import Counter, defaultdict, deque
MAX_N = 2000
MOD = 10 ** 9 + 7

def modInverse(a, p):
	return pow(a, p - 2, p)
fact = [1]
for i in range(1, MAX_N + 1):
	fact.append(fact[-1] * i % MOD)
invFact = [0] * (MAX_N + 1)
invFact[MAX_N] = modInverse(fact[MAX_N], MOD)
for i in range(MAX_N - 1, -1, -1):
	invFact[i] = invFact[i + 1] * (i + 1) % MOD
inv = [0] * (MAX_N + 1)
for i in range(1, MAX_N + 1):
	inv[i] = fact[i - 1] * invFact[i] % MOD

def nCr(n, r):
	if n < r:
		return 0
	return fact[n] * invFact[r] * invFact[n - r] % MOD

def f(n, x, pos):
	cnts = 0
	cntb = 0
	left = 0
	right = n
	while left < right:
		middle = (left + right) // 2
		if middle > pos:
			cntb += 1
		if middle < pos:
			cnts += 1
		if middle <= pos:
			left = middle + 1
		else:
			right = middle
	ans = nCr(x - 1, cnts) * nCr(n - x, cntb) * fact[n - cnts - cntb - 1] * fact[cnts] * fact[cntb] % MOD
	return ans
p = 10 ** 9 + 7
t = 1
result = []
for i in range(t):
	(n, x, pos) = list(map(int, input().split()))
	result.append(f(n, x, pos))
for i in range(t):
	print(result[i])


from math import factorial as fac
per = lambda xi, yi: fac(xi) // fac(xi - yi)
inf = int(1000000000.0 + 7)
(n, x, p) = list(map(int, input().split()))
f = p + 1
ans = 1

def bins(a, m, x):
	lef = 0
	p = 1
	rig = len(a)
	while lef < rig:
		mid = (lef + rig) // 2
		if a[mid] <= x:
			lef = mid + 1
		else:
			rig = mid
		m[mid] = p
		p += 1
	if lef > 0 and a[lef - 1] == x:
		return True
	else:
		return False
k = [0 for i in range(n)]
l = [i + 1 for i in range(n)]
bins(l, k, f)
mx = max(k)
ls = 0
rs = 0
for i in range(f - 1):
	if k[i] != 0 and k[i] < mx:
		ls += 1
for i in range(f, n):
	if k[i] != 0 and k[i] <= mx:
		rs += 1

def debug():
	print(mx)
	print(k)
	print(l)
	print(n - k.count(0))
	print(ls, rs)
	print(x, n - x)
if x - 1 >= ls:
	ans = ans * per(x - 1, ls)
else:
	ans = 0
if n - x >= rs:
	ans = ans * per(n - x, rs)
else:
	ans = 0
if n - rs - ls - 1 != 0:
	ans = ans * per(n - rs - ls - 1, n - rs - ls - 1)
print(ans % inf)


from math import comb
from math import factorial as fac

def calc(n, p):
	(l, h) = (0, 0)
	left = 0
	right = n
	while left < right:
		middle = (left + right) // 2
		if middle <= p:
			if middle != p:
				l += 1
			left = middle + 1
		if middle > p:
			right = middle
			h += 1
	return [l, h]
(n, x, p) = [*map(int, input().split())]
(l, h) = calc(n, p)
if n - x < h or x - 1 < l:
	print(0)
else:
	ans = comb(n - x, h) * fac(h) * comb(x - 1, l) * fac(l) * fac(n - (1 + l + h))
	MOD = 10 ** 9 + 7
	print(ans % MOD)


import math
(n, x, pos) = map(int, input().split())

class Node:

	def __init__(self, val) -> None:
		self.val = val
		(self.left, self.right) = (None, None)

def buildTree(left, right) -> Node:
	if left >= right:
		return None
	mid = (left + right) // 2
	result = Node(mid)
	(newRight, newLeft) = (mid, mid + 1)
	leftChild = buildTree(left, newRight)
	if leftChild is not None:
		result.left = leftChild
	rightChild = buildTree(newLeft, right)
	if rightChild is not None:
		result.right = rightChild
	return result
root = buildTree(0, n)
(a, b) = (0, 0)
curr = root
while curr is not None and curr.val != pos:
	if curr.left is not None and pos < curr.val:
		b += 1
		curr = curr.left
	else:
		a += 1
		curr = curr.right
if curr.right is not None:
	b += 1
	curr = curr.right
	while curr.left is not None:
		b += 1
		curr = curr.left
MOD = 10 ** 9 + 7

def P(n, r):
	if n < r:
		return 0
	return math.factorial(n) // math.factorial(n - r)
result = 1 * P(x - 1, a) * P(n - x, b) * math.factorial(n - a - b - 1)
print(result % MOD)


from sys import stdin

class Input:

	def __init__(self):
		self.it = iter(stdin.readlines())

	def line(self):
		return next(self.it).strip()

	def array(self, sep=' ', cast=int):
		return list(map(cast, self.line().split(sep=sep)))

def testcases(unknown=False):
	inpt = Input()

	def testcases_decorator(func):
		(cases,) = [float('Inf')] if unknown else inpt.array()
		while cases > 0:
			try:
				func(inpt)
				cases -= 1
			except StopIteration:
				break
	return testcases_decorator
MOD = 1000000007

def p(n, r=None):
	if r == None:
		r = n
	if n < 0 or r < 0 or n < r:
		return 0
	f = 1
	for i in range(n, n - r, -1):
		f = f * i % MOD
	return f

@testcases(unknown=True)
def solve(inpt):
	(n, x, pos) = inpt.array()
	left = 0
	right = n
	gt = 0
	lt = 0
	while left < right:
		middle = (left + right) // 2
		if middle == pos:
			left = middle + 1
		elif middle < pos:
			left = middle + 1
			lt += 1
		else:
			right = middle
			gt += 1
	ans = p(x - 1, lt) * p(n - x, gt) * p(n - 1 - lt - gt) % MOD
	print(ans)


def perm(n, r):
	if n < r:
		return 0
	ans = 1
	k = n
	while k > n - r:
		ans *= k
		k -= 1
	return ans

def fact(x):
	if x < 0:
		return 0
	ans = 1
	while x:
		ans *= x
		x -= 1
	return ans
(n, x, p) = map(int, input().split())
b = [0] * n
left = 0
right = n
small = -1
large = 0
while left < right:
	middle = (left + right) // 2
	if middle <= p:
		left = middle + 1
		b[middle] = -1
		small += 1
	else:
		right = middle
		b[middle] = 1
		large += 1
ans = perm(x - 1, small) * perm(n - x, large) * fact(n - 1 - small - large)
print(ans % (10 ** 9 + 7))


from collections import deque, defaultdict
mod = 10 ** 9 + 7

def solve():
	(n, x, pos) = map(int, input().split())
	lft = 0
	rt = n
	lss = grt = 0
	while lft < rt:
		mid = (lft + rt) // 2
		if mid <= pos:
			lft = mid + 1
			if mid != pos:
				lss += 1
		elif mid > pos:
			grt += 1
			rt = mid
	if lss >= x or grt > n - x:
		print(0)
		return None
	ans = 1
	for i in range(lss):
		ans *= x - 1 - i
		ans %= mod
	for i in range(grt):
		ans *= n - x - i
		ans %= mod
	for i in range(n - lss - grt - 1):
		ans *= i + 1
		ans %= mod
	print(ans)

def main():
	t = 1
	for _ in range(t):
		solve()
main()


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
(n, x, pos) = invr()
boro = [0] * n
lo = 0
hi = n
while lo < hi:
	mid = (hi + lo) // 2
	if mid <= pos:
		boro[mid] = -1
		lo = mid + 1
	else:
		boro[mid] = 1
		hi = mid
C = [[0 for i in range(n + 1)] for j in range(n + 1)]
mod = int(1000000000.0 + 7)
for i in range(0, n + 1):
	for j in range(i + 1):
		if j == 0:
			C[i][j] = 1
		elif j == i:
			C[i][j] = 1
		else:
			C[i][j] = C[i - 1][j] + C[i - 1][j - 1]
			if C[i][j] >= mod:
				C[i][j] -= mod
fact = [1] * (n + 1)
for i in range(1, n + 1):
	fact[i] = fact[i - 1] * i
	if fact[i] >= mod:
		fact[i] %= mod
big = n - x
small = x - 1
chotoKoyta = -1
boroKoyta = 0
jekono = 0
for num in boro:
	if num == -1:
		chotoKoyta += 1
	elif num == 1:
		boroKoyta += 1
	else:
		jekono += 1
ans = C[big][boroKoyta] * C[small][chotoKoyta]
if ans >= mod:
	ans %= mod
ans *= fact[jekono]
if ans >= mod:
	ans %= mod
ans *= fact[boroKoyta]
if ans >= mod:
	ans %= mod
ans *= fact[chotoKoyta]
if ans >= mod:
	ans %= mod
print(ans)


mod = 10 ** 9 + 7

def inverse(i):
	return pow(i, mod - 2, mod)
fact = [1] * (10 ** 5 + 1)
ifact = [1] * (10 ** 5 + 1)
for i in range(2, 10 ** 5 + 1):
	fact[i] = fact[i - 1] * i
	ifact[i] = ifact[i - 1] * inverse(i)
	fact[i] %= mod
	ifact[i] %= mod

def ncr(n, k):
	ans = fact[n] * ifact[k] * ifact[n - k]
	return ans % mod
(n, x, pos) = map(int, input().split())
left = 0
right = n
els = []
big = []
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		els.append(middle)
		left = middle + 1
	else:
		right = middle
		big.append(middle)
if len(els) > x or len(big) > n - x:
	print(0)
else:
	els = len(els) - 1
	big = len(big)
	ans = 1
	ans *= ncr(x - 1, els)
	ans %= mod
	ans *= ncr(n - x, big)
	ans %= mod
	ans *= fact[n - big - els - 1]
	ans %= mod
	ans *= fact[els]
	ans %= mod
	ans *= fact[big]
	ans %= mod
	print(ans)


import os, sys
from io import BytesIO, IOBase
mod = 10 ** 9 + 7
fac = [1]
for i in range(1, 1001):
	fac.append(fac[-1] * i % mod)
fac_in = [pow(fac[-1], mod - 2, mod)]
for i in range(1000, 0, -1):
	fac_in.append(fac_in[-1] * i % mod)
fac_in.reverse()

def comb(a, b):
	if a < b:
		return 0
	return fac[a] * fac_in[a - b] % mod

def main():
	(n, x, pos) = map(int, input().split())
	(ch, bd) = (0, 0)
	(l, r) = (0, n)
	while l < r:
		mid = (l + r) // 2
		if mid < pos:
			l = mid + 1
			ch += 1
		elif mid == pos:
			l = mid + 1
		else:
			r = mid
			bd += 1
	print(comb(x - 1, ch) * comb(n - x, bd) * fac[n - ch - bd - 1] % mod)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
(n, x, pos) = map(int, input().split())
smallNum = x - 1
bigNum = n - x
fixed_small = 0
fixed_big = 0

def A(n, r):
	ans = 1
	p = int(math.pow(10, 9) + 7)
	for i in range(n, n - r, -1):
		ans = ans * i % p
	return ans
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		left = middle + 1
		if middle < pos:
			fixed_small += 1
	else:
		right = middle
		fixed_big += 1
ans = A(smallNum, fixed_small) * A(bigNum, fixed_big) * A(n - fixed_big - fixed_small - 1, n - fixed_big - fixed_small - 1) % int(math.pow(10, 9) + 7)
print(int(ans))


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def nCr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def main():
	mod = 10 ** 9 + 7
	fact = [1, 1]
	for i in range(2, 100000 + 2):
		fact.append(fact[-1] * i % mod)
	(n, x, pos) = inar()
	left = 0
	right = n
	arr = [i for i in range(1, n + 1)]
	count = 0
	l = 0
	r = 0
	while left < right:
		middle = (left + right) // 2
		if middle <= pos:
			if middle != pos:
				l += 1
			left = middle + 1
		else:
			r += 1
			right = middle
	ans = 1
	ans = ans * nCr(x - 1, l, mod)
	ans *= nCr(n - x, r, mod)
	ans *= fact[l] % mod
	ans *= fact[r] % mod
	ans *= fact[n - 1 - l - r] % mod
	print(ans % mod)
main()


def solve(n):
	ans_arr = [[0 for _ in range(n)] for _ in range(n)]
	for i in range(0, n, 2):
		ans_arr[i][i] = 1
		ans_arr[i][i + 1] = 1
		ans_arr[i + 1][i] = 1
		ans_arr[i + 1][i + 1] = 1
		if n - i == 3:
			for j in range(3):
				ans_arr[i + 2][i + j] = 1
				ans_arr[i + j][i + 2] = 1
			break
	return ans_arr
(n, number, pos) = list(map(int, input().split()))

def solve(n, number, pos):
	left = 0
	right = n
	pos_dict = {}
	find = False
	while left < right:
		mid = (left + right) // 2
		if find:
			pos_dict[mid] = True
			right = mid
			continue
		if mid == pos:
			find = True
			left = mid + 1
		elif mid > pos:
			pos_dict[mid] = True
			right = mid
		else:
			pos_dict[mid] = False
			left = mid + 1
	large_slot = 0
	small_slot = 0
	for (k, v) in pos_dict.items():
		if v:
			large_slot += 1
		else:
			small_slot += 1
	large_set = n - number
	small_set = number - 1
	if large_set < large_slot or small_set < small_slot:
		return 0
	MOD = 10 ** 9 + 7
	large_v = 1
	for i in range(large_slot):
		large_v = large_set * large_v % MOD
		large_set -= 1
	small_v = 1
	for i in range(small_slot):
		small_v = small_set * small_v % MOD
		small_set -= 1
	remain_set = large_set + small_set
	remain_v = 1
	while remain_set > 0:
		remain_v = remain_v * remain_set % MOD
		remain_set -= 1
	v = large_v * small_v % MOD
	v = v * remain_v % MOD
	return v
print(solve(n, number, pos))


import sys
import math
from collections import deque
from bisect import bisect_left, bisect_right
I = sys.stdin.readline
IN = lambda x: map(int, x.split())
L = lambda x: list(IN(x))

def P(*x, end='\n'):
	print(*x, end=end)
M = 1000000007

def npr(n, r):
	c = 1
	i = n - r + 1
	while i <= n:
		c = c * i % M
		i += 1
	return c
(n, x, pos) = IN(I())
left = 0
right = n
f = False
smallmax = x - 1
largemax = n - x
small = large = 0
while left < right:
	middle = (left + right) // 2
	if middle < pos:
		small += 1
		if small > smallmax:
			f = True
			break
		left = middle + 1
	elif middle == pos:
		left = middle + 1
	else:
		large += 1
		if large > largemax:
			f = True
			break
		right = middle
if f:
	P(0)
	exit()
a = npr(smallmax, small)
b = npr(largemax, large)
c = npr(n - small - large - 1, n - small - large - 1)
res = a * b % M
res = res * c % M
P(res)


(a, b, c) = map(int, input().split())
(l, h) = (0, a)
r = 1
z = 0
(p, q) = (b - 1, a - b)
while l < h:
	m = (l + h) // 2
	if m == c:
		z += 1
		l = m + 1
	elif m > c:
		z += 1
		r *= q
		q -= 1
		h = m
	else:
		z += 1
		r *= p
		p -= 1
		l = m + 1
for i in range(2, a - z + 1):
	r = r * i % 1000000007
print(r)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	(n, x, pos) = map(int, input().split())
	index = []

	def bsearch(a, x):
		(left, right) = (0, len(a))
		while left < right:
			m = (left + right) // 2
			index.append(m)
			if a[m] <= x:
				left = m + 1
			else:
				right = m
		if left > 0 and a[left - 1] == x:
			return True
		else:
			return False
	mod = 10 ** 9 + 7
	a = [i for i in range(0, n)]
	bsearch(a, pos)
	sindex = sorted(index)
	(cnt1, cnt2) = (0, 0)
	for i in sindex:
		if i < pos:
			cnt1 += 1
		if i > pos:
			cnt2 += 1
	ans = 1
	for i in range(1, cnt1 + 1):
		ans *= x - i
	for i in range(cnt2):
		ans *= n - x - i
	ans = ans * math.factorial(n - len(sindex))
	print(ans % mod)
main()


import sys
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
from collections import *
from math import *
(n, x, pos) = iia()
ans = [0] * n
(low, high) = (0, n)
while low < high:
	mid = (low + high) // 2
	if pos >= mid:
		ans[mid] = -1
		low = mid + 1
	else:
		ans[mid] = 1
		high = mid
ans[pos] = 9
P = ans.count(1)
M = ans.count(-1)
minus = x - 1
plus = n - x
a = 1
for i in range(P):
	a = a * plus % mod
	plus -= 1
for i in range(M):
	a = a * minus % mod
	minus -= 1
for i in range(1, n - P - M):
	a = a * i % mod
print(a)


M = int(1000000000.0) + 7

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res *= i
		res %= M
	return res

def modinv(a):
	return int(pow(a, M - 2, M))

def moddiv(a, b):
	bb = modinv(b)
	a *= bb
	a %= M
	return a

def npr(n, r):
	if n <= 0 or r <= 0:
		return 1
	res = fact(n)
	res = moddiv(res, fact(n - r))
	return res
(n, x, pos) = map(int, input().split())
(nb, ns, b, s) = (0, 0, n - x, x - 1)
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	(pleft, pright) = (left, right)
	if middle <= pos:
		ns += 1
		left = middle + 1
	else:
		nb += 1
		right = middle
	if left == pleft and right == pright:
		left = 0
		break
if left > 0 and left - 1 == pos:
	ns -= 1
	if ns > s or nb > b:
		print(0)
	else:
		res = npr(b, nb)
		res *= npr(s, ns)
		res *= npr(n - 1 - ns - nb, s + b - ns - nb)
		print(res % M)
else:
	print(0)


M = int(1000000000.0 + 7)

def mod_pow(a, p):
	res = 1
	a %= M
	while p:
		if p & 1:
			res = res * a % M
		a = a * a % M
		p >>= 1
	return res % M

def mod_inverse(a):
	return mod_pow(a, M - 2)

def mod_comb(n, k):
	if n < 0 or k < 0 or n < k:
		return 0
	if k > n // 2:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i) % M
		res = res * mod_inverse(i + 1) % M
	return res % M

def mod_fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i % M
	return res % M

def solve(n, x, pos):
	L = 0
	R = n
	wantGt = 0
	wantLt = 0
	while L < R:
		mid = (L + R) // 2
		if pos == mid:
			L = mid + 1
		elif pos > mid:
			wantLt += 1
			L = mid + 1
		else:
			wantGt += 1
			R = mid
	gtx = n - x
	ltx = x - 1
	if gtx < wantGt or ltx < wantLt:
		return 0
	return mod_comb(gtx, wantGt) * mod_fact(wantGt) % M * (mod_comb(ltx, wantLt) * mod_fact(wantLt) % M) * (mod_fact(gtx - wantGt + ltx - wantLt) % M) % M
(n, x, pos) = map(int, input().split())
print(solve(n, x, pos))


(n, x, pos) = list(map(int, input().split()))
max = 7 + 1000000000.0
rem = 1
start = 0
end = n
left_value = x - 1
right_value = n - x
while start < end:
	mid = (start + end) // 2
	if mid > pos:
		rem = rem * right_value % max
		right_value -= 1
		n -= 1
		end = mid
	elif mid < pos:
		rem = rem * left_value % max
		left_value -= 1
		n -= 1
		start = mid + 1
	else:
		start = mid + 1
for i in range(1, n):
	rem = rem * i % max
rem = rem % max
print(int(rem))


from math import factorial
(n, x, pos) = map(int, input().split())
middle = 0
cnt = 0
left = 0
right = n
(big, small) = (0, 0)
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		left = middle + 1
		small += 1
	else:
		right = middle
		big += 1
small -= 1
cnt = big + small
pr_big = 1
for i in range(big):
	pr_big = pr_big * (n - x - i)
pr_small = 1
for i in range(small):
	pr_small = pr_small * (x - 1 - i)
ans = factorial(n - cnt - 1) * pr_small * pr_big % (10 ** 9 + 7)
print(ans)


def modFact(n, p):
	if n >= p:
		return 0
	result = 1
	for i in range(1, n + 1):
		result = result * i % p
	return result

def ncr(n, r, p):
	(num, den) = (1, 1)
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
l = list(map(int, input().split()))
(n, x, pos) = (l[0], l[1], l[2])
start = 0
end = n
less = 0
more = 0
p = 1000000007
lesses = []
mores = []
while start < end:
	mid = (start + end) // 2
	if mid == pos:
		start = mid + 1
	elif mid < pos:
		mores.append(mid)
		more += 1
		start = mid + 1
	else:
		less += 1
		lesses.append(mid)
		end = mid
count = ncr(x - 1, more, p) * modFact(more, p) % p
countk = ncr(n - x, less, p) * modFact(less, p) % p
countf = modFact(n - more - less - 1, p)
print(count * countk * countf % p)


(le, num, pos) = list(map(int, input().split()))
needBigger = 0
needLower = 0
mod = 1000000000.0 + 7
l = 0
r = le
while l < r:
	mid = (l + r) // 2
	if mid <= pos:
		if mid != pos:
			needLower += 1
		l = mid + 1
	else:
		r = mid
		needBigger += 1
amountOfLess = num - 1
amountOfBigger = le - num
if amountOfLess < needLower or amountOfBigger < needBigger:
	print(0)
	exit(0)
m = 1
for i in range(needLower):
	m *= amountOfLess - i
	m %= mod
for i in range(needBigger):
	m *= amountOfBigger - i
	m %= mod
other = le - 1 - needLower - needBigger
for i in range(1, other + 1):
	m *= i
	m %= mod
print(int(m))


pri = pow(10, 9) + 7
fact = [1, 1]
for i in range(2, 1002):
	fact.append(i * fact[i - 1])
	fact[-1] %= pri

def npr(n, r):
	if r > n:
		return 0
	num = den = 1
	for i in range(r):
		num = num * (n - i) % pri
		den = den * (i + 1) % pri
	return num * pow(den, pri - 2, pri) % pri * fact[r] % pri
(n, x, p) = map(int, input().split())
s = 0
b = 0
l = 0
r = n
while l < r:
	mid = (l + r) // 2
	if 2 == 1:
		print('sadf')
	elif mid <= p:
		l = mid + 1
		if mid < p:
			b += 1
	else:
		r = mid
		s += 1
small = x - 1
large = n - x
print(npr(small, b) * npr(large, s) * fact[n - 1 - (s + b)] % pri)


(n, x, pos) = map(int, input().split())
MOD = 10 ** 9 + 7
(l, r, a, b) = (0, n, 0, 0)
while l < r:
	m = (l + r) // 2
	if pos == m:
		l = m + 1
	elif pos < m:
		b += 1
		r = m
	else:
		a += 1
		l = m + 1
(aa, bb) = (x - 1, n - x)
if aa < a or bb < b:
	print(0)
	exit(0)

def A(n, k):
	ret = 1
	for i in range(n - k + 1, n + 1):
		ret = ret * i % MOD
	return ret

def fact(n):
	ret = 1
	for i in range(2, n + 1):
		ret = ret * i % MOD
	return ret
ans = A(aa, a) * A(bb, b) * fact(n - 1 - a - b)
print(ans % MOD)


from math import factorial
(n, x, pos) = [int(p) for p in input().split()]
MOD = 10 ** 9 + 7
less = x - 1
more = n - x
left = 0
right = n
ans = 1
while left < right:
	middle = (left + right) // 2
	if middle < pos:
		ans *= less
		less -= 1
		left = middle + 1
	elif middle > pos:
		ans *= more
		more -= 1
		right = middle
	else:
		left = middle + 1
ans *= factorial(less + more)
print(ans % MOD)


import math
(n, x, pos) = [int(k) for k in input().split()]
ans = 1
greater = n - x
smaller = x - 1
left = 0
right = n
while left < right:
	mid = (left + right) // 2
	if mid < pos:
		ans *= smaller
		smaller -= 1
		left = mid + 1
	elif mid > pos:
		ans *= greater
		greater -= 1
		right = mid
	else:
		left = mid + 1
ans *= math.factorial(smaller + greater)
ans = ans % 1000000007
print(ans)


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
import io
import os
input = sys.stdin.readline
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def modFact(n, p):
	if n < 0:
		return 0
	if n >= p:
		return 0
	result = 1
	for i in range(1, n + 1):
		result = result * i % p
	return result

def binary_search(arr, x):
	low = 0
	high = len(arr)
	mid = 0
	c = 0
	b = 0
	while low < high:
		mid = (high + low) // 2
		if arr[mid] < x:
			low = mid + 1
			c += 1
		elif arr[mid] == x:
			low = mid + 1
		else:
			high = mid
			b += 1
	if low == 0:
		b = -1
	return (b, c)

def ncr(n, r, p):
	if n < r or n < 0:
		return 0
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
for _ in range(1):
	(n, x, p) = cin()
	l = [-i for i in range(p, 0, -1)]
	l += [x]
	l += [x + 1 + i for i in range(n - p - 1)]
	s = binary_search(l, x)
	b = s[0]
	c = s[1]
	ans = ncr(x - 1, c, mo) * ncr(n - x, b, mo)
	ans *= modFact(n - b - c - 1, mo) % mo * (modFact(b, mo) % mo) * (modFact(c, mo) % mo) % mo
	print(ans % mo)


(n, x, p) = map(int, input().split())
MOD = 1000000007
nums = [i + 1 for i in range(n)]
(left, right) = (0, n)
(a, b) = (-1, 0)
while left < right:
	middle = (left + right) // 2
	if nums[middle] <= nums[p]:
		left = middle + 1
		a += 1
	else:
		right = middle
		b += 1
total = 1
for i in range(x - 1, x - a - 1, -1):
	total = total * i % MOD
for i in range(n - x, n - x - b, -1):
	total = total * i % MOD
for i in range(1, n - a - b):
	total = total * i % MOD
print(total)


def fact(n):
	ans = 1
	for i in range(1, n + 1):
		ans *= i
		ans %= mod
	return ans

def binary_search(n, x, idx):
	l = 0
	r = n
	ans = 1
	bigger = 0
	smaller = 0
	while l < r:
		mid = (l + r) // 2
		if mid > idx:
			ans *= n - x - bigger
			ans %= mod
			bigger += 1
			r = mid
		elif mid < idx:
			l = mid + 1
			ans *= x - 1 - smaller
			ans %= mod
			smaller += 1
		else:
			l = mid + 1
	ans *= fact(n - smaller - bigger - 1)
	return ans % mod
mod = 1000000007
(n, x, pos) = map(int, input().split())
print(binary_search(n, x, pos))


def comb(n, x):
	(a, b) = (1, 1)
	for i in range(1, x + 1):
		a *= n + 1 - i
		b *= i
	return a // b % mod

def fact(n):
	val = 1
	for i in range(1, n + 1):
		val = val * i % mod
	return val % mod
mod = 1000000007
(n, x, pos) = map(int, input().split())
(less, more) = (0, 0)
(l, h) = (0, n)
while l < h:
	mid = (l + h) // 2
	if mid <= pos:
		less += 1
		l = mid + 1
	else:
		more += 1
		h = mid
less -= 1
if less <= x - 1 and more <= n - x:
	ans = comb(x - 1, less) * fact(less) % mod * (comb(n - x, more) * fact(more)) % mod % mod * fact(n - 1 - (less + more)) % mod % mod
	print(ans)
else:
	print(0)


(n, x, pos) = map(int, input().split())
smaller = 0
larger = 0
for i in range(1, n + 1):
	if i > x:
		larger += 1
	elif i < x:
		smaller += 1
l = 0
r = n
ans = 1
while l < r:
	mid = (l + r) // 2
	if mid < pos:
		ans = ans * smaller
		smaller -= 1
		l = mid + 1
	elif mid == pos:
		ans = ans * 1
		l = mid + 1
	else:
		r = mid
		ans = ans * larger
		larger -= 1
smaller += larger
if smaller > 0:
	for i in range(smaller, 0, -1):
		ans *= i
print(ans % (10 ** 9 + 7))


MOD = 10 ** 9 + 7

def per(n, k):
	if n < k:
		return 0
	if k == 0:
		return 1
	ans = 1
	for i in range(k):
		ans = ans * (n - i) % MOD
	return ans

def solve(n, x, pos):
	le = 0
	gt = 0
	left = 0
	right = n
	while left < right:
		mid = (left + right) // 2
		if pos > mid:
			left = mid + 1
			le += 1
		elif pos < mid:
			right = mid
			gt += 1
		else:
			left = mid + 1
	re = n - le - gt - 1
	return per(x - 1, le) * per(n - x, gt) % MOD * per(re, re) % MOD
(n, x, pos) = map(int, input().split())
print(solve(n, x, pos))


(n, x, pos) = map(int, input().split())
large = 0
small = 0
mod = 10 ** 9 + 7
(l, h) = (0, n)
while l < h:
	m = (l + h) // 2
	if m <= pos:
		if m != pos:
			small += 1
		l = m + 1
	else:
		h = m
		large += 1
(great, less) = (n - x, x - 1)
ans = 1
for i in range(large):
	ans = ans * great % mod
	great -= 1
for i in range(small):
	ans = ans * less % mod
	less -= 1
tot = less + great
for i in range(1, 1 + tot):
	ans = ans * i % mod
print(ans)


(n, x, pos) = list(map(int, input().split()))
mod = 10 ** 9 + 7
a = 0
b = 0
left = 0
right = n
arr = range(1, n + 1)
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		left = middle + 1
		a += 1
	else:
		right = middle
		b += 1
a -= 1
factorial = [1]
for i in range(1, n + 1):
	factorial.append(i * factorial[-1])
num = factorial[x - 1] * factorial[n - x] * factorial[n - a - b - 1]
deno = factorial[x - 1 - a] * factorial[n - x - b]
ans = num // deno
print(ans % mod)


def power(a, b, mod):
	res = 1
	while b:
		if b % 2:
			res = res * a % mod
		b //= 2
		a = a * a % mod
	return res % mod

def choose(n, k, fac, MOD):
	res = fac[n] % MOD
	res = res * power(fac[n - k], MOD - 2, MOD) % MOD
	return res
(n, x, pos) = map(int, input().split())
MOD = 10 ** 9 + 7
fac = [1, 1]
for i in range(2, n + 1):
	fac.append(fac[-1] * i % MOD)
a = [i for i in range(n)]
valid_greater = n - x
valid_lesser = x - 1
greater_pos = 0
lesser_pos = 0
left = 0
right = len(a)
targ = pos
while left < right:
	mid = (left + right) // 2
	if a[mid] <= targ:
		left = mid + 1
		if a[mid] != targ:
			lesser_pos += 1
	else:
		right = mid
		greater_pos += 1
ans = not (greater_pos + x > n or x - lesser_pos < 1)
ans = ans * choose(valid_greater, greater_pos, fac, MOD) * choose(valid_lesser, lesser_pos, fac, MOD) % MOD
ans = ans * fac[n - greater_pos - lesser_pos - 1] % MOD
print(ans)


(n, x, pos) = map(int, input().split())
left = 0
right = n
larger_count = 0
smaller_count = 0
mod = 10 ** 9 + 7

def fact(p, y=1):
	if p <= 1:
		return y
	else:
		return fact(p - 1, y * p)
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		if middle < pos:
			smaller_count += 1
		left = middle + 1
	else:
		larger_count += 1
		right = middle
if n - x - larger_count < 0 or x - 1 - smaller_count < 0:
	print(0)
else:
	res = 1
	lg = n - x
	for _ in range(larger_count):
		res *= lg
		res %= mod
		lg -= 1
	sm = x - 1
	for _ in range(smaller_count):
		res *= sm
		res %= mod
		sm -= 1
	res *= fact(n - larger_count - smaller_count - 1)
	res %= mod
	print(res)


def fact(n):
	ans = 1
	for i in range(1, n + 1):
		ans *= i
	return ans
mod = 10 ** 9 + 7

def search(A, x):
	lo = 0
	hi = len(A)
	fixed = set()
	while lo < hi:
		mid = (lo + hi) // 2
		fixed.add(mid)
		if A[mid] <= x:
			lo = mid + 1
		else:
			hi = mid
	return fixed
(n, x, pos) = [int(x) for x in input().split()]
A = list(range(n))
fixed = search(A, pos)
smaller = greater = 0
for f in fixed:
	if f < pos:
		smaller += 1
	if f > pos:
		greater += 1
ans = 1
for i in range(smaller):
	ans *= x - 1 - i
for i in range(greater):
	ans *= n - x - i
ans *= fact(n - smaller - greater - 1)
print(ans % mod)


import math
(n, x, pos) = map(int, input().split())
left = 0
right = n
small = 0
big = 0
mod = 1000000007
while left < right:
	mid = (left + right) // 2
	if mid <= pos:
		left = mid + 1
		if mid < pos:
			small += 1
	else:
		right = mid
		big += 1
if n - x < big or x - 1 < small:
	print(0)
else:
	tb = math.factorial(n - x) // math.factorial(n - x - big)
	ts = math.factorial(x - 1) // math.factorial(x - 1 - small)
	y = math.factorial(n - big - small - 1)
	print(tb * ts * y % mod)


import sys
from math import factorial as f
input = sys.stdin.readline
mod = int(1000000000.0) + 7

def solve():
	(n, x, pos) = map(int, input().split())
	ANS = [0] * n
	(lb, hb) = (0, n)
	while lb < hb:
		mid = (lb + hb) // 2
		if pos >= mid:
			ANS[mid] = -1
			lb = mid + 1
		else:
			ANS[mid] = 1
			hb = mid
	ANS[pos] = 9
	P = ANS.count(1)
	M = ANS.count(-1)
	minus = x - 1
	plus = n - x
	a = 1
	for i in range(P):
		a = a * plus % mod
		plus -= 1
	for i in range(M):
		a = a * minus % mod
		minus -= 1
	for i in range(1, n - P - M):
		a = a * i % mod
	print(a)
solve()


(n, x, p) = map(int, input().split())
mod = 10 ** 9 + 7
ans = 1
(left, right) = (0, n)
(c1, c2) = (0, 0)
while left < right:
	mid = left + (right - left) // 2
	if mid <= p:
		c1 += 1
		left = mid + 1
	else:
		c2 += 1
		right = mid
ans = 1
for i in range(1, n - c1 - c2 + 1):
	ans = ans * i % mod
c1 -= 1
(p1, p2) = (x - 1, n - x)
for i in range(p1, p1 - c1, -1):
	ans = ans * p1 % mod
	p1 -= 1
for i in range(p2, p2 - c2, -1):
	ans = ans * p2 % mod
	p2 -= 1
print(ans)


def perm(N, R):
	temp = 1
	while R > 0:
		temp *= N
		R -= 1
		N -= 1
	return temp

def BinarySearch(n, x, pos):
	(left, right) = (0, n)
	(l, r) = (0, 0)
	while left < right:
		middle = (left + right) // 2
		if middle <= pos:
			if not middle == pos:
				l += 1
			left = middle + 1
		else:
			r += 1
			right = middle
	if l >= x or r > n - x:
		return 0
	(t1, t2, t3) = (perm(x - 1, l), perm(n - x, r), perm(n - l - r - 1, n - l - r - 1))
	return t1 * t2 * t3 % (10 ** 9 + 7)
(n, x, pos) = input().split()
print(BinarySearch(int(n), int(x), int(pos)))


from enum import Enum, auto
MOD = 10 ** 9 + 7

class State(Enum):
	LOWER = (auto(),)
	HIGHER = (auto(),)
	NO_CARE = (auto(),)

def include_states(n, pos, states):
	left = 0
	right = n
	while left < right:
		middle = (left + right) // 2
		if middle <= pos:
			left = middle + 1
			states[middle] = State.LOWER
		else:
			right = middle
			states[middle] = State.HIGHER
	if left - 1 != pos:
		return -1
(n, x, pos) = (int(x) for x in input().split())
states = n * [State.NO_CARE]
if include_states(n, pos, states) == -1:
	print(0)
	exit(0)
higher = [i for (i, state) in enumerate(states) if state is State.HIGHER and i != pos]
lower = [i for (i, state) in enumerate(states) if state is State.LOWER and i != pos]
no_care = [i for (i, state) in enumerate(states) if state is State.NO_CARE and i != pos]
start = n
results = [1] * n
(higher_len, lower_len, no_care_len) = (len(higher), len(lower), len(no_care))
tmp_high = n - x
for index in higher:
	results[index] = tmp_high
	tmp_high -= 1
tmp_lower = x - 1
for index in lower:
	results[index] = tmp_lower
	tmp_lower -= 1
tmp_no_care = tmp_high + tmp_lower
for index in no_care:
	results[index] = tmp_no_care
	tmp_no_care -= 1
result = 1
for elem in results:
	result = result * elem % MOD
print(result)


def binSrc(n, x):
	(left, right) = (0, n)
	d = {0: [], 1: [], 2: []}
	while left < right:
		mid = (left + right) // 2
		if mid < x:
			left = mid + 1
			d[1].append(mid)
		elif mid > x:
			right = mid
			d[2].append(mid)
		else:
			left = mid + 1
			d[0].append(mid)
	return d
p = 10 ** 9 + 7

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def fact(n):
	prod = 1
	for i in range(2, n + 1):
		prod = prod * i % p
	return prod
(n, num, x) = map(int, input().split())
d = binSrc(n, x)
low = ncr(num - 1, len(d[1]), p) * fact(len(d[1]))
high = ncr(n - num, len(d[2]), p) * fact(len(d[2]))
val = fact(n - len(d[1]) - len(d[2]) - 1) * low * high % p
print(val)


from math import *
mod = 1000000007
(n, x, pos) = map(int, input().split())
left = 0
right = n
(cnts, cntb) = (0, 0)
while left < right:
	mid = (left + right) // 2
	if mid > pos:
		cntb += 1
	if mid < pos:
		cnts += 1
	if mid <= pos:
		left = mid + 1
	else:
		right = mid
a = comb(x - 1, cnts) % mod
b = comb(n - x, cntb) % mod
c = factorial(n - 1 - cnts - cntb) % mod
d = factorial(cnts) % mod
e = factorial(cntb) % mod
print(a * b * c * d * e % mod)


MOD = 1000000007

def f(n, cnt):
	ans = 1
	for _ in range(cnt):
		ans = ans * n % MOD
		n -= 1
	return ans

def main():
	(n, x, pos) = map(int, input().split())
	chk1 = 0
	chk_r = 0
	left = 0
	right = n
	while left < right:
		middle = (left + right) // 2
		if middle <= pos:
			if middle < pos:
				chk1 += 1
			left = middle + 1
		else:
			chk_r += 1
			right = middle
	if chk1 > x - 1 or chk_r > n - x:
		print(0)
	else:
		rest = n - chk1 - chk_r - 1
		print(f(x - 1, chk1) * f(n - x, chk_r) * f(rest, rest) % MOD)
main()


from __future__ import division, print_function
import math
import os
import sys
from fractions import *
from sys import *
from io import BytesIO, IOBase
from itertools import *
from collections import *
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def inpu():
	return int(inp())

def regularbracket(t):
	p = 0
	for i in t:
		if i == '(':
			p += 1
		else:
			p -= 1
		if p < 0:
			return False
	else:
		if p > 0:
			return False
		else:
			return True

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def reverse1(string):
	pp = ''
	for i in string[::-1]:
		pp += i
	if pp == string:
		return True
	return False

def reverse2(list1):
	l = []
	for i in list1[::-1]:
		l.append(i)
	if l == list1:
		return True
	return False

def mex(list1):
	p = max(list1) + 1
	for i in range(len(list1)):
		if list1[i] != i:
			p = i
			break
	return p

def sumofdigits(n):
	n = str(n)
	s1 = 0
	for i in n:
		s1 += int(i)
	return s1

def perfect_square(n):
	s = math.sqrt(n)
	if s == int(s):
		return True
	return False

def roman_number(x):
	if x > 15999:
		return
	value = [5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
	symbol = ['F', 'MF', 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
	roman = ''
	i = 0
	while x > 0:
		div = x // value[i]
		x = x % value[i]
		while div:
			roman += symbol[i]
			div -= 1
		i += 1
	return roman

def soretd(s):
	for i in range(1, len(s)):
		if s[i - 1] > s[i]:
			return False
	return True

def countRhombi(h, w):
	ct = 0
	for i in range(2, h + 1, 2):
		for j in range(2, w + 1, 2):
			ct += (h - i + 1) * (w - j + 1)
	return ct

def countrhombi2(h, w):
	return h * h // 4 * (w * w // 4)

def binpow(a, b):
	if b == 0:
		return 1
	else:
		res = binpow(a, b // 2)
	if b % 2 != 0:
		return res * res * a
	else:
		return res * res

def binpowmodulus(a, b, m):
	a %= m
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b >>= 1
	return res

def coprime_to_n(n):
	result = n
	i = 2
	while i * i <= n:
		if n % i == 0:
			while n % i == 0:
				n //= i
			result -= result // i
		i += 1
	if n > 1:
		result -= result // n
	return result

def prime(x):
	if x == 1:
		return False
	else:
		for i in range(2, int(math.sqrt(x)) + 1):
			if x % i == 0:
				return False
		else:
			return True

def luckynumwithequalnumberoffourandseven(x, n, a):
	if x >= n and str(x).count('4') == str(x).count('7'):
		a.append(x)
	elif x < 1000000000000.0:
		luckynumwithequalnumberoffourandseven(x * 10 + 4, n, a)
		luckynumwithequalnumberoffourandseven(x * 10 + 7, n, a)
	return a

def luckynuber(x, n, a):
	p = set(str(x))
	if len(p) <= 2:
		a.append(x)
	if x < n:
		luckynuber(x + 1, n, a)
	return a

def interact(type, x):
	if type == 'r':
		inp = input()
		return inp.strip()
	else:
		print(x, flush=True)

def findTrailingZeros(n):
	count = 0
	while n >= 5:
		n //= 5
		count += n
	return count

def mergeSort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		L = arr[:mid]
		R = arr[mid:]
		mergeSort(L)
		mergeSort(R)
		i = j = k = 0
		while i < len(L) and j < len(R):
			if L[i] < R[j]:
				arr[k] = L[i]
				i += 1
			else:
				arr[k] = R[j]
				j += 1
			k += 1
		while i < len(L):
			arr[k] = L[i]
			i += 1
			k += 1
		while j < len(R):
			arr[k] = R[j]
			j += 1
			k += 1
res = set()

def solve(p, l, a, b, n):
	if p > n or l > 10:
		return
	if p > 0:
		res.add(p)
	solve(p * 10 + a, l + 1, a, b, n)
	solve(p * 10 + b, l + 1, a, b, n)

def main():
	(n, x, poss) = sep()
	less = x - 1
	large = n - x
	s = 0
	e = n
	ans = 1
	while s < e:
		mid = (s + e) // 2
		if mid < poss:
			s = mid + 1
			ans *= less
			less -= 1
		elif mid > poss:
			e = mid
			ans *= large
			large -= 1
		else:
			s = mid + 1
	less += large
	if less > 0:
		for i in range(less, 0, -1):
			ans *= i
	print(ans % (10 ** 9 + 7))
main()


from math import factorial, perm
import sys

def input_int_arr():
	return map(int, sys.stdin.readline().split())

def print_ln(num):
	sys.stdout.write(str(num) + '\n')

def binary_search(left, right, x, pos):
	count_less = count_bigger = 0
	while left < right:
		mid = left + (right - left) // 2
		if pos >= mid:
			if pos != mid:
				count_less += 1
			left = mid + 1
		else:
			right = mid
			count_bigger += 1
	return (count_less, count_bigger)

def main():
	MOD = 1000000007
	(n, x, pos) = input_int_arr()
	(count_less, count_bigger) = binary_search(0, n, x, pos)
	(smaller_numbers, bigger_numbers) = (x - 1, n - x)
	smaller_count = perm(smaller_numbers, count_less) % MOD
	bigger_count = perm(bigger_numbers, count_bigger) % MOD
	other_count = factorial(n - 1 - count_less - count_bigger) % MOD
	res = int(smaller_count * bigger_count * other_count % MOD)
	print_ln(res)
main()


def binarySearch(a, x, status):
	left = 0
	right = len(a)
	while left < right:
		mid = (left + right) // 2
		if a[mid] <= x:
			left = mid + 1
			status[mid] = -1
		else:
			right = mid
			status[mid] = 1

def inv(n, p):
	return pow(n, p - 2, p)
fact = [1] * 1010
p = int(1000000000.0 + 7)
for i in range(2, len(fact)):
	fact[i] = fact[i - 1] * i % p
(n, x, pos) = map(int, input().split())
status = [0] * n
(g, l) = (0, 0)
test = list()
for _ in range(pos):
	test.append(0)
test.append(x)
for _ in range(n - (pos + 1)):
	test.append(2000)
binarySearch(test, x, status)
for i in range(n):
	if status[i] == 1 and i != pos:
		g += 1
	elif status[i] == -1 and i != pos:
		l += 1
anything = n - 1 - (g + l)
greater = n - x
less = n - greater - 1
if greater < g or less < l:
	print(0)
else:
	p1 = fact[greater] * inv(fact[greater - g], p) % p
	p2 = fact[less] * inv(fact[less - l], p) % p
	ans = p1 * p2 % p
	ans = ans * fact[n - 1 - (g + l)] % p
	print(ans)


(n, x, pos) = map(int, input().split())
mod = 10 ** 9 + 7
N = 10 ** 5
mod = 10 ** 9 + 7
fac = [1] * (N + 1)
finv = [1] * (N + 1)
for i in range(N):
	fac[i + 1] = fac[i] * (i + 1) % mod
finv[-1] = pow(fac[-1], mod - 2, mod)
for i in reversed(range(N)):
	finv[i] = finv[i + 1] * (i + 1) % mod

def cmb1(n, r, mod):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return fac[n] * finv[r] * finv[n - r] % mod

def prm1(n, r, mod):
	if r < 0 or r > n:
		return 0
	return fac[n] * finv[n - r] % mod
l = [0]
r = [0]

def BinarySearch(a, x):
	left = 0
	right = len(a)
	while left < right:
		middle = (left + right) // 2
		if a[middle] <= x:
			l[0] += 1
			left = middle + 1
		else:
			r[0] += 1
			right = middle
	if left > 0 and a[left - 1] == x:
		return True
	else:
		return False
A = [0] * n
A[pos] = x
for i in range(pos + 1, n):
	A[i] = 1001
BinarySearch(A, x)
ans = prm1(x - 1, l[0] - 1, mod)
ans *= prm1(n - x, r[0], mod)
ans *= fac[n - l[0] - r[0]]
ans %= mod
print(ans)


(n, x, pos) = map(int, input().split())
left = 0
right = n
mod = 10 ** 9 + 7
N = 2000
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

def cmb(n, r, mod):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return g1[n] * g2[r] * g2[n - r] % mod
for i in range(2, N + 1):
	g1.append(g1[-1] * i % mod)
	inverse.append(-inverse[mod % i] * (mod // i) % mod)
	g2.append(g2[-1] * inverse[-1] % mod)
a = []
while left < right:
	middle = (left + right) // 2
	a.append(middle)
	if middle <= pos:
		left = middle + 1
	else:
		right = middle
count = 0
lower = 0
upper = 0
for i in a:
	if i > pos:
		upper += 1
	elif i < pos:
		lower += 1
	count += 1
ans = cmb(n - x, upper, mod)
ans *= cmb(x - 1, lower, mod)
ans %= mod
for i in range(1, n - count + 1):
	ans *= i
	ans %= mod
for i in range(1, upper + 1):
	ans *= i
	ans %= mod
for i in range(1, lower + 1):
	ans *= i
	ans %= mod
print(ans)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import collections as col
import math, string

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7
import itertools

def solve():
	(N, X, pos) = getInts()
	(left_arr, right_arr) = ([], [])
	(left, right) = (0, N)
	while left < right:
		mid = (left + right) // 2
		if mid <= pos:
			left_arr.append(mid)
			left = mid + 1
		else:
			right_arr.append(mid)
			right = mid
	ans = 1
	(L, R) = (X - 1, N - X)
	for i in range(len(left_arr) - 1):
		ans *= L
		L -= 1
		ans %= MOD
	for i in range(len(right_arr)):
		ans *= R
		R -= 1
		ans %= MOD
	for i in range(1, N - len(left_arr) - len(right_arr) + 1):
		ans *= i
		ans %= MOD
	return ans
print(solve())


def bis(a, x):
	left = 0
	right = len(a)
	cnt_1 = cnt_2 = 0
	while left < right:
		middle = (left + right) // 2
		if a[middle] <= x:
			left = middle + 1
			cnt_1 += 1
		else:
			right = middle
			cnt_2 += 1
	return (cnt_1, cnt_2)
mod = 10 ** 9 + 7
(N, X, pos) = map(int, input().split())
(cnt_1, cnt_2) = bis(list(range(N)), pos)
ans = 1
for i in range(cnt_1 - 1):
	ans = ans * (X - 1 - i) % mod
for i in range(cnt_2):
	ans = ans * (N - X - i) % mod
for i in range(1, N - cnt_1 - cnt_2 + 1):
	ans = ans * i % mod
print(ans)


import sys

def Ints():
	return map(int, sys.stdin.readline().strip().split())

def Strs():
	return map(str, sys.stdin.readline().strip().split())

def Array():
	return list(map(int, sys.stdin.readline().strip().split()))

def Str():
	return sys.stdin.readline().strip()

def Int():
	return int(sys.stdin.readline().strip())

def MOD():
	return 1000000007
mod = 10 ** 9 + 7
(n, x, pos) = Ints()
ans = 1
(a, b, c) = (list(range(1, n + 1)), 0, 0)
(l, r) = (0, n)
while l < r:
	m = (l + r) // 2
	if a[m] <= pos + 1:
		if a[m] != pos + 1:
			b += 1
		l = m + 1
	else:
		r = m
		c += 1
for i in range(x - 1, max(x - 1 - b, -1), -1):
	ans = ans * i % mod
for i in range(n - x, max(n - x - c, -1), -1):
	ans = ans * i % mod
for i in range(n - c - b - 1, 0, -1):
	ans = ans * i % mod
print(ans % mod)


(n, x, pos) = map(int, input().split())
mod = 10 ** 9 + 7
A = [0] * pos + [x] + [x + 1] * (n - pos - 1)
left = 0
right = n
L = x - 1
R = n - x
a = [0] * n
a[pos] = 1
ans = 1
while left < right:
	middle = (left + right) // 2
	if A[middle] <= x:
		if a[middle] == 0:
			a[middle] = 1
			ans *= L
			ans %= mod
			L -= 1
		left = middle + 1
	else:
		if a[middle] == 0:
			a[middle] = 1
			ans *= R
			ans %= mod
			R -= 1
		right = middle
for i in range(1, R + L + 1):
	ans *= i
	ans %= mod
print(ans)


import sys, math
input = sys.stdin.readline
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rs = lambda : input()
for _ in range(1):
	MOD = 10 ** 9 + 7
	(n, x, pos) = rl()
	ls = x - 1
	gt = n - x
	l = 0
	r = n
	ans = 1
	while l < r:
		mid = (l + r) // 2
		if mid == pos:
			ans *= 1
			l = mid + 1
		elif mid > pos:
			ans *= gt
			gt -= 1
			r = mid
		else:
			ans *= ls
			ls -= 1
			l = mid + 1
	ans *= math.factorial(ls + gt)
	print(ans % MOD)


from sys import stdin
(n, x, pos) = map(int, stdin.readline().strip().split())

def bin(a, x):
	l = 0
	r = n
	aux = [0 for i in range(n)]
	while l < r:
		mid = (l + r) // 2
		if mid < pos:
			aux[mid] = 1
			l = mid + 1
		elif pos == mid:
			l = mid + 1
		else:
			aux[mid] = -1
			r = mid
	return aux
	if l > 0 and l - 1 == pos:
		return True
	else:
		return False
mod = 10 ** 9 + 7
fac = [1 for i in range(n + 10)]
for i in range(1, len(fac)):
	fac[i] = fac[i - 1] * i % mod

def comb(n, r):
	if r > n:
		return 0
	num = fac[n]
	den = fac[n - r] * fac[r] % mod
	return num * pow(den, mod - 2, mod) % mod
w = bin([], x)
z = w.count(0) - 1
q = w.count(1)
y = w.count(-1)
ans = fac[q] * fac[y] * comb(n - x, y) % mod * comb(x - 1, q) * fac[z] % mod
print(ans)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline()

def RL():
	return map(int, sys.stdin.readline().split())

def RLL():
	return list(map(int, sys.stdin.readline().split()))

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))
(n, x, p) = RL()
M = 1000000007
(a, b) = (x - 1, n - x)
(l, r) = (0, n)
ans = 1
while l < r:
	m = l + r >> 1
	if m == p:
		l = m + 1
		continue
	if m < p:
		ans *= a
		ans %= M
		a -= 1
		l = m + 1
	else:
		ans *= b
		ans %= M
		b -= 1
		r = m
t = a + b
for i in range(t, 0, -1):
	ans *= i
	ans %= M
print(ans)


import math

def binary_search(l, p):
	a = [i for i in range(l)]
	le = 0
	ri = l
	cu = set()
	cl = set()
	while le < ri:
		m = (le + ri) // 2
		if a[m] <= p:
			cl.add(m)
			le = m + 1
		else:
			cu.add(m)
			ri = m
	return [len(cl) - 1, len(cu)]
(n, x, pos) = [int(i) for i in input().split()]
ch = binary_search(n, pos)
fixed = math.perm(x - 1, ch[0]) % (10 ** 9 + 7) * (math.perm(n - x, ch[1]) % (10 ** 9 + 7)) % (10 ** 9 + 7)
rest = math.factorial(n - ch[0] - ch[1] - 1) % (10 ** 9 + 7)
print(fixed * rest % (10 ** 9 + 7))


import time, math as mt, bisect as bs, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * (2 * 10 ** 5 + 5)
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(2 * 10 ** 5 + 5):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return

def readTree(n, e):
	adj = [set() for i in range(n + 1)]
	for i in range(e):
		(u1, u2) = IP()
		adj[u1].add(u2)
	return adj
mod = 10 ** 9 + 7

def solve():
	(n, x, pos) = IP()
	(low, high) = (0, n)
	(big, small) = (0, 0)
	ans = 1
	while high - low >= 1:
		mid = (low + high) // 2
		if mid > pos:
			high = mid
			ans = ans * (n - x - big)
			big += 1
		else:
			low = mid + 1
			if mid != pos:
				ans = ans * (x - 1 - small)
				small += 1
		ans = ans % mod
	used = big + small + 1
	left = n - used
	for i in range(left, 0, -1):
		ans = ans * i
		ans = ans % mod
	print(ans)
	return
t = 1
for i in range(t):
	solve()


import sys
import bisect as bi
import itertools as it
import math as mt
import collections as cc
import heapq as hp
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))

def inv(x):
	mo = 10 ** 9 + 7
	return pow(x, mo - 2, mo)
fact = [1]
ifact = [inv(1)]
for i in range(1, 10001):
	fact.append(fact[-1] * i)
	ifact.append(inv(fact[-1]))

def ncr(n, x):
	if n < x:
		return 0
	return fact[n] * ifact[n - x] * ifact[x] % (10 ** 9 + 7)
(n, x, p) = I()
ar = []
l = 0
r = n
mod = 10 ** 9 + 7
while l < r:
	mid = (l + r) // 2
	ar.append(mid)
	if mid <= p:
		l = mid + 1
	else:
		r = mid
xx = 0
yy = 0
for i in ar:
	if i > p:
		xx += 1
	elif i < p:
		yy += 1
print(ncr(x - 1, yy) * ncr(n - x, xx) * fact[xx] * fact[yy] * fact[n - xx - yy - 1] % mod)


MOD = 1000000007
(n, x, pos) = map(int, input().split())
L = [-1] * n
L[pos] = 1
c0 = 0
c1 = 0
low = 0
high = n
ans = 1
while low < high:
	mid = low + high >> 1
	if mid < pos:
		c0 += 1
		low = mid + 1
	elif mid > pos:
		c1 += 1
		high = mid
	else:
		low = mid + 1
if c0 >= x or c1 > n - x:
	ans = 0
else:
	tt1 = 1
	val = x - 1
	for i in range(c0):
		tt1 = tt1 * val % MOD
		val = (val - 1) % MOD
	rem = val
	tt2 = 1
	val = n - x
	for i in range(c1):
		tt2 = tt2 * val % MOD
		val = (val - 1) % MOD
	rem = (rem + val) % MOD
	tt3 = 1
	for i in range(n - c0 - c1 - 1):
		tt3 = tt3 * rem % MOD
		rem = (rem - 1) % MOD
	ans = tt1 * tt2 % MOD
	ans = ans * tt3 % MOD
print(ans)


def solve():
	(n, x, p) = map(int, input().split())
	a = [i for i in range(n)]
	left = 0
	right = n
	b = []
	while left < right:
		m = (left + right) // 2
		b.append(m)
		if a[m] <= p:
			left = m + 1
		else:
			right = m
	k = 0
	m = 0
	for i in b:
		k += i > p
		m += i < p
	if n - x - k < 0 or x - 1 - m < 0 or n - k - m - 1 < 0:
		print(0)
		return
	f = [1 for i in range(1001)]
	M = 10 ** 9 + 7

	def po(d, e=M - 2):
		r = 1
		while e > 0:
			if e % 2:
				r = r * d % M
			d = d * d % M
			e //= 2
		return r
	for i in range(1, 1001):
		f[i] = f[i - 1] * i % M
	ans = f[n - x] * po(f[n - x - k])
	ans %= M
	ans *= f[x - 1] * po(f[x - 1 - m])
	ans %= M
	ans *= f[n - k - m - 1]
	ans %= M
	print(ans)

def main():
	t = 1
	for _ in range(t):
		solve()
main()


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
from itertools import permutations, combinations

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
INF = 10 ** 9
mod = int(1000000000.0) + 7
f = [1]
for i in range(1, 1000 + 1):
	f.append(f[-1] * i % mod)
(n, x, pos) = mdata()
g = s = 0
left = 0
right = n
while left < right:
	mid = (left + right) // 2
	if mid <= pos:
		s += 1
		left = mid + 1
	elif mid > pos:
		g += 1
		right = mid
s -= 1
if x - 1 < s or n - x < g:
	out(0)
else:
	ans = f[x - 1] * pow(f[x - 1 - s], mod - 2, mod) * f[n - x] * pow(f[n - x - g], mod - 2, mod) * f[n - s - g - 1] % mod
	out(ans)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
import math
(n, x, pos) = list(map(int, input().split()))
mod = 10 ** 9 + 7
ans = 1
left = 0
right = n
counter = 0
bigger = n - x
smaller = x - 1
while left < right:
	middle = (left + right) // 2
	if middle > pos:
		if bigger > 0:
			ans = ans * bigger % mod
			bigger -= 1
			right = middle
		else:
			ans = 0
			break
	elif middle < pos:
		if smaller > 0:
			ans = ans * smaller % mod
			smaller -= 1
			left = middle + 1
		else:
			ans = 0
			break
	else:
		left = middle + 1
		break
while left < right:
	middle = (left + right) // 2
	if middle > pos:
		if bigger > 0:
			ans = ans * bigger % mod
			bigger -= 1
			right = middle
		else:
			ans = 0
			break
	else:
		break
if ans == 0:
	print(0)
else:
	for i in range(1, bigger + smaller + 1):
		ans = ans * i % mod
	print(ans)


import math

def xx(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
(n, x, pos) = map(int, input().split())
low = 0
high = 0
left = 0
right = n
mod = 10 ** 9 + 7
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		left = middle + 1
		if middle < pos:
			low += 1
	else:
		right = middle
		high += 1
if low > x - 1 or high > n - x:
	print(0)
else:
	a = xx(x - 1, low) * math.factorial(low)
	b = xx(n - x, high) * math.factorial(high)
	c = math.factorial(n - (high + low + 1))
	print(a * b * c % mod)


(n, x, pos) = map(int, input().split())
ans = 1
m = 10 ** 9 + 7
a = x - 1
b = n - x
l = 0
h = n
c = 0
while l < h:
	mid = (l + h) // 2
	c += 1
	if pos >= mid:
		if pos == mid:
			l = mid + 1
		else:
			ans *= a
			ans %= m
			l = mid + 1
			a -= 1
	else:
		ans *= b
		ans %= m
		h = mid
		b -= 1
for j in range(n - c):
	ans *= j + 1
	ans %= m
if l > 0 and l - 1 == pos:
	print(ans)
else:
	print(0)


def nCr(n, r):
	return fact(n) // (fact(r) * fact(n - r))

def nPr(n, r):
	return fact(n) // fact(n - r)

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res
mod = 1000000007
(n, x, pos) = map(int, input().split())
left = 0
right = n
gr = 0
sm = 0
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		left = middle + 1
		gr += 1
	elif middle > pos:
		right = middle
		sm += 1
gr -= 1
if gr > x - 1 or sm > n - x:
	print(0)
else:
	print(nPr(x - 1, gr) % mod * (nPr(n - x, sm) % mod) * (fact(n - gr - sm - 1) % mod) % mod)


from math import factorial

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
(n, x, pos) = [int(i) for i in input().split()]
big = n - x
small = x - 1
b = 0
s = 0
l = 0
r = n
curr = -1
while l < r:
	curr = (l + r) // 2
	if pos < curr:
		b += 1
		r = curr
		curr = (l + r) // 2
	elif pos > curr:
		s += 1
		l = curr + 1
		curr = (l + r) // 2
	else:
		l = curr + 1
ans = 1
mod = 10 ** 9 + 7
if s != 0:
	cs = ncr(small, s, mod)
	cs *= factorial(s)
	cs %= mod
	ans *= cs
if b != 0:
	cb = ncr(big, b, mod)
	cb *= factorial(b)
	cb %= mod
	ans *= cb
	ans %= mod
small -= s
big -= b
mf = 1
for i in range(1, small + big + 1):
	mf *= i
	mf %= mod
ans *= mf
ans %= mod
print(ans)


(n, x, pos) = map(int, input().split())
l = 0
r = n
sub = n - x
pro = 1
small = x - 1
cnt = 0
while l < r:
	mid = (l + r) // 2
	if mid > pos:
		pro = pro * sub
		sub -= 1
		r = mid
		cnt += 1
	elif mid < pos:
		l = mid + 1
		pro *= small
		small -= 1
		cnt += 1
	else:
		l = mid + 1
		cnt += 1
for i in range(2, n - cnt + 1):
	pro = pro * i % 1000000007
print(pro)


from sys import stdin
input = stdin.readline

def A():
	t = int(input())
	for __ in range(t):
		(n, m) = map(int, input().split())
		a = list(map(int, input().split()))
		if sum(a) == m:
			print('YES')
		else:
			print('NO')

def B():
	t = int(input())
	for __ in range(t):
		n = int(input())
		x = [[0 for j in range(n)] for i in range(n)]
		for i in range(n // 2):
			x[i][i] = 1
			x[i][n - 1 - i] = 1
			x[n - 1 - i][i] = 1
			x[n - 1 - i][n - 1 - i] = 1
		if n % 2 == 1:
			x[n // 2 - 1][n // 2] = 1
			x[n // 2 + 1][n // 2] = 1
			x[n // 2][n // 2 + 1] = 1
			x[n // 2][n // 2 - 1] = 1
		for i in range(n):
			print(*x[i])

def C():
	(n, x, pos) = map(int, input().split())
	numLess = x - 1
	numMore = n - x
	nume = 1
	denom = 1
	left = 0
	right = n
	mod = pow(10, 9) + 7
	while left < right:
		mid = (left + right) // 2
		if mid < pos:
			nume *= numLess
			denom *= numLess + numMore
			numLess -= 1
			left = mid + 1
		elif mid > pos:
			nume *= numMore
			denom *= numLess + numMore
			numMore -= 1
			right = mid
		else:
			left = mid + 1
		nume %= mod
		denom %= mod
	fact = 1
	for i in range(2, n):
		fact *= i
		fact %= mod
	fract = nume * pow(denom, mod - 2, mod) % mod
	print(fract * fact % mod)

def D():
	t = int(input())
	for __ in range(t):
		_ = 0
C()


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))

def ncr(n, r, p=10 ** 9 + 7):
	if n < r:
		return 0
	num = 1
	r = min(r, n - r)
	ct = 1
	while ct <= r:
		num = num * n % p
		num = num * pow(ct, p - 2, p) % p
		ct += 1
		n -= 1
	return num % p
(n, x, pos) = I()
md = 10 ** 9 + 7
ft = [1, 1, 2]
for i in range(3, 1003):
	ft.append(ft[-1] * i % md)
an = 0
ar = []
lo = 0
ri = n
while lo < ri:
	md = (lo + ri) // 2
	ar.append(md)
	if md <= pos:
		lo = md + 1
	else:
		ri = md
md = 10 ** 9 + 7
a = b = 0
for i in ar:
	if i > pos:
		a += 1
	elif i < pos:
		b += 1
print(ncr(x - 1, b) * ncr(n - x, a) * ft[a] * ft[b] * ft[n - a - b - 1] % md)


import sys
input = sys.stdin.readline
(n, x, pos) = map(int, input().split())
pos += 1
mod = 1000000007
smaller = 0
bigger = 0
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	if middle < pos:
		left = middle + 1
		if middle < pos - 1:
			smaller += 1
	else:
		bigger += 1
		right = middle
poss = True
if smaller >= x:
	poss = False
if bigger > n - x:
	poss = False
if poss:
	sol = 1
	num = x - 1
	for i in range(smaller):
		sol *= num
		sol %= mod
		num -= 1
	num2 = n - x
	for i in range(bigger):
		sol *= num2
		sol %= mod
		num2 -= 1
	num += num2
	while num > 0:
		sol *= num
		sol %= mod
		num -= 1
	print(sol)
else:
	print(0)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')

def bin(a, x):
	l = 0
	r = len(a)
	while l < r:
		print(l, r)
		mid = (l + r) // 2
		if a[mid] <= x:
			l = mid + 1
		else:
			r = mid
	if l > 0 and a[l - 1] == x:
		return True
	else:
		return False
t = 1
for _ in range(t):
	(n, x, pos) = inp()
	ele_less = x - 1
	ele_great = n - x
	l = 0
	r = n
	ans = 1
	while l < r:
		mid = (l + r) // 2
		if pos < mid:
			ans *= ele_great
			ans %= mod
			ele_great -= 1
			r = mid
		elif pos == mid:
			l = mid + 1
		else:
			ans *= ele_less
			ans %= mod
			ele_less -= 1
			l = mid + 1
	rem = ele_less + ele_great
	while rem > 0:
		ans = ans * rem
		ans %= mod
		rem -= 1
	out(ans)


def f(n):
	s = 1
	for i in range(1, n + 1):
		s *= i
		s %= 10 ** 9 + 7
	return s
(n, x, pos) = map(int, input().split())
low = x - 1
up = n - x
mid = 1
l = 0
r = n
var = 1
while l < r:
	m = (l + r) // 2
	if m < pos:
		var *= low
		var %= 10 ** 9 + 7
		low -= 1
		l = m + 1
	elif m == pos:
		mid -= 1
		l = m + 1
	else:
		var *= up
		var %= 10 ** 9 + 7
		up -= 1
		r = m
if low >= 0 and up >= 0 and (mid >= 0):
	print(var * f(up + low) % (10 ** 9 + 7))
else:
	print(0)


(n, X, pos) = [int(x) for x in input().split(' ')]
a = [i for i in range(n)]
x = pos
smaller = 0
larger = 0
positions_checked = set()
left = 0
right = len(a)
middle = None
while left < right:
	if (left + right) % 2 == 0:
		middle = round((left + right) / 2)
	else:
		middle = int((left + right) / 2)
	positions_checked.add(middle)
	if a[middle] <= x:
		if middle != pos:
			smaller += 1
		left = middle + 1
	else:
		larger += 1
		right = middle
if left > 0 and a[left - 1] == x:
	ans = True
else:
	ans = False

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def fact(n, p):
	q = 1
	i = 1
	while i <= n:
		q *= i
		q %= p
		i += 1
	return q
actual_larger = n - X
actual_smaller = X - 1
mod = 1000000007
if actual_smaller < smaller:
	print(0)
elif actual_larger < larger:
	print(0)
else:
	a1 = ncr(actual_larger, larger, mod) % mod
	a2 = ncr(actual_smaller, smaller, mod) % mod
	a3 = fact(n - len(positions_checked), mod) % mod
	a4 = fact(larger, mod) % mod
	a5 = fact(smaller, mod) % mod
	print(a1 * a2 % mod * a3 % mod * a4 % mod * a5 % mod)


import math
mod = 10 ** 9 + 7
(n, x, pos) = [int(x) for x in input().split()]
l = 0
r = n
grtVal = n - x
smlVal = x - 1
cnt = n
ans = 1
while l < r:
	mid = int((l + r) / 2)
	if mid == pos:
		l = mid + 1
	elif mid < pos:
		ans = ans * smlVal % mod
		smlVal -= 1
		l = mid + 1
	else:
		ans = ans * grtVal % mod
		grtVal -= 1
		r = mid
	cnt -= 1
if cnt > 0:
	ans = ans * math.factorial(cnt) % mod
print(ans)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def BinarySearch(a, x):
	left = 0
	right = len(a)
	while left < right:
		middle = (left + right) // 2
		if a[middle] <= x:
			left = middle + 1
		else:
			right = middle
	if left > 0 and a[left - 1] == x:
		return True
	else:
		return False

def stupid(pos, a, x, was, ppos):
	if pos == len(a):
		if a[ppos] != x:
			return 0
		return int(BinarySearch(a, x))
	res = 0
	for i in range(1, len(a) + 1):
		if not was[i]:
			was[i] = True
			a[pos] = i
			res += stupid(pos + 1, a, x, was, ppos)
			was[i] = False
	return res

def stupid1(n, x, pos):
	return stupid(0, [0] * n, x, [False] * (n + 1), pos)

def BinarySearch1(left, right, ppos):
	res = []
	if left < right:
		middle = (left + right) // 2
		res = []
		for ans in BinarySearch1(middle + 1, right, ppos):
			res.append([(1, middle)] + ans)
		for ans in BinarySearch1(left, middle, ppos):
			res.append([(2, middle)] + ans)
		return res
	elif left == ppos + 1:
		return [[]]
	else:
		return []

def stupid2(pos, a, x, was, ppos, cc):
	if pos == len(a):
		if a[ppos] != x:
			return 0
		for (s, p) in cc:
			if s == 1 and a[p] > x or (s == 2 and a[p] <= x):
				return 0
			return 1
	res = 0
	for i in range(1, len(a) + 1):
		if not was[i]:
			was[i] = True
			a[pos] = i
			res += stupid(pos + 1, a, x, was, ppos)
			was[i] = False
	return res

def solve():
	(n, x, pos) = mints()
	qw = BinarySearch1(0, n, pos)
	c = [0, 0]
	for (s, p) in qw[0]:
		if p == pos:
			if s == 2:
				print(0)
				return
		else:
			c[s - 1] += 1
	above = n - x
	below = x - 1
	if c[0] > below or c[1] > above:
		print(0)
		return
	MOD = int(1000000000.0 + 7)
	res = 1
	k = n - 1
	for i in range(c[0]):
		k -= 1
		res = res * (below - i) % MOD
	for i in range(c[1]):
		k -= 1
		res = res * (above - i) % MOD
	for i in range(1, k + 1):
		res = res * i % MOD
	print(res)
solve()


mod = 10 ** 9 + 7
(n, x, pos) = map(int, input().split())
(left, right) = (0, n)
r = 1
z = 0
(p, q) = (x - 1, n - x)
while left < right:
	mid = (left + right) // 2
	z += 1
	if pos == mid:
		left = mid + 1
	elif pos < mid:
		right = mid
		r *= q
		q -= 1
	else:
		left = mid + 1
		r *= p
		p -= 1
for i in range(2, n - z + 1):
	r = r * i % mod
print(r)


import math
from math import factorial
p = int(1000000000.0 + 7)

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return max(num * pow(den, p - 2, p) % p, 0)
(n, x, pos) = map(int, input().split())
(l, r) = (0, n)
(cs, cb) = (0, 0)
while l < r:
	m = (l + r) // 2
	if m < pos:
		cs += 1
	if m > pos:
		cb += 1
	if m <= pos:
		l = m + 1
	else:
		r = m
ans = ncr(x - 1, cs, p) * ncr(n - x, cb, p) % p * factorial(n - cs - cb - 1) % p * factorial(cs) % p * factorial(cb) % p
print(ans)


modulo = 10 ** 9 + 7
(n, x, pos) = map(int, input().split())
bigger = 0
smaller = 0
(l, r) = (0, n)
while l < r:
	mid = (l + r) // 2
	if mid > pos:
		r = mid
		bigger += 1
	elif mid < pos:
		l = mid + 1
		smaller += 1
	else:
		l = mid + 1
res = 1
for i in range(smaller):
	res *= x - 1 - i
	res %= modulo
for i in range(bigger):
	res *= n - x - i
	res %= modulo
for i in range(n - bigger - smaller - 1):
	res *= i + 1
	res %= modulo
print(res)


import math

def ncr(a, b):
	if a < b or a < 0 or b < 0:
		return 0
	c = math.factorial(a) // math.factorial(a - b)
	c = int(c)
	return c % 1000000007

def bs(n, x):
	left = 0
	right = n
	(c1, c2) = (0, 0)
	while left < right:
		mid = (left + right) // 2
		if mid <= x:
			if mid != x:
				c1 += 1
			left = mid + 1
		else:
			c2 += 1
			right = mid
	return (c1, c2)
(n, x, pos) = map(int, input().split())
(c1, c2) = bs(n, pos)
b = n - x
x -= 1
d = ncr(x, c1)
e = ncr(b, c2)
a = int(math.factorial(n - c1 - c2 - 1))
m = 1000000007
print(a % m * d % m * e % m % m)


def solve():
	(n, x, pos) = map(int, input().split())
	l = 0
	r = n
	smaller = 0
	larger = 0
	while l < r:
		m = (l + r) // 2
		if m < pos:
			smaller += 1
			l = m + 1
		elif m > pos:
			larger += 1
			r = m
		else:
			l = m + 1
	if smaller >= x or larger > n - x:
		print(0)
	else:
		mod = int(1000000000.0 + 7)

		def fact(n):
			res = 1
			for i in range(1, n + 1):
				res = res * i % mod
			return res

		def p(n, r):
			res = 1
			for i in range(n - r + 1, n + 1):
				res = res * i % mod
			return res
		print(p(x - 1, smaller) * p(n - x, larger) * fact(n - larger - smaller - 1) % mod)
solve()


import math
mod = 10 ** 9 + 7

def ncr(n, r):
	p = 1
	k = 1
	if n - r < r:
		r = n - r
	if r != 0:
		while r:
			p *= n
			k *= r
			m = math.gcd(p, k)
			p //= m
			k //= m
			n -= 1
			r -= 1
	else:
		p = 1
	return p
(n, x, pos) = map(int, input().split())
indexesToBeCheckedLeft = 0
indexesToBeCheckedRight = 0
left = 0
right = n
middle = -1
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		indexesToBeCheckedLeft += 1
		left = middle + 1
	elif middle > pos:
		right = middle
		indexesToBeCheckedRight += 1
indexesToBeCheckedLeft -= 1
leftElements = x - 1
rightElements = n - x
if leftElements < indexesToBeCheckedLeft or rightElements < indexesToBeCheckedRight:
	print(0)
else:
	waysOfPickingRight = ncr(rightElements, indexesToBeCheckedRight) % mod
	waysOfPickingLeft = ncr(leftElements, indexesToBeCheckedLeft) % mod
	shuffleLeft = math.factorial(indexesToBeCheckedLeft)
	shuffleRight = math.factorial(indexesToBeCheckedRight)
	ans = waysOfPickingLeft * waysOfPickingRight % mod
	ans = ans * shuffleLeft % mod
	ans = ans * shuffleRight % mod
	rest = n - indexesToBeCheckedLeft - indexesToBeCheckedRight - 1
	for i in range(2, rest + 1):
		ans = ans * i % mod
	print(ans)


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def fact(n):
	m = 1000000007
	f = 1
	if n == 0:
		return 1
	else:
		for i in range(1, n + 1):
			f = f * i
			f %= m
		return int(f)
(n, x, pos) = map(int, input().split())
l = 0
r = n
less = 0
more = 0
mod = 1000000007
tm = n - x
tl = x - 1
lt = mt = 1
while l < r:
	mid = (l + r) // 2
	if mid < pos:
		l = mid + 1
		lt *= tl
		lt %= mod
		tl -= 1
	elif mid > pos:
		r = mid
		mt *= tm
		mt %= mod
		tm -= 1
	else:
		l = mid + 1
t1 = fact(tm + tl)
print(t1 * mt * lt % mod)


from math import comb, factorial
mod = 10 ** 9 + 7
(n, x, pos) = map(int, input().split())
lt = 0
gt = 0
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		if middle < pos:
			lt += 1
		left = middle + 1
	else:
		gt += 1
		right = middle
rem = factorial(n - 1 - lt - gt) % mod
lt = comb(x - 1, lt) % mod * factorial(lt)
gt = comb(n - x, gt) % mod * factorial(gt)
print(lt * gt % mod * rem % mod)


def A(k, n):
	ans = 1
	if k >= 1:
		for i in range(n - k + 1, n + 1):
			ans *= i
	return ans

def f(n):
	ans = 1
	for i in range(n):
		ans *= i + 1
	return ans

def solve(n, x, pos):
	cntBig = 0
	cntLess = 0
	left = 0
	right = n
	ans = 1
	mod = 1000000007
	while left < right:
		mid = (left + right) // 2
		if mid < pos:
			left = mid + 1
			ans *= x - 1 - cntLess
			ans % mod
			cntLess += 1
		elif mid > pos:
			right = mid
			ans *= n - x - cntBig
			cntBig += 1
		else:
			left = mid + 1
	ans *= f(n - cntLess - cntBig - 1)
	print(ans % mod)
(n, x, pos) = map(int, input().split())
solve(n, x, pos)


from sys import stdin, exit
from bisect import bisect_left as bl, bisect_right as br
input = lambda : stdin.readline()[:-1]
intput = lambda : int(input())
sinput = lambda : input().split()
intsput = lambda : map(int, sinput())

def dprint(*args, **kwargs):
	if debugging:
		print(*args, **kwargs)
mod = 10 ** 9 + 7
debugging = 1
(n, x, pos) = intsput()
(l, r) = (0, 0)
left = 0
right = n
while left < right:
	middle = (left + right) // 2
	if middle <= pos:
		left = middle + 1
		if middle < pos:
			l += 1
	else:
		right = middle
		r += 1

def modfact(k):
	r = 1
	for i in range(1, k + 1):
		r *= i
		r %= mod
	return r
ans = 1
if x - 1 - l < 0:
	print(0)
	exit()
if n - x - r < 0:
	print(0)
	exit()
for i in range(x - 1, x - 1 - l, -1):
	ans *= i
	ans %= mod
for i in range(n - x, n - x - r, -1):
	ans *= i
	ans %= mod
ans *= modfact(n - 1 - l - r)
ans %= mod
print(ans)


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7

def combi(n, r):
	return n * factorial(r) % N

def solve(n, r):
	return combi(factorial(n) // (factorial(r) * factorial(n - r)) % N, r)
(n, x, p) = R()
a = [-1] * n
l = 0
r = n
cnt = 0
cnt1 = 0
ans = 1
while l < r:
	m = (l + r) // 2
	if m < p:
		a[m] = 0
		l = m + 1
		ans *= x - 1 - cnt
		ans %= N
		cnt += 1
	elif m > p:
		a[m] = 1
		r = m
		ans *= n - x - cnt1
		ans %= N
		cnt1 += 1
	else:
		l = m + 1
for i in range(1, n - cnt - cnt1):
	ans *= i
	ans %= N
print(ans)


mod = 10 ** 9 + 7

def modExp(a, n, m=10 ** 9 + 7):
	if n == 0:
		return 1
	elif n == 1:
		return a
	else:
		while n >= 2:
			if n % 2 == 0:
				n = n // 2
				return modExp(a % m * (a % m) % m, n, m)
			else:
				n = (n - 1) // 2
				return a % m * modExp(a % m * (a % m) % m, n, m) % m % m

def nCr(n, r):
	return dic[n] * modExp(dic[n - r] * dic[r] % mod, mod - 2) % mod
(n, x, p) = map(int, input().split())
dic = {0: 1}
for i in range(1, 1001):
	dic[i] = dic[i - 1] * i
	dic[i] %= mod

def binS(n, p):
	l = 0
	r = n
	g = 0
	s = 0
	while l < r:
		m = (l + r) // 2
		if m > p:
			r = m
			g += 1
		else:
			if m != p:
				s += 1
			l = m + 1
	return (s, g)
(s, g) = binS(n, p)
if n - x < g or x - 1 < s:
	print(0)
else:
	out = nCr(n - x, g) * dic[g] % mod
	out *= nCr(x - 1, s) * dic[s] % mod
	out %= mod
	out *= dic[n - g - s - 1]
	out %= mod
	print(out)