#include #include typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; using namespace std; using namespace atcoder; typedef pair pll; ll p = 998244353; ll INF = 2000000000000000010; template bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } void yn(bool a){ if(a){ cout << "Yes" <& a){ ll n = (ll)a.size(); vector b(n+1,0); for(ll i = 0;i= 0){ b[a[i]]++; } } for(ll i = 0;i two(64,1); void init() { std::cout << std::fixed << std::setprecision(10); for(ll i = 1;i<64;i++){ two.at(i) = two.at(i-1)*2; } } vector> vec_seki(const vector>& a,const vector>& b,ll p){ if(a.size() == 0){ return {}; } assert(a[0].size() == b.size()); assert(p != 0); vector> ans(a.size(),vector(b[0].size(),0)); for(ll i = 0;i<(ll)a.size();i++){ for(ll k = 0;k<(ll)a[0].size();k++){ for(ll j = 0;j<(ll)b[0].size();j++){ ans[i][j] = (ans[i][j]+a[i][k] * b[k][j])%p; } } } return ans; } template vector> runlength(const vector& vec){ vector> ret; if(vec.size()==0){ return ret; } pair temp; temp.first = vec[0]; temp.second = 1; ret.push_back(temp); T mae = vec[0]; for(ll i = 1;i<(ll)vec.size();i++){ if(vec[i] != mae){ temp.first = vec[i]; temp.second = 1; ret.push_back(temp); mae = vec[i]; } else{ ret[ret.size()-1].second++; } } return ret; } ll bintoll(const string& S){ ll ret = 0; ll n = (ll)S.size(); for(ll i = 0;i>= 1; } reverse(S.begin(),S.end()); return S; } int main() { init(); ll N,M; cin >> N>>M; vector> A(N,vector(N,0)); vector> B(N,vector(N,0)); vector> ans(N,vector(N,0)); vector> ans2(N,vector(N,0)); vector> ans3(N,vector(N,0)); vector num(N,0); for(ll i = 0;i> u >> v; u--;v--; A[u][v]=1; A[v][u]=1; num[u]++; num[v]++; } ll S,T,a,b; cin >> S >> T >> a >> b;a--;b--; for(ll i = 0;i>> dp(60,vector>(N,vector(N,0))); vector>> dp2(60,vector>(N,vector(N,0))); dp[0] =A; dp2[0]=B; for(ll i = 0;i<59;i++){ dp[i+1] = vec_seki(dp[i],dp[i],p); dp2[i+1] = vec_seki(dp2[i],dp2[i],p); } S--;T--; for(ll i = 0;i<60;i++){ if(S&(1LL<