hasan-and-trip-1_13703
Hasan has finally finished his final exams and he decided to go in a trip among cities in Syria.

There are N cities in Syria and they are numbered from 1 to N, each city has coordinates on plane, i-th city is in (Xi, Yi).

Hasan is in first city and he wants to visit some cities by his car in the trip but the final destination should be N-th city and the sequence of cities he will visit should be increasing in index (i.e. if he is in city i he can move to city j if and only if i < j ).

Visiting i-th city will increase Hasan's happiness by  Fi units (including first and last cities), also Hasan doesn't like traveling too much, so his happiness will decrease by total distance traveled by him.

Help Hasan by choosing a sequence of cities to visit which maximizes his happiness.

Input format:

First line contain integer  N.
Next N lines contains three integers each, i-th line contains coordinates of i-th city Xi, Yi and Fi. 

Output format:

Output one number rounded to 6 digits after floating point, the maximum possible happiness Hasan can get.

Constraints:
1 ≤ N ≤ 3,000
0 ≤ Xi, Yi, Fi ≤ 100,000

SAMPLE INPUT
3
0 0 1
3 1 1
6 0 9

SAMPLE OUTPUT
4.675445
def d(x,y):
    return ((x[0]-y[0])**2+(x[1]-y[1])**2)**0.5
n=int(raw_input())
l=[]
for i in xrange(n):
    i,j,k=map(int,raw_input().split())
    l.append((i,j,k))
dp=[-2494444444444]*(n+1)
#F=0
#L=n-1
dp[0]=l[0][2]
for i in xrange(1,n):
    for j in xrange(0,i):
        dp[i]=max(dp[i],dp[j]-d(l[i],l[j]))
    #print l[i][2]
    dp[i]+=l[i][2]
print "%.6f"%dp[n-1]