#include using namespace std; using ll=long long; using pii=pair; #define all(a) a.begin(),a.end() #define pb push_back #define sz(a) ((int)a.size()) const int N=100005,mod=998244353; int add(int x, int y){x+=y; if(x>=mod) x-=mod; return x;} int sub(int x, int y){x-=y; if(x<0) x+=mod; return x;} int mul(int x, int y){return ((ll)x)*y%mod;} int Pow(int x, ll y=mod-2){int res=1; for(; y; x=mul(x,x),y>>=1) if(y&1) res=mul(res,x); return res;} int n,a[N],b[N],dp[N][2]; vector adj[N]; void dfs(int u, int fa){ for(auto v: adj[u]) if(v!=fa) dfs(v,u); dp[u][0]=dp[u][1]=0; dp[u][b[u]]=1; for(auto v: adj[u]) if(v!=fa){ int nw[2]{}; nw[0]=add(mul(dp[u][0],dp[v][0]),mul(dp[u][1],dp[v][1])); nw[1]=add(mul(dp[u][0],dp[v][1]),mul(dp[u][1],dp[v][0])); for(int i: {0,1}) nw[i]=add(nw[i],mul(dp[u][i],dp[v][1])); for(int i: {0,1}) dp[u][i]=nw[i]; } } signed main(){ ios_base::sync_with_stdio(0),cin.tie(0); cin >> n; for(int i=0; i> u >> v; u--,v--; adj[u].pb(v),adj[v].pb(u); } for(int i=0; i> a[i]; int res=0; for(int j=0; j<30; ++j){ for(int i=0; i>j&1; dfs(0,-1); res=add(res,mul(1<