local mod = 998244353 local mfl = math.floor local function bmul(x, y) local x0, y0 = x % 31596, y % 31596 local x1, y1 = mfl(x / 31596), mfl(y / 31596) return (x1 * y1 * 62863 + (x1 * y0 + x0 * y1) * 31596 + x0 * y0) % mod end local function badd(x, y) return (x + y) % mod end local function bsub(x, y) return (x + mod - y) % mod end local function modpow(src, pow) local res = 1 while 0 < pow do if pow % 2 == 1 then res = bmul(res, src) pow = pow - 1 end src = bmul(src, src) pow = mfl(pow / 2) end return res end local function modinv(src) return modpow(src, mod - 2) end local n = io.read("*n") local edge = {} local parent = {} local childask = {} local childcnt = {} for i = 1, n do edge[i] = {} parent[i] = 0 childask[i] = 0 childcnt[i] = 0 end local ea, eb, ec = {}, {}, {} for i = 1, n - 1 do local a, b = io.read("*n", "*n") ea[i] = a eb[i] = b table.insert(edge[a], b) table.insert(edge[b], a) end local tasks = {1} for i = 1, n do local src = tasks[i] for j = 1, #edge[src] do local dst = edge[src][j] if parent[src] ~= dst then parent[dst] = src table.insert(tasks, dst) childask[src] = childask[src] + 1 end end end tasks = {} for i = 2, n do if childask[i] == 0 then table.insert(tasks, i) end end local ret = 0 for i = 1, n do local src = tasks[i] for j = 1, #edge[src] do local child = edge[src][j] if child ~= parent[src] then local a = childcnt[child] + 1 local b = n - a local numer = badd(bmul(a, a - 1), bmul(b, b - 1)) local denom = badd(numer, bmul(2 * a, b)) ret = badd(ret, bmul(numer, modinv(denom))) end end local p = parent[src] if 0 < p then childask[p] = childask[p] - 1 childcnt[p] = childcnt[p] + 1 + childcnt[src] if childask[p] == 0 then table.insert(tasks, p) end end end ret = bmul(ret, modinv(n - 1)) print(ret)