#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
int binarySearch(int arr[], int l, int r, int x) {
  while (l <= r) {
    int m = l + (r - l) / 2;
    if (arr[m] == x) {
      return m;
    }
    if (arr[m] < x) {
      l = m + 1;
    } else {
      r = m - 1;
    }
  }
  return -1;
}
long long int binomialCoeff(long long int n, long long int k) {
  long long int res = 1, i;
  if (k > n - k) {
    k = n - k;
  }
  for (i = 0; i < k; ++i) {
    res *= (n - i);
    res /= (i + 1);
  }
  return res;
}
long long int power(long long int x, unsigned long long int y,
                    long long int p) {
  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 factorial(int n) { return (n == 1 || n == 0) ? 1 : n * factorial(n - 1); }
long long int modFact(long long int n, long long int p) {
  if (n >= p) return 0;
  long long int result = 1, i;
  for (i = 1; i <= n; i++) result = (result * i) % p;
  return result;
}
int main() {
  int t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    long long int ans = (modFact(n, 1000000007) - power(2, n - 1, 1000000007));
    if (ans >= 0) {
      cout << ans << endl;
    } else {
      cout << ans + 1000000007 << endl;
    }
  }
  return 0;
}
