Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
F. Vasya and Maximum Matching

time limit per test

3 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputVasya has got a tree consisting of $$$n$$$ vertices. He wants to delete some (possibly zero) edges in this tree such that the maximum matching in the resulting graph is unique. He asks you to calculate the number of ways to choose a set of edges to remove.

A matching in the graph is a subset of its edges such that there is no vertex incident to two (or more) edges from the subset. A maximum matching is a matching such that the number of edges in the subset is maximum possible among all matchings in this graph.

Since the answer may be large, output it modulo $$$998244353$$$.

Input

The first line contains one integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) — the number of vertices in the tree.

Each of the next $$$n − 1$$$ lines contains two integers $$$u$$$ and $$$v$$$ ($$$1 \le u, v \le n, u \neq v$$$) denoting an edge between vertex $$$u$$$ and vertex $$$v$$$. It is guaranteed that these edges form a tree.

Output

Print one integer — the number of ways to delete some (possibly empty) subset of edges so that the maximum matching in the resulting graph is unique. Print the answer modulo $$$998244353$$$.

Examples

Input

4

1 2

1 3

1 4

Output

4

Input

4

1 2

2 3

3 4

Output

6

Input

1

Output

1

Note

Possible ways to delete edges in the first example:

- delete $$$(1, 2)$$$ and $$$(1, 3)$$$.
- delete $$$(1, 2)$$$ and $$$(1, 4)$$$.
- delete $$$(1, 3)$$$ and $$$(1, 4)$$$.
- delete all edges.

Possible ways to delete edges in the second example:

- delete no edges.
- delete $$$(1, 2)$$$ and $$$(2, 3)$$$.
- delete $$$(1, 2)$$$ and $$$(3, 4)$$$.
- delete $$$(2, 3)$$$ and $$$(3, 4)$$$.
- delete $$$(2, 3)$$$.
- delete all edges.

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/01/2021 04:33:03 (j1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|