n = gets.to_i
abc = []
n.times { |i|
  abc[i] = gets.split.map(&:to_i)
}

dp = []
dp[0] = abc[0]

1.upto(n-1) { |i|
  tmp = []
  tmp[0] = [dp[i-1][1],dp[i-1][2]].max + abc[i][0]
  tmp[1] = [dp[i-1][0],dp[i-1][2]].max + abc[i][1]
  tmp[2] = [dp[i-1][0],dp[i-1][1]].max + abc[i][2]
  dp << tmp.dup
}

p dp[n-1].max
