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