var inputRaw = require('fs').readFileSync('/dev/stdin', 'utf8')
var rows = inputRaw.trim().split('\n');
var N = Number(rows[0]);
var list = rows.slice(1).map(r => r.split(' ').map(Number));
var dp = Array.from({ length: N }, _ => Array(3).fill(0));

function solve() {
  dp[0] = [list[0][0], list[0][1], list[0][2]];

  for (var i = 1; i < N; i++) {
    dp[i] = [list[i][0], list[i][1], list[i][2]];
    dp[i][0] = Math.max(dp[i - 1][1], dp[i - 1][2]) + list[i][0];
    dp[i][1] = Math.max(dp[i - 1][0], dp[i - 1][2]) + list[i][1];
    dp[i][2] = Math.max(dp[i - 1][0], dp[i - 1][1]) + list[i][2];
  }
  return Math.max.apply(null, dp[N - 1]);
}

console.log(solve());
