'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const n = parseInt(args[0][0], 10)
	const t = args.slice(1, n + 1)
	const dp = new Array(n + 1)

	for (let i = 0; i < dp.length; i++) {
		dp[i] = new Array(3).fill(0)
	}

	for (let i = 0; i < n; i++) {
		const a = t[i].map(arg => parseInt(arg, 10))

		for (let j = 0; j < 3; j++) {
			for (let k = 0; k < 3; k++) {
				if (j === k) continue
				dp[i + 1][j] = Math.max(dp[i + 1][j], dp[i][k] + a[j])
			}
		}
	}

	let max = 0

	for (let i = 0; i < 3; i++) {
		max = Math.max(max, dp[n][i])
	}

	console.log(max)
}

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