John likes amusement parks. He goes every weekend and plays a different game. This weekend he found a hard one, a target shooting game.
The n targets stand in a row along a straight line, numbered from 1 to n from right to left. John picks the targets he wants to shoot, and every target he picks scores points. The score of target i depends on how many of its neighbors, target i−1 and target i+1, John picked as well.
Target 1 and target n have a single neighbor each, so they never have two picked neighbors. A target John does not pick scores nothing. Find the largest total score John can reach.
The first line contains the number of targets n. (n<1000000)
Each of the next n lines contains the values ai, bi, and ci of target i, separated by spaces, in order from i=1 to i=n. (0≤ai,bi,ci≤1000)
Print the maximum number of points John can win on a single line.
The input is always well formed, and the file ends right after the last target. One input holds exactly one set of targets. Print the result to standard output from the beginning of a line.