#include #include #include using namespace std; using namespace atcoder; #define rep(i, l, n) for (int i = (l); i < (n); i++) #define max(p, q) ((p) > (q) ? (p) : (q)) #define min(p, q) ((p) < (q) ? (p) : (q)) #define all(x) x.begin(), x.end() #define fi first #define se second #define lb lower_bound; #define ub upper_bound; #define lbi(A, x) (ll)(lb(all(A), x) - A.begin()) #define ubi(A, x) (ll)(ub(all(A), x) - A.begin()) using ll = long long; using P = pair; template using V = vector; template using VV = V >; template const ll INF = 1000000000000000001; const int inf = 1001001001; const ll mod = 1000000007; const ll MOD = 998244353; inline V dtois(string& s) { V vec = {}; for (auto& e : s) { vec.push_back(e - '0'); } return vec; } VV matrix_prod(const VV& A, const VV& B) { int ac = A.size(); int al = A[0].size(); int bc = B.size(); int bl = B[0].size(); VV res(ac, V(bl)); rep(i, 0, ac) { rep(j, 0, bl) { rep(k, 0, al) { res[i][j] += A[i][k] * B[k][j]; res[i][j] %= MOD; } } } return res; } VV matrix_exp(VVA, ll n) { int ac = A.size(); VV res(ac, V(ac)); rep(i, 0, ac) { res[i][i] = 1; } while (n) { if (n & 1) { res = matrix_prod(A, res); } A = matrix_prod(A, A); n >>= 1; } return res; } int main(void) { ll n, m, t; cin >> n >> m >> t; VV A(n, V(n)); rep(i, 0, m) { int a, b; cin >> a >> b; A[a][b] = A[b][a] = 1; } VV dp(n, V(1)); dp[0][0] = 1; dp = matrix_prod(matrix_exp(A, t), dp); cout << dp[0][0] << endl; return 0; }