module mod_modulo_util
  implicit none
  integer(8), parameter :: md = 1000000007_8
  integer(8), allocatable :: f(:), invf(:)
contains
  subroutine init(n)
    implicit none
    integer, intent(in) :: n
    integer :: i
    if (allocated(f)) deallocate(f)
    if (allocated(invf)) deallocate(invf)
    allocate(f(0:n),invf(0:n))
    f = 0_8
    invf = 0_8
    f(0) = 1_8
    do i = 1, n
      f(i) = mod(f(i-1)*int(i,8),md)
    end do
    invf(n) = inv(f(n))
    do i = n, 1, -1
      invf(i-1) = mod(invf(i)*int(i,8),md)
    end do
    return
  end subroutine init
  integer(8) function perm(n,k)
    implicit none
    integer, intent(in) :: n, k
    perm = 0_8
    if (n < 0 .or. k > n) return
    perm = mod(f(n)*invf(n-k),md)
    return
  end function perm
  integer(8) function comb(n,k)
    implicit none
    integer, intent(in) :: n, k
    comb = mod(perm(n,k)*invf(k),md)
    return
  end function comb
  integer(8) function homo(n,k)
    implicit none
    integer, intent(in) :: n, k
    homo = comb(n+k-1,k)
    return
  end function homo
  function inv(n) result(y)
    implicit none
    integer(8), intent(in) :: n
    integer(8) :: a, b, x, y, t, q
    a = mod(n,md)
    b = md
    x = 0_8
    y = 1_8
    do while (b /= 0_8)
      q = a/b
      t = b
      b = mod(a,b)
      a = t
      t = y
      y = x
      x = t-q*x
    end do
    y = mod(y,md)
    if (y < 0_8) y = y+md
    return
  end function inv
  function pow(a,b) result(r)
    implicit none
    integer(8), intent(in) :: a
    integer, intent(in) :: b
    integer :: i
    integer(8) :: r, p
    r = 1_8
    p = a
    do i = 0, 32
      if (btest(b,i)) r = mod(r*p,md)
      p = mod(p*p,md)
    end do
    return
  end function pow
  integer(8) function fact(n)
    implicit none
    integer, intent(in) :: n
    fact = 0_8
    if (n < 0) return
    fact = f(n)
    return
  end function fact
end module mod_modulo_util
program painting_machines
  use mod_modulo_util
  implicit none
  integer :: n, k
  integer(8) :: ans = 0_8
  read(*,*) n
  call init(n)
  ans = mod(mod(f(n)*f(n),md)*invf(n),md)
  do k = (n+1)/2, n-1
    ans = mod(ans+md-mod(mod(f(k-1)*f(k),md)*invf(2*k-n),md),md)
  end do
  write(*,'(i0)') ans
  stop
end program painting_machines