'use strict';
console.log(function(args){
  const tmp = args.trim().split('\n').map( r=>r.split(' ').map(v=>v|0) );
  const N = tmp.shift()[0];
  const h = tmp;
  const dp = [[0,0,0]];
  for ( let i = 0; i < N; i++ ) {
    dp.push([0,0,0]);
    for ( let j = 0; j < 3; j++ ) {
      for ( let k = 0; k < 3; k++ ) {
        if ( j === k ) continue;
        const happy = h[i][j] + dp[i][k];
        if ( dp[i+1][j] < happy ) dp[i+1][j] = happy;
      }
    }
  }
  return Math.max(...dp[N]).toString();
}(require('fs').readFileSync('/dev/stdin', 'utf8')));
