function Main(s) {
  var s = s.split("\n").map(e => e.split(" ").map(e => e*1));
  var dp = new Array(s[0] + 1);
  dp[0] = 0;
  for (var i = 1; i <= s[0]; i++) {
    if (i === 1) {
      dp[i] = s[i];
    } else {
      var x = Math.max(s[i][0] + dp[i-1][1], s[i][0] + dp[i-1][2]);
      var y= Math.max(s[i][1] + dp[i-1][0], s[i][1] + dp[i-1][2]);
      var z = Math.max(s[i][2] + dp[i-1][0], s[i][2] + dp[i-1][1]);
      dp[i] = [x, y, z];
    }
  }
  console.log(Math.max(dp[s[0]][0], dp[s[0]][1], dp[s[0]][2]));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));