#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repr(i, 0, n) #define INF 2e9 #define MOD 1000000007 //#define MOD 998244353 #define LINF (long long)4e18 #define jck 3.141592 const double EPS = 1e-10; using ll = long long; using Pi = pair; using Pl = pair; struct Combination{ vector _fac,_finv,_inv; const int m = MOD; Combination(int sz) : _fac(sz),_finv(sz),_inv(sz){ _fac[0] = _fac[1] = 1; _finv[0] = _finv[1] = 1; _inv[1] = 1; for(int i = 2; i <= sz; i++){ _fac[i] = _fac[i-1]*i%m; _inv[i] = m-_inv[m%i]*(m/i)%m; _finv[i] = _finv[i-1]*_inv[i]%m; } } inline long long fac(int n){return _fac[n];} inline long long inv(int n){return _inv[n];} inline long long finv(int n){return _finv[n];} long long comb(int n,int k){ if(n < k) return 0; if(n < 0 || k < 0) return 0; return _fac[n]*(_finv[k]*_finv[n-k]%m)%m; } }; int n; vector> G; ll ans = 0; Combination C(300000); void dfs(int u,int p,int depth){ ans += C.comb(n,depth+1)*C.fac(depth)%MOD*C.fac(n-depth-1)%MOD; ans %= MOD; for(int v : G[u]){ if(v == p) continue; dfs(v,u,depth+1); } } int main(){ cin >> n; G.resize(n); rep(i,n-1){ int u,v; cin >> u >> v; u--; v--; G[u].push_back(v); G[v].push_back(u); } dfs(0,-1,0); cout << ans << endl; }