# [bzoj4011] [HNOI2015]落忆枫音

## Sample Input

4 4 4 3
1 2
1 3
2 4
3 2


## Sample Output

3


## Solution

$\prod_{i=2}^{n}deg_i$

$\prod_{i=2}^ndeg_i-\sum\prod_{i\notin circle} deg_i$

$\cfrac{\prod_{i=2}^{n}deg_i}{\prod_{i\in circle}deg_i}$

$g(u)=\cfrac{\sum_{(u,v)\in E}g(v)}{deg_u}$

$\prod_{i=2}^ndeg_i-g(y)$

#include<bits/stdc++.h>
using namespace std;

x=0;int f=1;char ch=getchar();
for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}

void print(int x) {
if(x<0) putchar('-'),x=-x;
if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

const int maxn = 2e5+10;
const int mod = 1e9+7;

struct edge{int to,nxt;}e[maxn<<1];

void dfs(int u) {
if(vis[u]) return ;vis[u]=1;
if(u==x) return g[u]=1ll*ans*inv[deg[u]]%mod,void();
dfs(e[i].to),g[u]=(g[u]+g[e[i].to])%mod;
g[u]=1ll*g[u]*inv[deg[u]]%mod;
}

int main() {
inv[1]=1;
for(int i=2;i<maxn;i++) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;