'use strict'
const lines = require('fs').readFileSync(0, 'utf8').split('\n')
const N = parseInt(lines[0], 10)
const dp = {a:[],b:[],c:[]}
for (let i=1;i <= N;i++) {
  const abc = lines[i].split(' ')
  dp.a[i-1] = parseInt(abc[0], 10) + (i>1 ? Math.max(dp.b[i-2], dp.c[i-2]) : 0)
  dp.b[i-1] = parseInt(abc[1], 10) + (i>1 ? Math.max(dp.a[i-2], dp.c[i-2]) : 0)
  dp.c[i-1] = parseInt(abc[2], 10) + (i>1 ? Math.max(dp.b[i-2], dp.a[i-2]) : 0)
}
console.log(Math.max(dp.a[N-1], dp.b[N-1], dp.c[N-1]))