#abc188e. [abc188_e]Peddler

[abc188_e]Peddler

Problem Statement

In Takahashi Kingdom, there are NN towns, called Town 11 through Town NN.
There are also MM roads in the kingdom, called Road 11 through Road MM. By traversing Road ii, you can travel from Town XiX_i to Town YiY_i, but not vice versa. Here, it is guaranteed that Xi<YiX_i < Y_i.
Gold is actively traded in this kingdom. At Town ii, you can buy or sell 11 kilogram of gold for AiA_i yen (the currency of Japan).

Takahashi, a traveling salesman, plans to buy 11 kilogram of gold at some town, traverse one or more roads, and sell 11 kilogram of gold at another town.
Find the maximum possible profit (that is, the selling price minus the buying price) in this plan.

Constraints

  • 2leNle2times1052 \\le N \\le 2 \\times 10^5
  • 1leMle2times1051 \\le M \\le 2 \\times 10^5
  • 1leAile1091 \\le A_i \\le 10^9
  • 1leXiltYileN1 \\le X_i \\lt Y_i \\le N
  • (Xi,Yi)neq(Xj,Yj)(ineqj)(X_i, Y_i) \\neq (X_j, Y_j) (i \\neq j)
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM A1A_1 A2A_2 A3A_3 dots\\dots ANA_N X1X_1 Y1Y_1 X2X_2 Y2Y_2 X3X_3 Y3Y_3 hspace15ptvdots\\hspace{15pt} \\vdots XMX_M YMY_M

Output

Print the answer.


Sample Input 1

4 3
2 3 1 5
2 4
1 2
1 3

Sample Output 1

3

We can achieve the profit of 33 yen, as follows:

  • At Town 11, buy one kilogram of gold for 22 yen.
  • Traverse Road 22 to get to Town 22.
  • Traverse Road 11 to get to Town 44.
  • At Town 44, sell one kilogram of gold for 55 yen.

Sample Input 2

5 5
13 8 3 15 18
2 4
1 2
4 5
2 3
1 3

Sample Output 2

10

We can achieve the profit of 1010 yen, as follows:

  • At Town 22, buy one kilogram of gold for 88 yen.
  • Traverse Road 11 to get to Town 44.
  • Traverse Road 33 to get to Town 55.
  • At Town 55, sell one kilogram of gold for 1818 yen.

Sample Input 3

3 1
1 100 1
2 3

Sample Output 3

-99

Note that we cannot sell gold at the town where we bought the gold, which means the answer may be negative.