# Sum

Very easy

Execution time limit is 1 second

Runtime memory usage limit is 128 megabytes

Roman’s parents gave him an undirected connected weighted graph with $n$ vertices and $n–1$ edges. Roman wants to know the sum of all the paths’ lengths in this graph. Let’s consider the path’s length as the sum of all the edges that lie on this path. Roman said that the path from $u$ to $v$ is the same as from $v$ to $u$, so he doesn’t distinguish them.

## Input

The first line contains the single integer number $n(2≤n≤10_{5})$ — the number of vertices in the graph. It is followed by $n–1$ lines containing the description of the edges. Every line of description consists of three integers: the vertices connected by the edge (labeled from $1$ to $n$) and the edge’s weight.

## Output

Print the sum of all the paths’ lengths in the given graph modulo $10_{9}$.

## Examples

Input #1

Answer #1

Input #2

Answer #2

Submissions 2K

Acceptance rate 36%