#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int mod = 1e9 + 7;
int dp[3][100][100];
constexpr ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int N, M, K;
	cin >> N >> M >> K;
	int A[100];
	rep(i, N) {
		cin >> A[i];
	}
	rep(i, N) dp[0][i][i] = 1;
	rep(i, N) dp[1][i][i] = 1;
	int are = modpow(2 * M, mod - 2);

	rep(i, M) {
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		(dp[0][x][x] += mod - are) %= mod;
		(dp[0][x][y] += are) %= mod;
		(dp[0][y][x] += are) %= mod;
		(dp[0][y][y] += mod - are) %= mod;
	}

	rep(i, 30) {
		rep(x, N) rep(y, N) {
			ll tmp = 0;
			rep(z, N) {
				tmp += dp[1][x][z] * (ll)dp[1][z][y] % mod;
			}
			dp[2][x][y] = tmp % mod;
		}
		rep(x, N) rep(y, N) dp[1][x][y] = dp[2][x][y];

		if (K >> 29 - i & 1) {
			rep(x, N) rep(y, N) {
				ll tmp = 0;
				rep(z, N) {
					tmp += dp[1][x][z] * (ll)dp[0][z][y] % mod;
				}
				dp[2][x][y] = tmp % mod;
			}
			rep(x, N) rep(y, N) dp[1][x][y] = dp[2][x][y];
		}
	}

	rep(i, N) {
		ll kotae = 0;
		rep(j, N) kotae += (ll)dp[1][i][j] * A[j] % mod;
		co(kotae % mod);
	}


	Would you please return 0;
}
#include <bits/stdc++.h>
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define ALL(v) (v).begin(), (v).end()
#define LLA(v) (v).rbegin(), (v).rend()
#define SZ(v) (v).size()
#define INT(...)                                                               \
    int __VA_ARGS__;                                                           \
    read(__VA_ARGS__)
#define LL(...)                                                                \
    ll __VA_ARGS__;                                                            \
    read(__VA_ARGS__)
#define DOUBLE(...)                                                            \
    double __VA_ARGS__;                                                        \
    read(__VA_ARGS__)
#define CHAR(...)                                                              \
    char __VA_ARGS__;                                                          \
    read(__VA_ARGS__)
#define STRING(...)                                                            \
    string __VA_ARGS__;                                                        \
    read(__VA_ARGS__)
#define VEC(type, name, size)                                                  \
    vector<type> name(size);                                                   \
    read(name)
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
template <typename T> struct edge {
    int to;
    T cost;
    edge(int t, T c) : to(t), cost(c) {}
};
template <typename T> using WGraph = vector<vector<edge<T>>>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;
template <class T> inline vector<T> make_vec(size_t a, T val) {
    return vector<T>(a, val);
}
template <class... Ts> inline auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec(ts...))>(a, make_vec(ts...));
}

void read() {}
template <class T> inline void read(T &a) { cin >> a; }
template <class T, class S> inline void read(pair<T, S> &p) {
    read(p.first), read(p.second);
}
template <class T> inline void read(vector<T> &v) {
    for(auto &a : v)
        read(a);
}
template <class Head, class... Tail>
inline void read(Head &head, Tail &...tail) {
    read(head), read(tail...);
}
template <class T> inline void chmax(T &a, T b) { (a < b ? a = b : a); }
template <class T> inline void chmin(T &a, T b) { (a > b ? a = b : a); }

ll pow10(int a) {
    ll ret = 1;
    rep(i, a) ret *= 10;
    return ret;
}

ll calc(map<int, int> mp) {
    ll res = 0;
    for(int i = 1; i <= 9; i++) {
        res += i * pow10(mp[i]);
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    LL(K);
    STRING(s, t);
    map<int, int> smp, tmp;
    rep(i, 4) {
        smp[s[i] - '0']++;
        tmp[t[i] - '0']++;
    }
    ll all = 0, win = 0;
    vector<int> used(10);
    for(int i = 1; i <= 9; i++) {
        used[i] = smp[i] + tmp[i];
    }
    for(int i = 1; i <= 9; i++) {
        for(int j = 1; j <= 9; j++) {
            auto smp2 = smp, tmp2 = tmp;
            smp2[i]++, tmp2[j]++;
            bool ok = 1;
            for(int k = 1; k <= 9; k++) {
                if(smp2[k] + tmp2[k] > K)
                    ok = 0;
            }
            if(ok) {
                all += (K - used[i]) * (K - used[j] - (i == j));
                ll ssc = calc(smp2), tsc = calc(tmp2);
                if(ssc > tsc) {
                    win += (K - used[i]) * (K - used[j] - (i == j));
                }
            }
        }
    }
    cout << fixed << setprecision(15) << (double)win / (double)all << endl;
}