#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; const int MOD=998244353; vector G[100100]; ll dp[100100][2]; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); vector B(30); B[0]=1; rep(i,29) B[i+1]=B[i]*2%MOD; int n; cin>>n; rep(i,n-1){ int u,v; cin>>u>>v; u--,v--; G[u].push_back(v); G[v].push_back(u); } vector A(n); rep(i,n) cin>>A[i]; auto f=[&](auto f,int v,int p,int i)->void{ int cnt=0; for(auto nv:G[v]){ if(nv==p) continue; cnt++; } if(A[v]&(1LL<