#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long int n) {
  if (n == 1) {
    return false;
  }
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
unsigned long long int power(unsigned long long int x, unsigned long long int y,
                             unsigned long long int p) {
  unsigned long long int res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int binarySearch(int arr[], int l, int r, int x) {
  if (r >= l) {
    int mid = l + (r - l) / 2;
    if (arr[mid] == x) return mid;
    if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x);
    return binarySearch(arr, mid + 1, r, x);
  }
  return -1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  unsigned long long int n, a, b = 1;
  cin >> n;
  a = power(2, n - 1, 1000000007);
  for (int i = n; i > 1; i--) {
    b *= i;
    b %= 1000000007;
  }
  unsigned long long int res = (b - a + 1000000007) % 1000000007;
  cout << res;
}
