YJJ is a salesman who has traveled through western country. YJJ is always on journey. Either is he at the destination, or on the way to destination.
One day, he is going to travel from city A to southeastern city B. Let us assume that A is $(0, 0)$ on the rectangle map and B $(10^9, 10^9)$. YJJ is so busy so he never turn back or go twice the same way, he will only move to east, south or southeast, which means, if YJJ is at $(x, y)$ now $(0\le x\le 10^9,0\le y\le 10^9)$, he will only forward to $(x+1,y)$, $(x,y+1)$ or $(x+1,y+1)$.
On the rectangle map from $(0,0)$ to $(10^9,10^9)$, there are several villages scattering on the map. Villagers will do business deals with salesmen from northwestern, but not northern or western. In mathematical language, this means when there is a village $k$ on $(x_k, y_k)$ $(1\le x_k\le10^9, 1\le y_k\le10^9)$, only the one who was from $(x_k-1,y_k-1)$ to $(x_k,y_k)$ will be able to earn $v_k$ dollars.(YJJ may get different number of dollars from different village.)
YJJ has no time to plan the path, can you help him to find maximum of dollars YJJ can get.