"use strict";

function main(input){
  const args = input.trim().split('\n');
  const n = parseInt(args[0],10);
  const happiness = args.slice(1).map(_=>_.split(' ').map(_=>parseInt(_,10)));
  const dp = Array(n).fill(0).map(_=>Array(3).fill(0));
  dp[0][0] = happiness[0][0];
  dp[0][1] = happiness[0][1];
  dp[0][2] = happiness[0][2];
  
  for(let i=1; i<n; i++){
    dp[i][0] = Math.max(happiness[i][0] + dp[i-1][1], happiness[i][0] + dp[i-1][2]);
    dp[i][1] = Math.max(happiness[i][1] + dp[i-1][0], happiness[i][1] + dp[i-1][2]);
    dp[i][2] = Math.max(happiness[i][2] + dp[i-1][0], happiness[i][2] + dp[i-1][1]);
  }
  
  console.log(Math.max(dp[n-1][0],dp[n-1][1],dp[n-1][2]));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));  