Kefa decided to make some money doing business on the Internet for exactly *n* days. He knows that on the *i*-th day (1 ≤ *i* ≤ *n*) he makes *a*<sub class="lower-index">*i*</sub> money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence *a*<sub class="lower-index">*i*</sub>. Let us remind you that the subsegment of the sequence is its continuous fragment. A subsegment of numbers is called non-decreasing if all numbers in it follow in the non-decreasing order.

Help Kefa cope with this task!
The first line contains integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>).

The second line contains *n* integers *a*<sub class="lower-index">1</sub>,  *a*<sub class="lower-index">2</sub>,  ...,  *a*<sub class="lower-index">*n*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>).
n, m, k= list(map(int, input().split()))
dishes=list(map(int, input().split()))
rules=[[0]*n for i in range(n)]
for i in range(k):
    a, b, pt=list(map(int, input().split()))
    a-=1
    b-=1
    rules[a][b]=pt

def solve(qtd=0, mask=0, last=0):
    if qtd==m: return 0
    resposta=0
    for i in range(n):
        if (( mask >> i) & 1 ): continue
        temp= solve(qtd+1, mask | (1<<i ), i)+dishes[i]+rules[last][i]
        resposta=max(resposta,temp)

    return resposta

respostas=0
for i in range(n):
    respostas=max(respostas, solve(1,  1<<i , i)+dishes[i])
print(respostas)