n = gets.rstrip.to_i
happies = n.times.map{gets.rstrip.split.map(&:to_i)}

dp = Array.new(n+1){Array.new(3, 0)}

0.upto(n-1) do | i |
  dp[i+1][0] = [dp[i][1] + happies[i][0], dp[i][2] + happies[i][0]].max
  dp[i+1][1] = [dp[i][0] + happies[i][1], dp[i][2] + happies[i][1]].max
  dp[i+1][2] = [dp[i][0] + happies[i][2], dp[i][1] + happies[i][2]].max
end
p dp[-1].max

=begin
# initialize dp
$dp = []
n.times{$dp << Array.new(n, 0)}
$dp[0][0] = $abcn[0][0]
$dp[0][1] = $abcn[0][1]
$dp[0][2] = $abcn[0][2]
