#include <cstdio>
#include <algorithm>
using namespace std;

const int MAXN = 50;
const int MAXM = 100;
const int MOD = int(1E9) + 7;

int pow_mod(int b, int p) {
	int ret = 1;
	while( p ) {
		if( p & 1 ) ret = 1LL*ret*b%MOD;
		b = 1LL*b*b%MOD;
		p >>= 1;
	}
	return ret;
}

int N, M, K;

int s[MAXM + 5][MAXM + 5], fct[MAXM + 5];
void init() {
	s[0][0] = 1;
	for(int i=1;i<=MAXM;i++)
		for(int j=1;j<=i;j++)
			s[i][j] = (s[i-1][j-1] + 1LL*(i-1)*s[i-1][j]%MOD) % MOD;
	fct[0] = 1;
	for(int i=1;i<=MAXM;i++)
		fct[i] = 1LL*fct[i-1]*i%MOD;
}

struct edge{
	int to; edge *nxt;
}edges[2*MAXM + 5], *adj[MAXM + 5], *ecnt = edges;
void addedge(int u, int v) {
	edge *p = (++ecnt);
	p->to = v, p->nxt = adj[u], adj[u] = p;
	p = (++ecnt);
	p->to = u, p->nxt = adj[v], adj[v] = p;
}

int f[2][MAXM + 5];
void copy() {
	for(int i=0;i<=M;i++)
		f[1][i] = f[0][i], f[0][i] = 0;
}
void update(int x, int k) {
	for(int i=x;i<=M;i++)
		f[0][i] = (f[0][i] + 1LL*f[1][i-x]*k%MOD)%MOD;
}

int gcd(int x, int y) {
	return y == 0 ? x : gcd(y, x % y);
}

int dfn[MAXM + 5], low[MAXM + 5], dcnt;
int stk[MAXM + 5], Gsiz, tp;
void dfs(int x, int fa) {
	dfn[x] = low[x] = (++dcnt);
	for(edge *p=adj[x];p;p=p->nxt) {
		if( p->to == fa ) continue;
		if( !dfn[p->to] ) {
			stk[++tp] = p->to, dfs(p->to, x);
			if( low[p->to] >= dfn[x] ) {
				int cnt = 0, tot = 0;
				do {
					if( stk[tp] == -1 ) cnt++;
					tot++;
				}while( stk[tp--] != p->to );
				copy();
				if( cnt == 0 ) update(1, 1);
				else if( cnt == 1 ) {
					for(int i=1;i<=tot;i++)
						update(gcd(tot, i), 1);
					Gsiz = 1LL*Gsiz*tot%MOD;
				}
				else {
					for(int i=1;i<=tot;i++)
						update(i, s[tot][i]);
					Gsiz = 1LL*Gsiz*fct[tot]%MOD;
				}
			}
			low[x] = min(low[x], low[p->to]);
		}
		else {
			low[x] = min(low[x], dfn[p->to]);
			if( dfn[p->to] < dfn[x] )
				stk[++tp] = -1;
		}
	}
}
int main() {
	init(), scanf("%d%d%d", &N, &M, &K);
	for(int i=1;i<=M;i++) {
		int u, v; scanf("%d%d", &u, &v);
		addedge(u, v);
	}
	Gsiz = f[0][0] = 1;
	for(int i=1;i<=N;i++)
		if( !dfn[i] ) dfs(i, 0);
	int ans = 0;
	for(int i=0,t=1;i<=M;i++,t=1LL*t*K%MOD)
		ans = (ans + 1LL*t*f[0][i]%MOD) % MOD;
	printf("%lld\n", 1LL*ans*pow_mod(Gsiz, MOD-2)%MOD);
}