#define _USE_MATH_DEFINES #include using namespace std; //template #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define ALL(v) (v).begin(),(v).end() typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12; templateinline bool chmax(T& a,T b){if(ainline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} //end const int mod=1000000007; const int d=100000000; int pre[]={ 1, 927880474, 933245637, 668123525, 429277690, 733333339, 724464507, 957939114, 203191898, 586445753, 698611116}; int main(){ string n; cin>>n; if(n.size()>10 or (n.size()==10&&n>"1000000007"))puts("0"); else{ ll m=stoi(n)-1,res=pre[m/d]; rep(x,m/d*d+1,m+1)res=(1LL*res*x)%mod; if(m%2==1)res=(mod-res)%mod; cout<