function Main(input) {
  let tmp = input.split("\n");
  tmp.shift();
  let vacations = tmp.map(element => element.split(' ').map(elm => parseInt(elm, 10)));
  let dp = [0, 0, 0];
  for (let day = 0; day < vacations.length; day++) {
    let vacation = vacations[day];
    let new_dp = [0, 0, 0];
    for (let i = 0; i < 3; i++) {
      for(let j = 0; j < 3; j++) {
        if (i !== j) {
           new_dp[j] = Math.max(new_dp[j], dp[i] + vacation[j]);
        }
      }
    }
    dp = new_dp;
  }
  console.log(Math.max(dp[0], dp[1], dp[2]));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
