Treasures N (1 <= N <= 1,000) treasures have been buried and can be dug out to earn money. While digging is expensive, finding a treasure can create tremendous profit (after expenses are subtracted from the treasure's value). Create a program to compute the maximum profit possible from a set of buried treasures. The treasures each have value Pi (1 <= Pi <= 1,000,000) and are buried on a two-dimensional grid split into squares, each with coordinates Xi,Yi (-10,000 <= Xi <= 10,000 and -10,000 <= Yi < 0). Digging the square with coordinates (x, y) is permitted only if y = -1 or if the three squares with coordinates (x-1, y+1), (x, y+1) and (x+1, y+1) have already been dug. The cost for digging a square is 1. When a treasure is dug out, its value is considered earned. Determine the maximum possible profit by digging the optimal number of treasures (which might be 0). PROBLEM NAME: treasures INPUT FORMAT: * Line 1: The single integer N * Lines 2..N+1: Line i+1 contains three space-separated integers: Xi, Yi, and Pi. SAMPLE INPUT: 2 7 -2 9 8 -10 20 OUTPUT FORMAT: * Line 1: A single integer that is the maximum achievable profit SAMPLE OUTPUT: 5