n = gets.to_i
dp = Array.new(n+10){Array.new(3, 0)}
happy = []
n.times do |i|
  happy << gets.split.map(&:to_i) 
end

n.times do |i|
  3.times do |k|
    dp[i+1][0] = [dp[i+1][0], dp[i][k]+happy[i][0]].max if k != 0 # k -> 0への遷移
    dp[i+1][1] = [dp[i+1][1], dp[i][k]+happy[i][1]].max if k != 1
    dp[i+1][2] = [dp[i+1][2], dp[i][k]+happy[i][2]].max if k != 2
  end
end

#p happy
#p dp
p dp[n].max