The Fair Nut is going to travel to the Tree Country, in which there are $n$ cities. Most of the land of this country is covered by forest. Furthermore, the local road system forms a tree (connected graph without cycles). Nut wants to rent a car in the city $u$ and go by a simple path to city $v$. He hasn't determined the path, so it's time to do it. Note that chosen path can consist of only one vertex.

A filling station is located in every city. Because of strange law, Nut can buy only $w_i$ liters of gasoline in the $i$-th city. We can assume, that he has infinite money. Each road has a length, and as soon as Nut drives through this road, the amount of gasoline decreases by length. Of course, Nut can't choose a path, which consists of roads, where he runs out of gasoline. He can buy gasoline in every visited city, even in the first and the last.

He also wants to find the maximum amount of gasoline that he can have at the end of the path. Help him: count it.


-----Input-----

The first line contains a single integer $n$ ($1 \leq n \leq 3 \cdot 10^5$) — the number of cities.

The second line contains $n$ integers $w_1, w_2, \ldots, w_n$ ($0 \leq w_{i} \leq 10^9$) — the maximum amounts of liters of gasoline that Nut can buy in cities.

Each of the next $n - 1$ lines describes road and contains three integers $u$, $v$, $c$ ($1 \leq u, v \leq n$, $1 \leq c \leq 10^9$, $u \ne v$), where $u$ and $v$ — cities that are connected by this road and $c$ — its length.

It is guaranteed that graph of road connectivity is a tree.


-----Output-----

Print one number — the maximum amount of gasoline that he can have at the end of the path.


-----Examples-----
Input
3
1 3 3
1 2 2
1 3 2

Output
3

Input
5
6 3 2 5 0
1 2 10
2 3 3
2 4 1
1 5 1

Output
7



-----Note-----

The optimal way in the first example is $2 \to 1 \to 3$.  [Image] 

The optimal way in the second example is $2 \to 4$.  [Image]

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'import sys\nreadline = sys.stdin.readline\n\nfrom collections import Counter \n\ndef getpar(Edge, p):\n    N = len(Edge)\n    par = [0]*N\n    par[0] = -1\n    par[p]  -1\n    stack = [p]\n    visited = set([p])\n    while stack:\n        vn = stack.pop()\n        for vf in Edge[vn]:\n            if vf in visited:\n                continue\n            visited.add(vf)\n            par[vf] = vn\n            stack.append(vf)\n    return par\n\ndef topological_sort_tree(E, r):\n    Q = [r]\n    L = []\n    visited = set([r])\n    while Q:\n        vn = Q.pop()\n        L.append(vn)\n        for vf in E[vn]:\n            if vf not in visited:\n                visited.add(vf)\n                Q.append(vf)\n    return L\n\ndef getcld(p):\n    res = [[] for _ in range(len(p))]\n    for i, v in enumerate(p[1:], 1):\n        res[v].append(i)\n    return res\n\n\n        \n\nN = int(readline())\nWe = list(map(int, readline().split()))\nEdge = [[] for _ in range(N)]\nCost = Counter()\ngeta = N+1\nfor _ in range(N-1):\n    a, b, c = list(map(int, readline().split()))\n    a -= 1\n    b -= 1\n    Edge[a].append(b)\n    Edge[b].append(a)\n    Cost[b*geta+a] = c\n    Cost[a*geta+b] = c\nP = getpar(Edge, 0)\nL = topological_sort_tree(Edge, 0)\nC = getcld(P)\n\n\ndp = [0]*N\ncandi = [[0, 0] for _ in range(N)]\nans = 0\nfor l in L[::-1][:-1]:\n    dp[l] += We[l]\n    p = P[l]\n    k = dp[l] - Cost[l*geta + p]\n    if k > 0:\n        dp[p] = max(dp[p], k)\n        candi[p].append(k)\n    \n    res = max(candi[l])\n    candi[l].remove(res)\n    ans = max(ans, We[l] + res + max(candi[l]))\n\nres = max(candi[0])\ncandi[0].remove(res)\nans = max(ans, We[0] + res + max(candi[0]))\nprint(ans) \n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 15123