Tanya wants to go on a journey across the cities of Berland. There are $n$ cities situated along the main railroad line of Berland, and these cities are numbered from $1$ to $n$. 

Tanya plans her journey as follows. First of all, she will choose some city $c_1$ to start her journey. She will visit it, and after that go to some other city $c_2 > c_1$, then to some other city $c_3 > c_2$, and so on, until she chooses to end her journey in some city $c_k > c_{k - 1}$. So, the sequence of visited cities $[c_1, c_2, \dots, c_k]$ should be strictly increasing.

There are some additional constraints on the sequence of cities Tanya visits. Each city $i$ has a beauty value $b_i$ associated with it. If there is only one city in Tanya's journey, these beauty values imply no additional constraints. But if there are multiple cities in the sequence, then for any pair of adjacent cities $c_i$ and $c_{i + 1}$, the condition $c_{i + 1} - c_i = b_{c_{i + 1}} - b_{c_i}$ must hold.

For example, if $n = 8$ and $b = [3, 4, 4, 6, 6, 7, 8, 9]$, there are several three possible ways to plan a journey:  $c = [1, 2, 4]$;  $c = [3, 5, 6, 8]$;  $c = [7]$ (a journey consisting of one city is also valid). 

There are some additional ways to plan a journey that are not listed above.

Tanya wants her journey to be as beautiful as possible. The beauty value of the whole journey is the sum of beauty values over all visited cities. Can you help her to choose the optimal plan, that is, to maximize the beauty value of the journey?


-----Input-----

The first line contains one integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of cities in Berland.

The second line contains $n$ integers $b_1$, $b_2$, ..., $b_n$ ($1 \le b_i \le 4 \cdot 10^5$), where $b_i$ is the beauty value of the $i$-th city.


-----Output-----

Print one integer — the maximum beauty of a journey Tanya can choose.


-----Examples-----
Input
6
10 7 1 9 10 15

Output
26

Input
1
400000

Output
400000

Input
7
8 9 26 11 12 29 14

Output
55



-----Note-----

The optimal journey plan in the first example is $c = [2, 4, 5]$.

The optimal journey plan in the second example is $c = [1]$.

The optimal journey plan in the third example is $c = [3, 6]$.

Difficulty: MEDIUM

Starter code:

Solutions:
n = int(input())
B = list(map(int, input().split()))
pp = {}
for i in range(n):
	if B[i] - (i + 1) not in pp:
		pp[B[i] - (i + 1)] = 0
	pp[B[i] - (i + 1)] += B[i]
ans = 0
for c in pp:
	ans = max(ans, pp[c])
print(ans)


from collections import Counter
ans = Counter()
input()
for (i, b) in enumerate(map(int, input().split())):
	ans[b - i] += b
print(max(ans.values()))


n = int(input())
A = list(map(int, input().split()))
B = [A[i] - (i + 1) for i in range(n)]
aaa = {}
i = 0
for key in B:
	aaa[key] = aaa.get(key, 0) + A[i]
	i += 1
print(max(aaa.values()))


n = int(input())
mas = list(map(int, input().split()))
ans = []
for i in range(n):
	ans.append([mas[i] - i, mas[i]])
ans.sort()
maxi = 0
p = -100000000
s = 0
for i in range(n):
	if ans[i][0] == p:
		s += ans[i][1]
	else:
		p = ans[i][0]
		maxi = max(maxi, s)
		s = ans[i][1]
maxi = max(maxi, s)
print(maxi)


n = int(input())
b = list(map(int, input().split()))
c = dict()
for i in range(n):
	bi = b[i]
	df = bi - (i + 1)
	c[df] = c.get(df, 0) + i + 1 + df
print(max(c.values()))


import sys

def input():
	return sys.stdin.readline()

def iinput():
	return int(input())

def rinput():
	return input().split()

def rlinput():
	return [int(i) for i in input().split()]

def main():
	n = iinput()
	b = rlinput()
	q = dict()
	for i in range(n):
		ind = i + 1 - b[i]
		if ind in q:
			q[ind] += b[i]
		else:
			q[ind] = b[i]
	res = 0
	for i in q:
		res = max(res, q[i])
	print(res)
for i in range(1):
	main()


n = int(input())
a = list(map(int, input().split()))
c = dict()
for i in range(len(a)):
	d = a[i] - i
	if d in c:
		c[d].append(a[i])
	else:
		c[d] = [a[i]]
ans = 0
for i in c:
	ans_p = 0
	for j in c[i]:
		ans_p += j
	ans = max(ans, ans_p)
print(ans)


from math import *
import sys
from queue import *
n = int(input())
a = list(map(int, input().split()))
d = {}
mx = 0
for i in range(n):
	d[a[i] - i] = d.get(a[i] - i, 0) + a[i]
	mx = max(mx, d[a[i] - i])
print(mx)


n = int(input())
b = list(map(int, input().split()))
d = {}
ans = 0
for i in range(n):
	diff = b[i] - i
	if diff not in d:
		d[diff] = 0
	d[diff] += b[i]
	ans = max(ans, d[diff])
print(ans)


import sys
input = lambda : sys.stdin.readline().strip()
n = int(input())
a = list(map(lambda x: (x[0] - x[1], x[1]), enumerate(map(int, input().split()))))
s = {}
for (i, v) in a:
	if i in s:
		s[i] += v
	else:
		s[i] = v
print(max(s.values()))


n = int(input())
a = list(map(int, input().split()))
d = dict()
for i in range(n):
	d[a[i] - i] = 0
maxi = 0
for i in range(n):
	d[a[i] - i] += a[i]
	if d[a[i] - i] > maxi:
		maxi = d[a[i] - i]
print(maxi)


n = int(input())
ar = list(map(int, input().split()))
lol = dict()
kek = set()
ahah = []
for i in range(n):
	if ar[i] - i in kek:
		ahah.append(sorted([i, lol[ar[i] - i]]))
	lol[ar[i] - i] = i
	kek.add(ar[i] - i)
ahah.sort()
A = [[] for _ in range(n)]
for (a, b) in ahah:
	A[b].append(a)
dp = [ar[i] for i in range(n)]
for i in range(n):
	for elem in A[i]:
		dp[i] = max(dp[i], dp[elem] + dp[i])
print(max(dp))


n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
	b.append([i - a[i], i])
b.sort()
comp = []
now = [b[0][1]]
for i in range(1, n):
	if b[i - 1][0] == b[i][0]:
		now.append(b[i][1])
	else:
		comp.append(now)
		now = [b[i][1]]
comp.append(now)
ans = 0
for i in range(len(comp)):
	now = 0
	for elem in comp[i]:
		now += a[elem]
	ans = max(ans, now)
print(ans)


n = int(input())
line = list(map(int, input().split()))
for i in range(n):
	line[i] -= i
cou = dict()
for i in range(n):
	if line[i] in cou:
		cou[line[i]].append(i)
	else:
		cou[line[i]] = [i]
ans = -1
for i in cou:
	t_ans = i * len(cou[i])
	for el in cou[i]:
		t_ans += el
	ans = max(ans, t_ans)
print(ans)