# Vin (Abriged Version of Vines)
###### tags: `cp`
> Zanite
There are $T$ trees in a forest, numbered from $1$ to $T$. The $i^\text{th}$ tree is located at $(x_i, y_i)$ and has $g_i$ gold bars on top of it. (If it has no gold on top of it, then $g_i = 0$.)
There exist $V$ two-way vines, numbered from $1$ to $V$. The $i^\text{th}$ vine allows one to navigate between trees $u_i$ and $v_i$ without stepping on the ground.
You will take a trip through the forest starting and ending at the same tree. During the trip, one of the following statements must always be true.
- You are touching the ground and you can look in such a way that there is no tree visible in your $180^\circ$ field of vision, not including the tree(s) located exactly to your left or right.
- You are touching a tree. (This includes standing on a tree and using a vine.)
Find the maximum number of gold bars you can get from one such trip and the minimum distance you need to walk on the ground in that trip.
## Input Format
<pre>
T
x<sub>1</sub> y<sub>1</sub> g<sub>1</sub>
x<sub>2</sub> y<sub>2</sub> g<sub>2</sub>
x<sub>3</sub> y<sub>3</sub> g<sub>3</sub>
⋮
x<sub>T</sub> y<sub>T</sub> g<sub>T</sub>
V
u<sub>1</sub> y<sub>1</sub>
u<sub>2</sub> y<sub>2</sub>
u<sub>3</sub> y<sub>3</sub>
⋮
u<sub>V</sub> y<sub>V</sub>
</pre>
## Output Format
Output two integers, separated by a space, in a single line: the maximum number of gold bars you can get from one trip and the minimum distance you need to walk on the ground in that trip.
Your answer will be considered correct if its absolute or relative error does not exceed $10^{-6}$.
## Constraints
- $1 \leq T \leq 10^6$
- $0 \leq x_i, y_i, g_i \leq 10^9$ for $1 \leq i \leq T$
- $0 \leq V \leq \min \left(10^6, \frac{1}{2}T(T-1) \right)$
- $1 \leq u_i, v_i \leq T$ for $1 \leq i \leq V$
- $u_i \neq v_i$ for $1 \leq i \leq V$